@social-mail/social-mail-web-server 1.7.307 → 1.7.308
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/dist/common/BaseDiskCache.d.ts +1 -0
- package/dist/common/BaseDiskCache.d.ts.map +1 -1
- package/dist/common/BaseDiskCache.js +15 -0
- package/dist/common/BaseDiskCache.js.map +1 -1
- package/dist/server/model/events/ConfigurationEvents.d.ts +2 -0
- package/dist/server/model/events/ConfigurationEvents.d.ts.map +1 -1
- package/dist/server/model/events/ConfigurationEvents.js +16 -0
- package/dist/server/model/events/ConfigurationEvents.js.map +1 -1
- package/dist/server/seed/ui/seed-ui.js +1 -1
- package/dist/server/services/files/SiteDiskContentCache.d.ts.map +1 -1
- package/dist/server/services/files/SiteDiskContentCache.js +5 -0
- package/dist/server/services/files/SiteDiskContentCache.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/common/BaseDiskCache.ts +15 -0
- package/src/server/model/events/ConfigurationEvents.ts +6 -3
- package/src/server/seed/ui/seed-ui.ts +1 -1
- package/src/server/services/files/SiteDiskContentCache.ts +11 -0
package/package.json
CHANGED
|
@@ -60,6 +60,21 @@ export default class BaseDiskCache {
|
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
+
async clear() {
|
|
64
|
+
try {
|
|
65
|
+
const path = this.root;
|
|
66
|
+
if (!existsSync(path)) {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const stalePath = `${path}.old.${Date.now()}`;
|
|
70
|
+
await spawnPromise("mv",[path, stalePath]);
|
|
71
|
+
ensureDir(this.root);
|
|
72
|
+
rm(stalePath, { recursive: true, force: true}).catch(console.error);
|
|
73
|
+
} catch (error) {
|
|
74
|
+
console.error(error);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
63
78
|
async clearFolder(path: string) {
|
|
64
79
|
try {
|
|
65
80
|
path = join(this.root, path);
|
|
@@ -2,12 +2,14 @@ import { IEntityQuery } from "@entity-access/entity-access/dist/model/IFilterWit
|
|
|
2
2
|
import Configuration from "../entities/Configuration.js";
|
|
3
3
|
import AuthenticatedEvents from "./AuthenticatedEvents.js";
|
|
4
4
|
import ChangeEntry from "@entity-access/entity-access/dist/model/changes/ChangeEntry.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import EncryptionService from "../../services/encryption/EncryptionService.js";
|
|
5
|
+
import Inject from "@entity-access/entity-access/dist/di/di.js";
|
|
6
|
+
import MessagingService from "../../services/message-events/MessagingService.js";
|
|
8
7
|
|
|
9
8
|
export default class ConfigurationEvents extends AuthenticatedEvents<Configuration> {
|
|
10
9
|
|
|
10
|
+
@Inject
|
|
11
|
+
ms: MessagingService;
|
|
12
|
+
|
|
11
13
|
filter(query: IEntityQuery<Configuration>): IEntityQuery<Configuration> {
|
|
12
14
|
this.sessionUser.ensureIsAdmin();
|
|
13
15
|
return query;
|
|
@@ -30,6 +32,7 @@ export default class ConfigurationEvents extends AuthenticatedEvents<Configurati
|
|
|
30
32
|
|
|
31
33
|
beforeUpdate(entity: Configuration, entry: ChangeEntry): void | Promise<void> {
|
|
32
34
|
this.sessionUser.ensureIsAdmin();
|
|
35
|
+
this.ms.snapshotRefresh.notify({ folderID: 0 });
|
|
33
36
|
// if (entry.isModified("password")) {
|
|
34
37
|
// throw new EntityAccessError(`Password cannot be modified`);
|
|
35
38
|
// }
|
|
@@ -6,7 +6,7 @@ export default async function seedUI(config: DBConfig) {
|
|
|
6
6
|
await config.saveVersion(UIPackageConfig, {
|
|
7
7
|
package: "@social-mail/social-mail-client",
|
|
8
8
|
view: "dist/web/AppIndex",
|
|
9
|
-
version: "1.4.
|
|
9
|
+
version: "1.4.197"
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
await config.saveVersion(WebComponentsPackageConfig, {
|
|
@@ -4,6 +4,7 @@ import { join } from "path";
|
|
|
4
4
|
import BaseDiskCache from "../../../common/BaseDiskCache.js";
|
|
5
5
|
import { globalEnv } from "../../../common/globalEnv.js";
|
|
6
6
|
import MessagingService from "../message-events/MessagingService.js";
|
|
7
|
+
import { readdir } from "fs/promises";
|
|
7
8
|
|
|
8
9
|
@RegisterSingleton
|
|
9
10
|
export default class SiteDiskContentCache extends ServiceObject {
|
|
@@ -18,9 +19,19 @@ export default class SiteDiskContentCache extends ServiceObject {
|
|
|
18
19
|
|
|
19
20
|
postInit() {
|
|
20
21
|
this.ms.snapshotRefresh.on(({ folderID }) => {
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
if (folderID === 0) {
|
|
25
|
+
// we need to refresh everything...
|
|
26
|
+
this.htmlFileCache.clear().catch(console.error);
|
|
27
|
+
return;
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
21
31
|
// at zero all host to snapshot map will be stored
|
|
22
32
|
this.htmlFileCache.clearFolder("0").catch(console.error);
|
|
23
33
|
this.htmlFileCache.clearFolder(folderID.toString()).catch(console.error);
|
|
34
|
+
|
|
24
35
|
});
|
|
25
36
|
}
|
|
26
37
|
|