@gentbajko/slopify 3.15.0 → 3.16.0
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/edge/http/storage.js +26 -1
- package/dist/extension/slopify-studio-chrome.zip +0 -0
- package/dist/extension/slopify-studio-firefox.zip +0 -0
- package/dist/patch-notes/3.16.0.md +10 -0
- package/dist/patch-notes/index.json +6 -0
- package/dist/slices/storage/trim.js +116 -3
- package/dist/tutorials/Where-Your-Files-Live.md +10 -0
- package/dist/web/assets/index-Dvz8bsiD.js +325 -0
- package/dist/web/assets/{pdf-BYQLQv5-.js → pdf-C6KhxeKQ.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/web/assets/index-_soH0ZuO.js +0 -325
|
@@ -6,7 +6,7 @@ import { BackupBusyError, planBackup, streamBackup, } from "../../slices/storage
|
|
|
6
6
|
import { BackupImportRefused, importBackup } from "../../slices/storage/backup-import.js";
|
|
7
7
|
import { importPortable, portableMaxArchiveBytes, storageUsage, } from "../../slices/storage/portable.js";
|
|
8
8
|
import { reconcileStorage } from "../../slices/storage/reconcile.js";
|
|
9
|
-
import { keepOutputsOnly, projectStorage } from "../../slices/storage/trim.js";
|
|
9
|
+
import { cleanUpAll, deleteAllOldVersions, deleteOldVersions, keepOutputsOnly, projectStorage, } from "../../slices/storage/trim.js";
|
|
10
10
|
import { onInvalid, problem, titleOf } from "./problem.js";
|
|
11
11
|
const idParam = z.object({
|
|
12
12
|
id: z
|
|
@@ -57,6 +57,31 @@ export function storageRoutes(deps) {
|
|
|
57
57
|
detail: "Only a finished project can drop its working files, and this one is running, waiting or has unfinished steps. Let it finish (or cancel it on its project page), then drop the working files again from the project page or Settings → Storage.",
|
|
58
58
|
});
|
|
59
59
|
})
|
|
60
|
+
// Delete old versions: one project's History files (`slices/storage/trim.ts`).
|
|
61
|
+
.post("/projects/:id/old-versions/delete", zValidator("param", idParam, onInvalid), (c) => {
|
|
62
|
+
const result = deleteOldVersions({ db: deps.db, paths: deps.paths, hasInflight: deps.runner.hasInflight }, c.req.valid("param").id);
|
|
63
|
+
if (result.ok)
|
|
64
|
+
return c.json(result);
|
|
65
|
+
return result.reason === "no-project"
|
|
66
|
+
? problem(c, {
|
|
67
|
+
status: 404,
|
|
68
|
+
title: titleOf(404),
|
|
69
|
+
detail: "This project no longer exists. Reload Settings → Backup & storage to see the current list.",
|
|
70
|
+
})
|
|
71
|
+
: problem(c, {
|
|
72
|
+
status: 409,
|
|
73
|
+
title: titleOf(409),
|
|
74
|
+
detail: "This project is running or has steps waiting to run, and its files stay where they are until then. Let it finish, or cancel its run on its project page, then press Delete old versions again.",
|
|
75
|
+
});
|
|
76
|
+
})
|
|
77
|
+
// Every project's old versions; ones that are running are left for later.
|
|
78
|
+
.post("/old-versions/delete", (c) => c.json(deleteAllOldVersions({
|
|
79
|
+
db: deps.db,
|
|
80
|
+
paths: deps.paths,
|
|
81
|
+
hasInflight: deps.runner.hasInflight,
|
|
82
|
+
})))
|
|
83
|
+
// Clean up: old versions everywhere and working files of every finished project.
|
|
84
|
+
.post("/cleanup", (c) => c.json(cleanUpAll({ db: deps.db, paths: deps.paths, hasInflight: deps.runner.hasInflight })))
|
|
60
85
|
// What Export everything would write, asked before the download starts: a download
|
|
61
86
|
// link cannot show a refusal, the browser would save it as the file.
|
|
62
87
|
.get("/export/summary", (c) => {
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Slopify 3.16.0
|
|
2
|
+
|
|
3
|
+
Released 9 October 2026.
|
|
4
|
+
|
|
5
|
+
- **Free space from inside Slopify.** Settings → Backup & storage → Disk space now shows each project's old versions (its History folder) next to its outputs and working files, and offers:
|
|
6
|
+
- **Delete old versions** on each project, and on a finished project's page under Free space: removes earlier renders and narration, and keeps the current version.
|
|
7
|
+
- **Delete all old versions**, for every project at once.
|
|
8
|
+
- **Clean up everything**: old versions for every project, and the working files of every finished one (Keep outputs only). Projects that are running or not finished keep everything.
|
|
9
|
+
|
|
10
|
+
Each asks first and says how much it frees. Your uploads and anything you put in History yourself are never removed. Going back to an old version, or changing a project later, makes those files again.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { existsSync, readdirSync, statSync, unlinkSync } from "node:fs";
|
|
1
|
+
import { existsSync, readdirSync, rmdirSync, statSync, unlinkSync } from "node:fs";
|
|
2
2
|
import { join, relative, sep } from "node:path";
|
|
3
3
|
import { derive } from "../../kernel/runner/graph.js";
|
|
4
|
-
import { projectExists, projectPaused, stagesOf } from "../admission/repo.js";
|
|
4
|
+
import { liveProject, projectExists, projectPaused, stagesOf } from "../admission/repo.js";
|
|
5
|
+
import { projectSettled } from "./arrange.js";
|
|
5
6
|
import { backupsFolderName, outputPath, projectDir } from "./layout.js";
|
|
6
7
|
import { pieceFile } from "./reconcile.js";
|
|
7
8
|
// Keep outputs only: a finished project drops the working files it was made from (images,
|
|
@@ -37,7 +38,14 @@ export function projectStorage(deps, projectId) {
|
|
|
37
38
|
let workingBytes = 0;
|
|
38
39
|
let removableFiles = 0;
|
|
39
40
|
let removableBytes = 0;
|
|
41
|
+
const history = historyPaths(deps, projectId);
|
|
42
|
+
let historyFiles = 0;
|
|
43
|
+
let historyBytes = 0;
|
|
40
44
|
for (const [path, bytes] of files) {
|
|
45
|
+
if (history.has(path)) {
|
|
46
|
+
historyFiles += 1;
|
|
47
|
+
historyBytes += bytes;
|
|
48
|
+
}
|
|
41
49
|
if (outputs.has(path))
|
|
42
50
|
outputsBytes += bytes;
|
|
43
51
|
else
|
|
@@ -52,9 +60,110 @@ export function projectStorage(deps, projectId) {
|
|
|
52
60
|
workingBytes,
|
|
53
61
|
removableFiles,
|
|
54
62
|
removableBytes,
|
|
63
|
+
historyFiles,
|
|
64
|
+
historyBytes,
|
|
55
65
|
finished: finished(deps, projectId),
|
|
56
66
|
};
|
|
57
67
|
}
|
|
68
|
+
// Delete old versions: the files of older versions that arranging moved to History/, by their
|
|
69
|
+
// stored paths. Never a file the user supplied, nor one they put in History themselves. Going
|
|
70
|
+
// back to such a version makes its files again.
|
|
71
|
+
function historyPaths(deps, projectId) {
|
|
72
|
+
const supplied = suppliedPaths(deps.db, projectId);
|
|
73
|
+
const out = new Set();
|
|
74
|
+
for (const [path, place] of placedFiles(deps.paths, projectId))
|
|
75
|
+
if (place.startsWith("History/") && !supplied.has(path))
|
|
76
|
+
out.add(path);
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
function placedFiles(paths, projectId) {
|
|
80
|
+
const places = paths.places;
|
|
81
|
+
return places !== undefined && "placesOf" in places
|
|
82
|
+
? places.placesOf(projectId)
|
|
83
|
+
: new Map();
|
|
84
|
+
}
|
|
85
|
+
export function deleteOldVersions(deps, projectId) {
|
|
86
|
+
if (!projectExists(deps.db, projectId))
|
|
87
|
+
return { ok: false, reason: "no-project" };
|
|
88
|
+
if (deps.hasInflight?.(projectId) === true || !projectSettled(deps.db, projectId))
|
|
89
|
+
return { ok: false, reason: "busy" };
|
|
90
|
+
const files = filesOf(deps.paths, projectId);
|
|
91
|
+
let count = 0;
|
|
92
|
+
let bytesFreed = 0;
|
|
93
|
+
for (const path of historyPaths(deps, projectId)) {
|
|
94
|
+
const bytes = files.get(path);
|
|
95
|
+
if (bytes === undefined)
|
|
96
|
+
continue;
|
|
97
|
+
unlinkSync(outputPath(deps.paths, projectId, path));
|
|
98
|
+
count += 1;
|
|
99
|
+
bytesFreed += bytes;
|
|
100
|
+
}
|
|
101
|
+
removeEmptyUnder(join(projectDir(deps.paths, projectId), "History"));
|
|
102
|
+
return { ok: true, files: count, bytesFreed };
|
|
103
|
+
}
|
|
104
|
+
// Every project's old versions, skipping any that runs or waits to run.
|
|
105
|
+
export function deleteAllOldVersions(deps) {
|
|
106
|
+
const busyIds = [];
|
|
107
|
+
let projects = 0;
|
|
108
|
+
let files = 0;
|
|
109
|
+
let bytesFreed = 0;
|
|
110
|
+
let busy = 0;
|
|
111
|
+
for (const row of deps.db.prepare(`SELECT id FROM projects WHERE ${liveProject()}`).all()) {
|
|
112
|
+
const id = String(row.id);
|
|
113
|
+
if (placedFiles(deps.paths, id).size === 0)
|
|
114
|
+
continue;
|
|
115
|
+
const result = deleteOldVersions(deps, id);
|
|
116
|
+
if (!result.ok) {
|
|
117
|
+
if (result.reason === "busy") {
|
|
118
|
+
busy += 1;
|
|
119
|
+
busyIds.push(id);
|
|
120
|
+
}
|
|
121
|
+
continue;
|
|
122
|
+
}
|
|
123
|
+
if (result.files > 0)
|
|
124
|
+
projects += 1;
|
|
125
|
+
files += result.files;
|
|
126
|
+
bytesFreed += result.bytesFreed;
|
|
127
|
+
}
|
|
128
|
+
return { projects, files, bytesFreed, busy, busyIds };
|
|
129
|
+
}
|
|
130
|
+
// Clean up: every project's old versions, and the working files of every finished one (Keep
|
|
131
|
+
// outputs only). What runs or waits to run is left as it is.
|
|
132
|
+
export function cleanUpAll(deps) {
|
|
133
|
+
const old = deleteAllOldVersions(deps);
|
|
134
|
+
let files = old.files;
|
|
135
|
+
let bytesFreed = old.bytesFreed;
|
|
136
|
+
let skipped = old.busy;
|
|
137
|
+
for (const row of deps.db.prepare(`SELECT id FROM projects WHERE ${liveProject()}`).all()) {
|
|
138
|
+
const id = String(row.id);
|
|
139
|
+
const result = keepOutputsOnly(deps, id);
|
|
140
|
+
if (result.ok) {
|
|
141
|
+
files += result.files;
|
|
142
|
+
bytesFreed += result.bytesFreed;
|
|
143
|
+
}
|
|
144
|
+
else if (result.reason === "not-finished" && !old.busyIds.includes(id))
|
|
145
|
+
skipped += 1;
|
|
146
|
+
}
|
|
147
|
+
return { files, bytesFreed, skipped };
|
|
148
|
+
}
|
|
149
|
+
// The folders under `root` left empty, deepest first, and `root` itself if it is empty then.
|
|
150
|
+
function removeEmptyUnder(root) {
|
|
151
|
+
if (!existsSync(root))
|
|
152
|
+
return;
|
|
153
|
+
const walk = (dir) => {
|
|
154
|
+
let empty = true;
|
|
155
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
156
|
+
if (entry.isDirectory() && walk(join(dir, entry.name))) {
|
|
157
|
+
rmdirSync(join(dir, entry.name));
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
empty = false;
|
|
161
|
+
}
|
|
162
|
+
return empty;
|
|
163
|
+
};
|
|
164
|
+
if (walk(root))
|
|
165
|
+
rmdirSync(root);
|
|
166
|
+
}
|
|
58
167
|
export function keepOutputsOnly(deps, projectId) {
|
|
59
168
|
if (!projectExists(deps.db, projectId))
|
|
60
169
|
return { ok: false, reason: "no-project" };
|
|
@@ -114,7 +223,11 @@ function outputPaths(db, projectId) {
|
|
|
114
223
|
// The outputs, and every file the user supplied: an asset any saved revision or the project's
|
|
115
224
|
// settings name, or a legacy output row that came from an upload.
|
|
116
225
|
function keptPaths(db, projectId) {
|
|
117
|
-
|
|
226
|
+
return new Set([...outputPaths(db, projectId), ...suppliedPaths(db, projectId)]);
|
|
227
|
+
}
|
|
228
|
+
// The files the user supplied: nothing could make them again, so nothing removes them.
|
|
229
|
+
function suppliedPaths(db, projectId) {
|
|
230
|
+
const kept = new Set();
|
|
118
231
|
for (const path of pathsOf(db
|
|
119
232
|
.prepare(`SELECT a.path FROM project_assets a WHERE a.project_id=? AND (
|
|
120
233
|
EXISTS(SELECT 1 FROM project_revisions r WHERE r.project_id=a.project_id
|
|
@@ -142,6 +142,16 @@ If you change that project later (edit an image, a caption style or the narratio
|
|
|
142
142
|
|
|
143
143
|
A finished project's own page offers the same in its right rail: **Free space** with **Free 1.2 GB: keep the outputs, drop the working files** (see [Project Page](Project-Page#free-space)).
|
|
144
144
|
|
|
145
|
+
### Delete old versions and Clean up everything
|
|
146
|
+
|
|
147
|
+
**Delete old versions** removes a project's `History/` folder: the files of earlier versions, such as a previous render or the narration before a voice change. The current version in `Upload/` and `Working/`, your uploads and anything you put in History yourself stay. Going back to one of those versions makes its files again, which takes time and provider credits.
|
|
148
|
+
|
|
149
|
+
- **One project:** the **Delete old versions** button on its row in **Disk space**, or under **Free space** on its project page. It says how much it frees.
|
|
150
|
+
- **Every project:** **Delete all old versions** above the **Disk space** list.
|
|
151
|
+
- **Clean up everything** does Delete old versions for every project and **Keep outputs only** for every finished one. Projects that are running or not finished keep everything.
|
|
152
|
+
|
|
153
|
+
Each asks first. Deleting the files in your file manager works the same way.
|
|
154
|
+
|
|
145
155
|
### Clear leftover files
|
|
146
156
|
|
|
147
157
|
**Clear leftover files** deletes files in the projects folder that no project records any more (never anything in a project's `Upload/`, `Working/` or `History/`, and never a folder Slopify did not make), and uploaded files that no draft, template or project uses. Your projects, outputs and library are never touched. Slopify also does this each time it starts; use it after a crash or to free space now.
|