@actual-app/sync-server 26.6.0 → 26.7.0-nightly.20260602

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-CLRswo4E.js").then((app) => app.run());
4
+ import("./chunks/app-DSbHHHGd.js").then((app) => app.run());
5
5
  }).catch((err) => {
6
6
  console.log("Error starting app:", err);
7
7
  process.exit(1);
@@ -41,7 +41,7 @@ if (values.help) {
41
41
  process.exit();
42
42
  }
43
43
  if (values.version) {
44
- console.log("v26.6.0");
44
+ console.log("v26.7.0-nightly.20260602");
45
45
  process.exit();
46
46
  }
47
47
  var setupDataDir = (dataDir = void 0) => {
@@ -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;EAC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\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,2BAAsB;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,10 +4542,14 @@ var verifyFileExists = (fileId, filesService, res, errorObject) => {
4542
4542
  throw e;
4543
4543
  }
4544
4544
  };
4545
- function requireFileAccess(file, userId) {
4545
+ function requireFileOwner(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;
4549
4553
  if (countUserAccess(file.id, userId) > 0) return null;
4550
4554
  return "file-access-not-allowed";
4551
4555
  }
@@ -4623,7 +4627,7 @@ app$1.post("/user-create-key", (req, res) => {
4623
4627
  const filesService = new FilesService(getAccountDb());
4624
4628
  const file = verifyFileExists(fileId, filesService, res, "file-not-found");
4625
4629
  if (!file) return;
4626
- const fileAccessError = requireFileAccess(file, res.locals.user_id);
4630
+ const fileAccessError = requireFileOwner(file, res.locals.user_id);
4627
4631
  if (fileAccessError) {
4628
4632
  res.status(403);
4629
4633
  res.send(fileAccessError);
@@ -4641,7 +4645,7 @@ app$1.post("/reset-user-file", async (req, res) => {
4641
4645
  const filesService = new FilesService(getAccountDb());
4642
4646
  const file = verifyFileExists(fileId, filesService, res, "User or file not found");
4643
4647
  if (!file) return;
4644
- const fileAccessError = requireFileAccess(file, res.locals.user_id);
4648
+ const fileAccessError = requireFileOwner(file, res.locals.user_id);
4645
4649
  if (fileAccessError) {
4646
4650
  res.status(403);
4647
4651
  res.send(fileAccessError);
@@ -4842,7 +4846,7 @@ app$1.post("/delete-user-file", (req, res) => {
4842
4846
  const filesService = new FilesService(getAccountDb());
4843
4847
  const file = verifyFileExists(fileId, filesService, res, "file-not-found");
4844
4848
  if (!file) return;
4845
- const fileAccessError = requireFileAccess(file, res.locals.user_id);
4849
+ const fileAccessError = requireFileOwner(file, res.locals.user_id);
4846
4850
  if (fileAccessError) {
4847
4851
  res.status(403);
4848
4852
  res.send(fileAccessError);
@@ -4994,4 +4998,4 @@ async function run() {
4994
4998
  //#endregion
4995
4999
  export { run };
4996
5000
 
4997
- //# sourceMappingURL=app-CLRswo4E.js.map
5001
+ //# sourceMappingURL=app-DSbHHHGd.js.map