saltcorn-samba 0.3.0 → 0.3.3
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.
- package/CHANGELOG.md +33 -0
- package/README.md +10 -2
- package/index.js +27 -9
- package/package.json +1 -4
- package/smb-client.js +11 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,39 @@ All notable changes to `saltcorn-samba` are documented here.
|
|
|
4
4
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [0.3.3] – 2026-07-05
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
- **`plugin[key] is not a function` beim Installieren behoben.**
|
|
11
|
+
Saltcorns Plugin-Loader ruft — sobald ein Plugin `configuration_workflow`
|
|
12
|
+
exportiert — *jeden* weiteren Manifest-Key als Funktion mit der aktuellen
|
|
13
|
+
Konfiguration als Argument auf (siehe
|
|
14
|
+
[saltcorn-data/db/state.ts, Fn `withCfg`](https://github.com/saltcorn/saltcorn/blob/master/packages/saltcorn-data/db/state.ts)).
|
|
15
|
+
In v0.3.2 waren `viewtemplates`, `routes`, `headers` und `dependencies`
|
|
16
|
+
jedoch statische Arrays — der Aufruf `plugin.viewtemplates(cfg)` warf
|
|
17
|
+
daher den Fehler. Alle Keys sind jetzt Factory-Funktionen, die den Wert
|
|
18
|
+
zurückgeben. `plugin_name` als Top-Level-Key wurde entfernt (aus
|
|
19
|
+
demselben Grund unaufrufbar).
|
|
20
|
+
|
|
21
|
+
## [0.3.2] – 2026-07-05
|
|
22
|
+
|
|
23
|
+
### Fixed
|
|
24
|
+
- **Installations-Fehler `plugin[key] is not a function` behoben.**
|
|
25
|
+
Der Top-Level-Manifest-Key `fieldviews` wurde aus `module.exports`
|
|
26
|
+
entfernt: Saltcorns Plugin-Loader erlaubt Fieldviews nur eingebettet in
|
|
27
|
+
ein `types`-Objekt, nicht global. Das Feature `samba_pdf` bleibt im
|
|
28
|
+
Paket enthalten, wird aber erst mit der geplanten DB-Verknüpfung als
|
|
29
|
+
echter typgebundener Fieldview reaktiviert. Der inline-PDF-Viewer im
|
|
30
|
+
`SambaFileManager` und die Route `GET /sambafile?disposition=inline`
|
|
31
|
+
funktionieren wie bisher.
|
|
32
|
+
|
|
33
|
+
## [0.3.1] – 2026-07-05
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
- `smb-client.js` lädt `@marsaud/smb2` jetzt lazy – `npm test` läuft ohne
|
|
37
|
+
vorheriges `npm install`, weil die reinen Sanitizer-Helfer keinen SMB-
|
|
38
|
+
Import mehr auslösen.
|
|
39
|
+
|
|
7
40
|
## [0.3.0] – 2026-07-05
|
|
8
41
|
|
|
9
42
|
### Added
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ Features:
|
|
|
9
9
|
- ⬆️ **Upload / Neuer Ordner / Umbenennen / Löschen** — optional aktivierbar,
|
|
10
10
|
Multi-File-Upload mit Drag-&-Drop, Toast-Feedback, Rollen-Gate.
|
|
11
11
|
- 🌳 **`SambaTree`-View** — Lazy-loading Verzeichnisbaum, ideal zum Einbetten in Show-Views.
|
|
12
|
-
- 📄
|
|
12
|
+
- 📄 **Inline-PDF-/Bild-Anzeige** direkt im `SambaFileManager` (Klick auf eine Datei), plus Download- und externe-App-Buttons.
|
|
13
13
|
- 🚀 **`smb://`-Links** — Öffnet Dateien und Ordner direkt in Nemo, Nautilus, Dolphin (Linux) oder Explorer (Windows).
|
|
14
14
|
- 🔒 **Sicherheit** — Base-Path als „Chroot", strenge Path-Traversal-Prüfung (`..`, absolute Pfade, UNC, Drive-Letters, NUL-Bytes), CSRF-Schutz auf Schreib-Routen, Filename-Sanitizer, Extension-Blocklist, rollenbasierter Zugriff (getrennte Lese-/Schreib-Rollen).
|
|
15
15
|
- 🐳 **Docker-freundlich** — direkt per SMB2-Protokoll, keine System-Binaries nötig.
|
|
@@ -168,7 +168,15 @@ Mode = `from_field`, Row field = `akte_dir` einbetten.
|
|
|
168
168
|
Kompaktere Alternative – lazy-loading Baum, ideal in einer Sidebar oder
|
|
169
169
|
neben Formularen. Gleiche Path-Modi wie beim File-Manager.
|
|
170
170
|
|
|
171
|
-
### Fieldview `samba_pdf`
|
|
171
|
+
### Fieldview `samba_pdf` (deaktiviert seit 0.3.2)
|
|
172
|
+
|
|
173
|
+
> Der eigenständige Fieldview `samba_pdf` ist temporär nicht als
|
|
174
|
+
> Fieldview registriert, weil er ohne DB-Verknüpfung an einen konkreten
|
|
175
|
+
> Saltcorn-Typ gebunden werden müsste. Er kehrt in einer späteren
|
|
176
|
+
> Version zusammen mit der DB-Integration zurück. Bis dahin liefert der
|
|
177
|
+
> `SambaFileManager` selbst die Inline-Anzeige.
|
|
178
|
+
|
|
179
|
+
_Historische Beschreibung:_
|
|
172
180
|
|
|
173
181
|
Für ein String-Feld mit Datei-Pfad (relativ zum Base-Path). In der View-
|
|
174
182
|
Konfiguration `Field view = samba_pdf` wählen. Rendert PDFs im `<iframe>`,
|
package/index.js
CHANGED
|
@@ -38,7 +38,8 @@ const {
|
|
|
38
38
|
} = require("./smb-client");
|
|
39
39
|
const treeView = require("./tree-view");
|
|
40
40
|
const fileManagerView = require("./filemanager-view");
|
|
41
|
-
|
|
41
|
+
// pdf-view is intentionally NOT wired into the manifest (see note at bottom).
|
|
42
|
+
// The file is kept in the package so the DB-linkage release can revive it.
|
|
42
43
|
|
|
43
44
|
const PLUGIN_VERSION = pkg.version;
|
|
44
45
|
const PLUGIN_NAME = "saltcorn-samba@" + PLUGIN_VERSION;
|
|
@@ -606,17 +607,34 @@ function wrapView(v) {
|
|
|
606
607
|
// Manifest
|
|
607
608
|
// ---------------------------------------------------------------------------
|
|
608
609
|
|
|
610
|
+
// ---------------------------------------------------------------------------
|
|
611
|
+
// IMPORTANT: how Saltcorn iterates the manifest
|
|
612
|
+
// ---------------------------------------------------------------------------
|
|
613
|
+
// When a plugin exports `configuration_workflow`, Saltcorn's state loader
|
|
614
|
+
// treats EVERY other manifest key as a factory function and calls it with the
|
|
615
|
+
// current plugin configuration — see
|
|
616
|
+
// packages/saltcorn-data/db/state.ts `withCfg` (`plugin[key](cfg || {})`).
|
|
617
|
+
// So each key below must be a function that returns the value, otherwise
|
|
618
|
+
// Node throws `plugin[key] is not a function`. The only exceptions are the
|
|
619
|
+
// bookkeeping keys `sc_plugin_api_version` and `configuration_workflow`
|
|
620
|
+
// itself, which the loader accesses directly.
|
|
621
|
+
// ---------------------------------------------------------------------------
|
|
622
|
+
|
|
609
623
|
module.exports = {
|
|
610
624
|
sc_plugin_api_version: 1,
|
|
611
|
-
plugin_name: PLUGIN_NAME,
|
|
612
625
|
configuration_workflow,
|
|
613
|
-
viewtemplates: [wrapView(fileManagerView), wrapView(treeView)],
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
},
|
|
617
|
-
routes,
|
|
618
|
-
headers: [
|
|
626
|
+
viewtemplates: () => [wrapView(fileManagerView), wrapView(treeView)],
|
|
627
|
+
routes: () => routes,
|
|
628
|
+
headers: () => [
|
|
619
629
|
{ css: `/plugins/public/${PLUGIN_NAME}/samba.css` },
|
|
620
630
|
],
|
|
621
|
-
dependencies: [],
|
|
631
|
+
dependencies: () => [],
|
|
622
632
|
};
|
|
633
|
+
|
|
634
|
+
// Note: the `samba_pdf` fieldview shipped in v0.1–0.3.1 has been removed from
|
|
635
|
+
// the top-level manifest because Saltcorn's plugin loader requires field
|
|
636
|
+
// views to be attached to a type, not registered globally. The inline PDF /
|
|
637
|
+
// image viewer is still available through the SambaFileManager view (click a
|
|
638
|
+
// row) and via the `GET /sambafile?path=...&disposition=inline` route.
|
|
639
|
+
// A properly-typed reintroduction of `samba_pdf` will follow together with
|
|
640
|
+
// the DB-linkage feature in a later release.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saltcorn-samba",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Saltcorn plugin: browse, upload, rename and delete files on a Samba/CIFS share. File-manager view, directory tree, inline PDF viewer, external-app open (smb://).",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -49,8 +49,5 @@
|
|
|
49
49
|
],
|
|
50
50
|
"publishConfig": {
|
|
51
51
|
"access": "public"
|
|
52
|
-
},
|
|
53
|
-
"directories": {
|
|
54
|
-
"test": "test"
|
|
55
52
|
}
|
|
56
53
|
}
|
package/smb-client.js
CHANGED
|
@@ -7,7 +7,16 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
const path = require("path");
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
// @marsaud/smb2 is loaded lazily so the pure sanitizer helpers exported by
|
|
12
|
+
// this module can be required (e.g. from unit tests) without needing the
|
|
13
|
+
// native SMB dependency installed.
|
|
14
|
+
let _SMB2 = null;
|
|
15
|
+
function getSMB2() {
|
|
16
|
+
if (_SMB2) return _SMB2;
|
|
17
|
+
_SMB2 = require("@marsaud/smb2");
|
|
18
|
+
return _SMB2;
|
|
19
|
+
}
|
|
11
20
|
|
|
12
21
|
// ---------------------------------------------------------------------------
|
|
13
22
|
// Path helpers
|
|
@@ -108,6 +117,7 @@ function buildClient(config) {
|
|
|
108
117
|
if (/[\\/]/.test(share)) throw new Error("Samba: share must not contain slashes");
|
|
109
118
|
|
|
110
119
|
const shareStr = `\\\\${server}${port ? ":" + port : ""}\\${share}`;
|
|
120
|
+
const SMB2 = getSMB2();
|
|
111
121
|
const smb = new SMB2({
|
|
112
122
|
share: shareStr,
|
|
113
123
|
domain: domain || "WORKGROUP",
|