@cloudron/pankow 4.1.3 → 4.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -304,7 +304,7 @@ export default {
304
304
  },
305
305
  refreshHandler: {
306
306
  type: Function,
307
- default() { console.warn('Missing refreshHandler for DirectoryView'); }
307
+ default: null
308
308
  }
309
309
  },
310
310
  computed: {
@@ -378,13 +378,15 @@ export default {
378
378
  action: this.onSelectAll
379
379
  }, {
380
380
  separator:true,
381
- visible: () => { return this.showNewFile || this.showNewFolder; },
381
+ visible: () => { return typeof this.refreshHandler === 'function'; },
382
382
  }, {
383
383
  label: this.tr('filemanager.toolbar.refresh'),
384
384
  icon:'fa-solid fa-arrow-rotate-right',
385
+ visible: () => { return typeof this.refreshHandler === 'function'; },
385
386
  action: this.refreshHandler,
386
387
  }, {
387
388
  separator:true,
389
+ visible: () => { return this.showNewFile || this.showNewFolder; },
388
390
  }, {
389
391
  label: this.tr('filemanager.toolbar.newFile'),
390
392
  icon:'fa-solid fa-file-circle-plus',
@@ -0,0 +1,142 @@
1
+ <script setup>
2
+
3
+ import Button from './Button.vue';
4
+
5
+ defineEmits(['login']);
6
+
7
+ defineProps({
8
+ iconUrl: {
9
+ type: String,
10
+ default: '',
11
+ },
12
+ title: {
13
+ type: String,
14
+ default: 'Title',
15
+ },
16
+ message: {
17
+ type: String,
18
+ default: 'Message',
19
+ },
20
+ footer: {
21
+ type: String,
22
+ default: 'Footer',
23
+ },
24
+ loginLabel: {
25
+ type: String,
26
+ default: 'Login',
27
+ },
28
+ });
29
+
30
+ </script>
31
+
32
+ <template>
33
+ <div class="pankow-login-view">
34
+ <div class="pankow-login-view-root">
35
+ <div class="pankow-login-view-left pankow-no-mobile">
36
+ <img class="pankow-login-view-icon" width="128" height="128" :src="iconUrl" :alt="title" />
37
+ </div>
38
+
39
+ <div class="pankow-login-view-right">
40
+ <div class="pankow-login-view-mobile-container">
41
+ <img class="pankow-login-view-icon" width="128" height="128" :src="iconUrl" :alt="title" />
42
+ </div>
43
+ <h1 class="pankow-login-view-title">{{ title }}</h1>
44
+ <h2 class="pankow-login-view-message" v-show="message">{{ message }}</h2>
45
+ <Button id="loginSubmitButton" @click="$emit('login')">{{ loginLabel }}</Button>
46
+ <div class="pankow-login-view-footer" v-show="footer">{{ footer }}</div>
47
+ </div>
48
+ </div>
49
+ </div>
50
+ </template>
51
+
52
+ <style scoped>
53
+
54
+ .pankow-login-view {
55
+ height: 100%;
56
+ }
57
+
58
+ .pankow-login-view-root {
59
+ display: flex;
60
+ overflow: hidden;
61
+ height: 100%;
62
+ }
63
+
64
+ .pankow-login-view-left {
65
+ background: linear-gradient(90deg,rgb(74, 173, 245) 0%,var(--pankow-color-primary) 100%);
66
+ flex-basis: 30%;
67
+ justify-content: center;
68
+ flex-direction: column;
69
+ display: flex;
70
+ align-items: center;
71
+ }
72
+
73
+ .pankow-login-view-left .pankow-login-view-icon {
74
+ margin-bottom: 20px;
75
+ }
76
+
77
+ .pankow-login-view-title {
78
+ font-family: var(--pankow-font-family);
79
+ font-weight: 700;
80
+ font-size: 28px;
81
+ margin-bottom: 15px;
82
+ }
83
+
84
+ .pankow-login-view-message {
85
+ font-family: var(--pankow-font-family);
86
+ font-weight: 400;
87
+ font-size: 16px;
88
+ margin-top: 5px;
89
+ margin-bottom: 30px;
90
+ }
91
+
92
+ .pankow-login-view-footer {
93
+ font-size: 12px;
94
+ padding: 5px;
95
+ position: absolute;
96
+ bottom: 5px;
97
+ }
98
+
99
+ .pankow-login-view-right {
100
+ display: flex;
101
+ align-self: stretch;
102
+ flex-direction: column;
103
+ padding: 40px;
104
+ white-space: nowrap;
105
+ justify-content: center;
106
+ }
107
+
108
+ .pankow-login-view-right {
109
+ max-width: 400px;
110
+ }
111
+
112
+ .pankow-login-view-mobile-container {
113
+ display: none;
114
+ }
115
+
116
+ @media (max-width: 576px) {
117
+ .pankow-login-view-mobile-container {
118
+ display: block;
119
+ text-align: center;
120
+ }
121
+
122
+ .pankow-login-view-right {
123
+ display: flex;
124
+ flex-direction: column;
125
+ height: 100%;
126
+ width: 100%;
127
+ max-width: unset;
128
+ padding-left: 20px;
129
+ padding-right: 20px;
130
+ justify-content: start;
131
+ flex-basis: unset;
132
+ text-align: center;
133
+ gap: 2rem;
134
+ }
135
+
136
+ .pankow-login-view-right {
137
+ max-width: unset;
138
+ text-align: left;
139
+ }
140
+ }
141
+
142
+ </style>
package/index.js CHANGED
@@ -21,6 +21,7 @@ import FileUploader from './components/FileUploader.vue';
21
21
  import FormGroup from './components/FormGroup.vue';
22
22
  import Icon from './components/Icon.vue';
23
23
  import InputDialog from './components/InputDialog.vue';
24
+ import LoginView from './components/LoginView.vue';
24
25
  import MainLayout from './components/MainLayout.vue';
25
26
  import MaskedInput from './components/MaskedInput.vue';
26
27
  import Menu from './components/Menu.vue';
@@ -69,6 +70,7 @@ export {
69
70
  InputGroup,
70
71
  Icon,
71
72
  InputDialog,
73
+ LoginView,
72
74
  MainLayout,
73
75
  MaskedInput,
74
76
  Menu,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cloudron/pankow",
3
3
  "private": false,
4
- "version": "4.1.3",
4
+ "version": "4.1.5",
5
5
  "description": "",
6
6
  "main": "index.js",
7
7
  "types": "types/index.d.ts",
@@ -30,11 +30,11 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@highlightjs/vue-plugin": "^2.1.0",
33
- "@vitejs/plugin-vue": "^6.0.4",
33
+ "@vitejs/plugin-vue": "^6.0.5",
34
34
  "highlight.js": "^11.11.1",
35
35
  "typescript": "^5.9.3",
36
- "vite": "^7.3.1",
37
- "vue": "^3.5.29",
36
+ "vite": "^8.0.0",
37
+ "vue": "^3.5.30",
38
38
  "vue-router": "^5.0.3"
39
39
  }
40
40
  }
package/stats.js ADDED
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Lists all collections in the Cloudron MongoDB database and displays their sizes.
3
+ * Uses: CLOUDRON_MONGODB_URL, or CLOUDRON_MONGODB_HOST/PORT/DATABASE/USERNAME/PASSWORD
4
+ *
5
+ * Run: node stats.js
6
+ */
7
+
8
+ import { MongoClient } from 'mongodb';
9
+
10
+ function formatBytes(bytes) {
11
+ if (bytes === 0) return '0 B';
12
+ const k = 1024;
13
+ const sizes = ['B', 'KB', 'MB', 'GB'];
14
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
15
+ return `${(bytes / Math.pow(k, i)).toFixed(2)} ${sizes[i]}`;
16
+ }
17
+
18
+ function getConnectionUrl() {
19
+ const url = process.env.CLOUDRON_MONGODB_URL;
20
+ if (url) return url;
21
+
22
+ const host = process.env.CLOUDRON_MONGODB_HOST;
23
+ const port = process.env.CLOUDRON_MONGODB_PORT;
24
+ const database = process.env.CLOUDRON_MONGODB_DATABASE;
25
+ const username = process.env.CLOUDRON_MONGODB_USERNAME;
26
+ const password = process.env.CLOUDRON_MONGODB_PASSWORD;
27
+
28
+ if (!host || !database) {
29
+ throw new Error(
30
+ 'Set CLOUDRON_MONGODB_URL or CLOUDRON_MONGODB_HOST and CLOUDRON_MONGODB_DATABASE (and optionally USERNAME, PASSWORD, PORT)'
31
+ );
32
+ }
33
+
34
+ const auth = username && password ? `${encodeURIComponent(username)}:${encodeURIComponent(password)}@` : '';
35
+ const portPart = port ? `:${port}` : '';
36
+ return `mongodb://${auth}${host}${portPart}/${database}`;
37
+ }
38
+
39
+ async function main() {
40
+ const uri = getConnectionUrl();
41
+ const client = new MongoClient(uri);
42
+
43
+ try {
44
+ await client.connect();
45
+ const db = client.db(); // uses database from URI
46
+ const dbName = db.databaseName;
47
+
48
+ const collections = await db.listCollections().toArray();
49
+ if (collections.length === 0) {
50
+ console.log(`Database "${dbName}" has no collections.\n`);
51
+ return;
52
+ }
53
+
54
+ console.log(`Database: ${dbName}\n`);
55
+ console.log('Collection | Size (data) | Storage size | Index size');
56
+ console.log('-'.repeat(75));
57
+
58
+ let totalSize = 0;
59
+ let totalStorageSize = 0;
60
+ let totalIndexSize = 0;
61
+
62
+ for (const { name } of collections) {
63
+ const stats = await db.command({ collStats: name });
64
+ const size = stats.size ?? 0;
65
+ const storageSize = stats.storageSize ?? 0;
66
+ const indexSize = stats.totalIndexSize ?? 0;
67
+
68
+ totalSize += size;
69
+ totalStorageSize += storageSize;
70
+ totalIndexSize += indexSize;
71
+
72
+ console.log(
73
+ `${name.padEnd(28)} | ${formatBytes(size).padStart(13)} | ${formatBytes(storageSize).padStart(13)} | ${formatBytes(indexSize)}`
74
+ );
75
+ }
76
+
77
+ console.log('-'.repeat(75));
78
+ console.log(
79
+ `${'TOTAL'.padEnd(28)} | ${formatBytes(totalSize).padStart(13)} | ${formatBytes(totalStorageSize).padStart(13)} | ${formatBytes(totalIndexSize)}`
80
+ );
81
+ } finally {
82
+ await client.close();
83
+ }
84
+ }
85
+
86
+ main().catch((err) => {
87
+ console.error(err);
88
+ process.exit(1);
89
+ });
package/style.css CHANGED
@@ -14,9 +14,14 @@
14
14
 
15
15
  --pankow-body-background-color: white;
16
16
 
17
- --pankow-text-color: #333;
18
- --pankow-text-color-alt: #333;
17
+ --pankow-color-text: #333;
18
+ --pankow-color-text-secondary: #666;
19
+
20
+ /* old use above */
19
21
  --pankow-text-color-white: white;
22
+ --pankow-text-color: var(--pankow-color-text);
23
+ --pankow-text-color-alt: var(--pankow-color-text-secondary);
24
+ --pankow-text-secondary: var(--pankow-color-text-secondary);
20
25
 
21
26
  --pankow-color-dark: #495057;
22
27
  --pankow-color-dark-secondary: #495057;
@@ -93,8 +98,9 @@ input {
93
98
  :root {
94
99
  --pankow-body-background-color: black;
95
100
 
96
- --pankow-text-color: #ced4da;
97
- --pankow-text-color-alt: #495057;
101
+ --pankow-color-text: #ced4da;
102
+ --pankow-color-text-secondary: #495057;
103
+
98
104
  --pankow-text-color-white: #ced4da;
99
105
 
100
106
  --pankow-input-background-color: #1b1e21;
package/types/index.d.ts CHANGED
@@ -3,4 +3,4 @@ import gestures from './gestures.js';
3
3
  import tooltip from './tooltip.js';
4
4
  import fallbackImage from './fallbackImage.js';
5
5
  import utils from './utils.js';
6
- export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, DateTimeInput, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils };
6
+ export { BottomBar, Breadcrumb, Button, ButtonGroup, ClipboardAction, ClipboardButton, Checkbox, DateTimeInput, Dialog, DirectoryView, EmailInput, FileUploader, FormGroup, InputGroup, Icon, InputDialog, LoginView, MainLayout, MaskedInput, Menu, MenuItem, SingleSelect, MultiSelect, Notification, NumberInput, OfflineBanner, PasswordInput, Popover, ProgressBar, Radiobutton, SideBar, Spinner, Switch, TableView, TabView, TagInput, TextInput, TextInputRaw, TopBar, TreeView, fetcher, gestures, tooltip, fallbackImage, utils };
package/utils.js CHANGED
@@ -357,6 +357,7 @@ const fallbackTranslations = {
357
357
  "uploadFolder": "Upload Folder",
358
358
  "uploadFile": "Upload File",
359
359
  "restartApp": "Restart App",
360
+ "refresh": "Refresh",
360
361
  "openTerminal": "Open Terminal",
361
362
  "openLogs": "Open Logs"
362
363
  },
@@ -22,10 +22,6 @@
22
22
  import { getFileTypeGroup } from '../utils.js';
23
23
  import Button from '../components/Button.vue';
24
24
 
25
- function defaultDownloadHandler() {
26
- console.warn('Missing downloadHandler for ImageViewer');
27
- }
28
-
29
25
  let touchDist = 0;
30
26
  let startY = 0;
31
27
  const dismissDistanceThreshold = 150;
@@ -37,7 +33,7 @@ export default {
37
33
  props: {
38
34
  downloadHandler: {
39
35
  type: Function,
40
- default: defaultDownloadHandler
36
+ default: null
41
37
  },
42
38
  navigationHandler: {
43
39
  type: Function,
@@ -62,7 +58,7 @@ export default {
62
58
  };
63
59
  },
64
60
  computed: {
65
- hasDownloadHandler() { return this.downloadHandler !== defaultDownloadHandler }
61
+ hasDownloadHandler() { return typeof this.downloadHandler === 'function' }
66
62
  },
67
63
  methods: {
68
64
  getFileTypeGroup,
@@ -11,7 +11,7 @@
11
11
  <div class="file-name">{{ entry ? entry.fileName : '' }}</div>
12
12
  </template>
13
13
  <template #right>
14
- <Button :icon="busySave ? null : 'fa-regular fa-floppy-disk'" success @click="onSave" :disabled="busySave || !isChanged" style="margin-right: 5px;"><Spinner v-show="busySave" style="stroke: white;"/> {{ tr('filemanager.textEditor.save') }}</Button>
14
+ <Button v-if="!readonly" :icon="busySave ? null : 'fa-regular fa-floppy-disk'" success @click="onSave" :disabled="busySave || !isChanged" style="margin-right: 5px;"><Spinner v-show="busySave" style="stroke: white;"/> {{ tr('filemanager.textEditor.save') }}</Button>
15
15
  <Button icon="fa-solid fa-xmark" @click="onClose">{{ tr('main.dialog.close') }}</Button>
16
16
  </template>
17
17
  </TopBar>
@@ -68,6 +68,10 @@ export default {
68
68
  tr: {
69
69
  type: Function,
70
70
  default(id) { console.warn('Missing tr for TextViewer'); return utils.translation(id); }
71
+ },
72
+ readonly: {
73
+ type: Boolean,
74
+ default: false
71
75
  }
72
76
  },
73
77
  components: {