@actual-app/sync-server 26.6.0-nightly.20260531 → 26.6.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/build/app.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as run } from "./chunks/migrations-BM3OCiKK.js";
|
|
2
2
|
//#region app.ts
|
|
3
3
|
run().then(() => {
|
|
4
|
-
import("./chunks/app-
|
|
4
|
+
import("./chunks/app-CLRswo4E.js").then((app) => app.run());
|
|
5
5
|
}).catch((err) => {
|
|
6
6
|
console.log("Error starting app:", err);
|
|
7
7
|
process.exit(1);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actual-server.js","names":[],"sources":["../../bin/actual-server.js"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { parseArgs } from 'node:util';\n\nconst args = process.argv;\n\nconst options = {\n help: {\n type: 'boolean',\n short: 'h',\n },\n version: {\n type: 'boolean',\n short: 'v',\n },\n 'reset-password': {\n type: 'boolean',\n },\n config: {\n type: 'string',\n },\n};\n\nconst { values } = parseArgs({\n args,\n options,\n allowPositionals: true,\n});\n\nif (values.help) {\n console.log(\n [\n 'usage: actual-server [options]',\n '',\n 'options:',\n ' --config Path to config file',\n '',\n ' -h --help Print this list and exit.',\n ' -v --version Print the version and exit.',\n '',\n 'Examples:',\n '',\n 'Runs actual-server with default configuration',\n ' actual-server',\n '',\n 'Runs actual-server with custom configuration',\n ' actual-server --config ./config.json',\n ].join('\\n'),\n );\n\n process.exit();\n}\n\nif (values.version) {\n console.log('v' + __APP_VERSION__);\n process.exit();\n}\n\nconst setupDataDir = (dataDir = undefined) => {\n if (process.env.ACTUAL_DATA_DIR) {\n return; // Env variables must not be overwritten\n }\n\n if (dataDir) {\n process.env.ACTUAL_DATA_DIR = dataDir; // Use the dir specified\n } else {\n // Setup defaults\n if (existsSync('./data')) {\n // The default data directory exists - use it\n console.info('Found existing data directory');\n process.env.ACTUAL_DATA_DIR = resolve('./data');\n } else {\n console.info(\n 'Using default data directory. You can specify a custom config with --config',\n );\n process.env.ACTUAL_DATA_DIR = resolve('./');\n }\n\n console.info(`Data directory: ${process.env.ACTUAL_DATA_DIR}`);\n }\n};\n\nif (values.config) {\n const configExists = existsSync(values.config);\n\n if (!configExists) {\n console.log(\n `Please specify a valid config path. The path ${String(values.config)} does not exist.`,\n );\n\n process.exit();\n } else {\n console.log(`Loading config from ${String(values.config)}`);\n const configJson = JSON.parse(readFileSync(values.config, 'utf-8'));\n process.env.ACTUAL_CONFIG_PATH = values.config;\n setupDataDir(configJson.dataDir);\n }\n} else {\n // If no config is specified, check for a default config in the current directory\n const defaultConfigJsonFile = './config.json';\n const configExists = existsSync(defaultConfigJsonFile);\n\n if (configExists) {\n console.info('Found config.json in the current directory');\n const configJson = JSON.parse(readFileSync(defaultConfigJsonFile, 'utf-8'));\n process.env.ACTUAL_CONFIG_PATH = defaultConfigJsonFile;\n setupDataDir(configJson.dataDir);\n } else {\n setupDataDir(); // No default config exists - setup data dir with defaults\n }\n}\n\nif (values['reset-password']) {\n console.info('Running reset password script...');\n await import('../src/scripts/reset-password.js');\n process.exit();\n}\n\n// start the sync server\nvoid import('../app.js');\n"],"mappings":";;;;;AAKA,IAAM,OAAO,QAAQ;AAmBrB,IAAM,EAAE,WAAW,UAAU;CAC3B;CACA,SAnBc;EACd,MAAM;GACJ,MAAM;GACN,OAAO;GACR;EACD,SAAS;GACP,MAAM;GACN,OAAO;GACR;EACD,kBAAkB,EAChB,MAAM,WACP;EACD,QAAQ,EACN,MAAM,UACP;EACF;CAKC,kBAAkB;CACnB,CAAC;AAEF,IAAI,OAAO,MAAM;AACf,SAAQ,IACN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK,CACb;AAED,SAAQ,MAAM;;AAGhB,IAAI,OAAO,SAAS;AAClB,SAAQ,IAAI,
|
|
1
|
+
{"version":3,"file":"actual-server.js","names":[],"sources":["../../bin/actual-server.js"],"sourcesContent":["#!/usr/bin/env node\nimport { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { parseArgs } from 'node:util';\n\nconst args = process.argv;\n\nconst options = {\n help: {\n type: 'boolean',\n short: 'h',\n },\n version: {\n type: 'boolean',\n short: 'v',\n },\n 'reset-password': {\n type: 'boolean',\n },\n config: {\n type: 'string',\n },\n};\n\nconst { values } = parseArgs({\n args,\n options,\n allowPositionals: true,\n});\n\nif (values.help) {\n console.log(\n [\n 'usage: actual-server [options]',\n '',\n 'options:',\n ' --config Path to config file',\n '',\n ' -h --help Print this list and exit.',\n ' -v --version Print the version and exit.',\n '',\n 'Examples:',\n '',\n 'Runs actual-server with default configuration',\n ' actual-server',\n '',\n 'Runs actual-server with custom configuration',\n ' actual-server --config ./config.json',\n ].join('\\n'),\n );\n\n process.exit();\n}\n\nif (values.version) {\n console.log('v' + __APP_VERSION__);\n process.exit();\n}\n\nconst setupDataDir = (dataDir = undefined) => {\n if (process.env.ACTUAL_DATA_DIR) {\n return; // Env variables must not be overwritten\n }\n\n if (dataDir) {\n process.env.ACTUAL_DATA_DIR = dataDir; // Use the dir specified\n } else {\n // Setup defaults\n if (existsSync('./data')) {\n // The default data directory exists - use it\n console.info('Found existing data directory');\n process.env.ACTUAL_DATA_DIR = resolve('./data');\n } else {\n console.info(\n 'Using default data directory. You can specify a custom config with --config',\n );\n process.env.ACTUAL_DATA_DIR = resolve('./');\n }\n\n console.info(`Data directory: ${process.env.ACTUAL_DATA_DIR}`);\n }\n};\n\nif (values.config) {\n const configExists = existsSync(values.config);\n\n if (!configExists) {\n console.log(\n `Please specify a valid config path. The path ${String(values.config)} does not exist.`,\n );\n\n process.exit();\n } else {\n console.log(`Loading config from ${String(values.config)}`);\n const configJson = JSON.parse(readFileSync(values.config, 'utf-8'));\n process.env.ACTUAL_CONFIG_PATH = values.config;\n setupDataDir(configJson.dataDir);\n }\n} else {\n // If no config is specified, check for a default config in the current directory\n const defaultConfigJsonFile = './config.json';\n const configExists = existsSync(defaultConfigJsonFile);\n\n if (configExists) {\n console.info('Found config.json in the current directory');\n const configJson = JSON.parse(readFileSync(defaultConfigJsonFile, 'utf-8'));\n process.env.ACTUAL_CONFIG_PATH = defaultConfigJsonFile;\n setupDataDir(configJson.dataDir);\n } else {\n setupDataDir(); // No default config exists - setup data dir with defaults\n }\n}\n\nif (values['reset-password']) {\n console.info('Running reset password script...');\n await import('../src/scripts/reset-password.js');\n process.exit();\n}\n\n// start the sync server\nvoid import('../app.js');\n"],"mappings":";;;;;AAKA,IAAM,OAAO,QAAQ;AAmBrB,IAAM,EAAE,WAAW,UAAU;CAC3B;CACA,SAnBc;EACd,MAAM;GACJ,MAAM;GACN,OAAO;GACR;EACD,SAAS;GACP,MAAM;GACN,OAAO;GACR;EACD,kBAAkB,EAChB,MAAM,WACP;EACD,QAAQ,EACN,MAAM,UACP;EACF;CAKC,kBAAkB;CACnB,CAAC;AAEF,IAAI,OAAO,MAAM;AACf,SAAQ,IACN;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,KAAK,KAAK,CACb;AAED,SAAQ,MAAM;;AAGhB,IAAI,OAAO,SAAS;AAClB,SAAQ,IAAI,UAAsB;AAClC,SAAQ,MAAM;;AAGhB,IAAM,gBAAgB,UAAU,KAAA,MAAc;AAC5C,KAAI,QAAQ,IAAI,gBACd;AAGF,KAAI,QACF,SAAQ,IAAI,kBAAkB;MACzB;AAEL,MAAI,WAAW,SAAS,EAAE;AAExB,WAAQ,KAAK,gCAAgC;AAC7C,WAAQ,IAAI,kBAAkB,QAAQ,SAAS;SAC1C;AACL,WAAQ,KACN,8EACD;AACD,WAAQ,IAAI,kBAAkB,QAAQ,KAAK;;AAG7C,UAAQ,KAAK,mBAAmB,QAAQ,IAAI,kBAAkB;;;AAIlE,IAAI,OAAO,OAGT,KAAI,CAFiB,WAAW,OAAO,OAAO,EAE3B;AACjB,SAAQ,IACN,gDAAgD,OAAO,OAAO,OAAO,CAAC,kBACvE;AAED,SAAQ,MAAM;OACT;AACL,SAAQ,IAAI,uBAAuB,OAAO,OAAO,OAAO,GAAG;CAC3D,MAAM,aAAa,KAAK,MAAM,aAAa,OAAO,QAAQ,QAAQ,CAAC;AACnE,SAAQ,IAAI,qBAAqB,OAAO;AACxC,cAAa,WAAW,QAAQ;;KAE7B;CAEL,MAAM,wBAAwB;AAG9B,KAFqB,WAAW,sBAAsB,EAEpC;AAChB,UAAQ,KAAK,6CAA6C;EAC1D,MAAM,aAAa,KAAK,MAAM,aAAa,uBAAuB,QAAQ,CAAC;AAC3E,UAAQ,IAAI,qBAAqB;AACjC,eAAa,WAAW,QAAQ;OAEhC,eAAc;;AAIlB,IAAI,OAAO,mBAAmB;AAC5B,SAAQ,KAAK,mCAAmC;AAChD,OAAM,OAAO;AACb,SAAQ,MAAM;;AAIX,OAAO"}
|
|
@@ -4542,14 +4542,10 @@ var verifyFileExists = (fileId, filesService, res, errorObject) => {
|
|
|
4542
4542
|
throw e;
|
|
4543
4543
|
}
|
|
4544
4544
|
};
|
|
4545
|
-
function
|
|
4545
|
+
function requireFileAccess(file, userId) {
|
|
4546
4546
|
const isOwner = file.owner === userId;
|
|
4547
4547
|
const isServerAdmin = isAdmin(userId);
|
|
4548
4548
|
if (isOwner || isServerAdmin) return null;
|
|
4549
|
-
return "file-access-not-allowed";
|
|
4550
|
-
}
|
|
4551
|
-
function requireFileAccess(file, userId) {
|
|
4552
|
-
if (requireFileOwner(file, userId) === null) return null;
|
|
4553
4549
|
if (countUserAccess(file.id, userId) > 0) return null;
|
|
4554
4550
|
return "file-access-not-allowed";
|
|
4555
4551
|
}
|
|
@@ -4627,7 +4623,7 @@ app$1.post("/user-create-key", (req, res) => {
|
|
|
4627
4623
|
const filesService = new FilesService(getAccountDb());
|
|
4628
4624
|
const file = verifyFileExists(fileId, filesService, res, "file-not-found");
|
|
4629
4625
|
if (!file) return;
|
|
4630
|
-
const fileAccessError =
|
|
4626
|
+
const fileAccessError = requireFileAccess(file, res.locals.user_id);
|
|
4631
4627
|
if (fileAccessError) {
|
|
4632
4628
|
res.status(403);
|
|
4633
4629
|
res.send(fileAccessError);
|
|
@@ -4645,7 +4641,7 @@ app$1.post("/reset-user-file", async (req, res) => {
|
|
|
4645
4641
|
const filesService = new FilesService(getAccountDb());
|
|
4646
4642
|
const file = verifyFileExists(fileId, filesService, res, "User or file not found");
|
|
4647
4643
|
if (!file) return;
|
|
4648
|
-
const fileAccessError =
|
|
4644
|
+
const fileAccessError = requireFileAccess(file, res.locals.user_id);
|
|
4649
4645
|
if (fileAccessError) {
|
|
4650
4646
|
res.status(403);
|
|
4651
4647
|
res.send(fileAccessError);
|
|
@@ -4846,7 +4842,7 @@ app$1.post("/delete-user-file", (req, res) => {
|
|
|
4846
4842
|
const filesService = new FilesService(getAccountDb());
|
|
4847
4843
|
const file = verifyFileExists(fileId, filesService, res, "file-not-found");
|
|
4848
4844
|
if (!file) return;
|
|
4849
|
-
const fileAccessError =
|
|
4845
|
+
const fileAccessError = requireFileAccess(file, res.locals.user_id);
|
|
4850
4846
|
if (fileAccessError) {
|
|
4851
4847
|
res.status(403);
|
|
4852
4848
|
res.send(fileAccessError);
|
|
@@ -4998,4 +4994,4 @@ async function run() {
|
|
|
4998
4994
|
//#endregion
|
|
4999
4995
|
export { run };
|
|
5000
4996
|
|
|
5001
|
-
//# sourceMappingURL=app-
|
|
4997
|
+
//# sourceMappingURL=app-CLRswo4E.js.map
|