hfs 0.45.0-alpha6 → 0.45.0-beta10

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.
@@ -1,4 +1,4 @@
1
- import{c as SF}from"./index-81e42239.js";function OF(iF,hF){for(var eF=0;eF<hF.length;eF++){const tF=hF[eF];if(typeof tF!="string"&&!Array.isArray(tF)){for(const w in tF)if(w!=="default"&&!(w in iF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(iF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(iF,Symbol.toStringTag,{value:"Module"}))}var EF={},UF={get exports(){return EF},set exports(iF){EF=iF}};/*
1
+ import{c as SF}from"./index-103f8869.js";function OF(iF,hF){for(var eF=0;eF<hF.length;eF++){const tF=hF[eF];if(typeof tF!="string"&&!Array.isArray(tF)){for(const w in tF)if(w!=="default"&&!(w in iF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(iF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(iF,Symbol.toStringTag,{value:"Module"}))}var EF={},UF={get exports(){return EF},set exports(iF){EF=iF}};/*
2
2
  * [js-sha512]{@link https://github.com/emn178/js-sha512}
3
3
  *
4
4
  * @version 0.8.0
@@ -6,7 +6,7 @@
6
6
  <link href="/fontello.css" rel="stylesheet" />
7
7
 
8
8
  <script>HFS={}</script>
9
- <script type="module" crossorigin src="/assets/index-81e42239.js"></script>
9
+ <script type="module" crossorigin src="/assets/index-103f8869.js"></script>
10
10
  <link rel="stylesheet" href="/assets/index-fe0f3d77.css">
11
11
  </head>
12
12
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfs",
3
- "version": "0.45.0-alpha6",
3
+ "version": "0.45.0-beta10",
4
4
  "description": "HTTP File Server",
5
5
  "keywords": [
6
6
  "file server",
@@ -24,11 +24,11 @@
24
24
  "test": "mocha -r ts-node/register 'tests/**/*.ts'",
25
25
  "pub": "cd dist && npm publish",
26
26
  "dist": "npm run build-all && npm run dist-bin",
27
- "dist-bin": "npm run dist-modules && cd dist && pkg . -C gzip && mv -f hfs-win-x64.exe hfs.exe && zip hfs-windows.zip hfs.exe -r plugins && cp -f hfs-linux-x64 hfs && zip hfs-linux.zip hfs -r plugins && cp -f hfs-macos-x64 hfs && zip hfs-mac.zip hfs -r plugins && cp -f hfs-macos-arm64 hfs && zip hfs-mac-arm.zip hfs -r plugins && rm hfs",
27
+ "dist-bin": "npm run dist-modules && cd dist && pkg . --public -C gzip && mv -f hfs-win-x64.exe hfs.exe && zip hfs-windows.zip hfs.exe -r plugins && cp -f hfs-linux-x64 hfs && zip hfs-linux.zip hfs -r plugins && cp -f hfs-macos-x64 hfs && zip hfs-mac.zip hfs -r plugins && cp -f hfs-macos-arm64 hfs && zip hfs-mac-arm.zip hfs -r plugins && rm hfs",
28
28
  "dist-modules": "cp package*.json dist && cd dist && npm ci --omit=dev && npm run dist-crclib && rm package-lock.json && cd .. && node prune_modules",
29
29
  "dist-crclib": "npm i -f --no-save --omit=dev @node-rs/crc32-win32-x64-msvc @node-rs/crc32-darwin-arm64 @node-rs/crc32-darwin-x64 ",
30
- "dist-win": "cp package*.json dist && cd dist && npm ci --omit=dev && npm i -f --no-save --omit=dev @node-rs/crc32-win32 && pkg . -C gzip -t node16-win-x64",
31
- "dist-mac": "cp package*.json dist && cd dist && npm ci --omit=dev && pkg . -C gzip -t node16-macos-arm64",
30
+ "dist-win": "cp package*.json dist && cd dist && npm ci --omit=dev && npm i -f --no-save --omit=dev @node-rs/crc32-win32 && pkg . --public -C gzip -t node16-win-x64",
31
+ "dist-mac": "cp package*.json dist && cd dist && npm ci --omit=dev && pkg . --public -C gzip -t node16-macos-arm64",
32
32
  "dist-node": "npm run dist-modules && cd dist && zip hfs-node.zip -r * -x *.zip *.exe hfs-* *.log logs"
33
33
  },
34
34
  "engines": {
@@ -49,6 +49,7 @@ class QuickZipStream extends stream_1.Readable {
49
49
  this.dataWritten = 0;
50
50
  this.consumedCalculating = [];
51
51
  this.skip = 0;
52
+ this.now = new Date();
52
53
  }
53
54
  earlyClose() {
54
55
  this.finished = true;
@@ -95,9 +96,10 @@ class QuickZipStream extends stream_1.Readable {
95
96
  let centralDirSize = 0;
96
97
  for (const file of this.consumedCalculating) {
97
98
  const pathSize = Buffer.from(file.path, 'utf8').length;
98
- const extraLength = (file.size > ZIP64_SIZE_LIMIT ? 2 : 0) + (offset > ZIP64_SIZE_LIMIT ? 1 : 0);
99
+ const { size = 0 } = file;
100
+ const extraLength = (size > ZIP64_SIZE_LIMIT ? 2 : 0) + (offset > ZIP64_SIZE_LIMIT ? 1 : 0);
99
101
  const extraDataSize = extraLength && (2 + 2 + extraLength * 8);
100
- offset += 4 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 2 + 2 + pathSize + file.size;
102
+ offset += 4 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 2 + 2 + pathSize + size;
101
103
  centralDirSize += 4 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2 + 2 + 4 + 4 + pathSize + extraDataSize;
102
104
  }
103
105
  const n = this.consumedCalculating.length;
@@ -117,7 +119,7 @@ class QuickZipStream extends stream_1.Readable {
117
119
  const file = this.consumedCalculating.shift() || (await this.walker.next()).value;
118
120
  if (!file)
119
121
  return this.closeArchive();
120
- let { path, sourcePath, getData, size, ts, mode } = file;
122
+ let { path, sourcePath, getData, size = 0, ts = this.now, mode = 0o40775 } = file;
121
123
  const pathAsBuffer = Buffer.from(path, 'utf8');
122
124
  const offset = this.dataWritten;
123
125
  const version = 20;
@@ -126,7 +128,7 @@ class QuickZipStream extends stream_1.Readable {
126
128
  2, version,
127
129
  2, FLAGS,
128
130
  2, 0,
129
- ...ts2buf(ts),
131
+ ...ts2buf(ts || this.now),
130
132
  4, 0,
131
133
  4, 0,
132
134
  4, 0,
@@ -138,7 +140,7 @@ class QuickZipStream extends stream_1.Readable {
138
140
  return;
139
141
  const cache = sourcePath ? crcCache[sourcePath] : undefined;
140
142
  const cacheHit = Number(cache === null || cache === void 0 ? void 0 : cache.ts) === Number(ts);
141
- let crc = cacheHit ? cache.crc : crc32function('');
143
+ let crc = cacheHit ? cache.crc : getData ? crc32function('') : 0;
142
144
  const extAttr = !mode ? 0 : (mode | 0x8000) * 0x10000; // it's like <<16 but doesn't overflow so easily
143
145
  const entry = { size, crc, pathAsBuffer, ts, offset, version, extAttr };
144
146
  if (this.skip >= size && cacheHit) {
@@ -148,11 +150,14 @@ class QuickZipStream extends stream_1.Readable {
148
150
  setTimeout(() => this.push('')); // this "signal" works only after _read() is done
149
151
  return;
150
152
  }
153
+ if (!getData) {
154
+ this.entries.push(entry);
155
+ return;
156
+ }
151
157
  const data = getData();
152
158
  data.on('error', (err) => console.error(err));
153
159
  data.on('end', () => {
154
160
  this.workingFile = undefined;
155
- entry.crc = crc;
156
161
  if (sourcePath)
157
162
  crcCache[sourcePath] = { ts, crc };
158
163
  this.entries.push(entry);
package/src/api.auth.js CHANGED
@@ -32,7 +32,7 @@ async function loggedIn(ctx, username) {
32
32
  }
33
33
  function makeExp() {
34
34
  return !keepSessionAlive.get() ? undefined
35
- : { exp: new Date(Date.now() + const_1.SESSION_DURATION) };
35
+ : { exp: new Date(Date.now() + middlewares_1.sessionDuration.compiled()) };
36
36
  }
37
37
  const login = async ({ username, password }, ctx) => {
38
38
  if (!username || !password) // some validation
package/src/commands.js CHANGED
@@ -79,8 +79,7 @@ const commands = {
79
79
  config: {
80
80
  params: '<key> <value>',
81
81
  cb(key, value) {
82
- const conf = (0, config_1.getConfigDefinition)(key);
83
- if (!conf)
82
+ if (!(0, config_1.configKeyExists)(key))
84
83
  throw "specified key doesn't exist";
85
84
  let v = value;
86
85
  try {
@@ -93,8 +92,7 @@ const commands = {
93
92
  'get-config': {
94
93
  params: '<key>',
95
94
  cb(key) {
96
- const conf = (0, config_1.getConfigDefinition)(key);
97
- if (!conf)
95
+ if (!(0, config_1.configKeyExists)(key))
98
96
  throw "specified key doesn't exist";
99
97
  console.log(yaml_1.default.stringify((0, config_1.getConfig)(key), { lineWidth: 1000 }).trim());
100
98
  }
package/src/config.js CHANGED
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  return (mod && mod.__esModule) ? mod : { "default": mod };
5
5
  };
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.saveConfigAsap = exports.setConfig = exports.getWholeConfig = exports.getConfig = exports.getConfigDefinition = exports.defineConfig = void 0;
7
+ exports.saveConfigAsap = exports.setConfig = exports.getWholeConfig = exports.getConfig = exports.configKeyExists = exports.defineConfig = void 0;
8
8
  const events_1 = __importDefault(require("events"));
9
9
  const const_1 = require("./const");
10
10
  const watchLoad_1 = require("./watchLoad");
@@ -15,12 +15,13 @@ const fs_1 = require("fs");
15
15
  const path_1 = require("path");
16
16
  const events_2 = __importDefault(require("./events"));
17
17
  const FILE = 'config.yaml';
18
+ // keep definition of config properties
18
19
  const configProps = {};
19
20
  let started = false; // this will tell the difference for subscribeConfig()s that are called before or after config is loaded
20
- let state = {};
21
+ let state = {}; // current state of config properties
21
22
  const cfgEvents = new events_1.default();
22
23
  cfgEvents.setMaxListeners(10000);
23
- const path = (0, misc_1.with_)(const_1.argv.config || process.env.HFS_CONFIG, p => {
24
+ const filePath = (0, misc_1.with_)(const_1.argv.config || process.env.HFS_CONFIG, p => {
24
25
  if (!p)
25
26
  return FILE;
26
27
  p = (0, path_1.resolve)(const_1.ORIGINAL_CWD, p);
@@ -31,32 +32,49 @@ const path = (0, misc_1.with_)(const_1.argv.config || process.env.HFS_CONFIG, p
31
32
  catch (_a) { }
32
33
  return p;
33
34
  });
34
- console.log("config", path);
35
+ console.log("config", filePath);
35
36
  const legacyPosition = (0, path_1.join)(const_1.APP_PATH, FILE);
36
- if (!(0, fs_1.existsSync)(path) && (0, fs_1.existsSync)(legacyPosition))
37
+ if (!(0, fs_1.existsSync)(filePath) && (0, fs_1.existsSync)(legacyPosition))
37
38
  try {
38
- (0, fs_1.renameSync)(legacyPosition, path);
39
+ (0, fs_1.renameSync)(legacyPosition, filePath);
39
40
  console.log("moved from legacy position", legacyPosition);
40
41
  }
41
42
  catch (_a) {
42
43
  try { // attempt copying, in case moving the source file proves to be impractical
43
- (0, fs_1.copyFileSync)(legacyPosition, path);
44
+ (0, fs_1.copyFileSync)(legacyPosition, filePath);
44
45
  console.log("copied from legacy position", legacyPosition);
45
46
  }
46
47
  catch (_b) { }
47
48
  }
48
- const { save } = (0, watchLoad_1.watchLoad)(path, text => setConfig(yaml_1.default.parse(text) || {}, false), {
49
+ const { save } = (0, watchLoad_1.watchLoad)(filePath, text => setConfig(yaml_1.default.parse(text) || {}, false), {
49
50
  failedOnFirstAttempt() {
50
51
  console.log("No config file, using defaults");
51
52
  setConfig({}, false);
52
53
  }
53
54
  });
54
- function defineConfig(k, defaultValue, compiler = lodash_1.default.identity) {
55
+ // takes a semver like 1.2.3-alpha1, but alpha and beta numbers must share the number progression
56
+ const versionToScalar = lodash_1.default.memoize((ver) => {
57
+ var _a;
58
+ const [official, beta] = ver.split('-');
59
+ const numbers = official.split('.').map(Number);
60
+ if (numbers.length !== 3)
61
+ return NaN;
62
+ const officialScalar = numbers.reduce((acc, x, i) => acc + x * 1000 ** (2 - i), 0); // 1000 gives 3 digits for each number
63
+ const betaScalar = 1 / (beta && Number((_a = /\d+/.exec(beta)) === null || _a === void 0 ? void 0 : _a[0]) || Infinity); // beta tends to 0, while non-beta is 0
64
+ return officialScalar - betaScalar;
65
+ });
66
+ class Version extends String {
67
+ olderThan(otherVersion) {
68
+ return versionToScalar(this.valueOf()) < versionToScalar(otherVersion);
69
+ }
70
+ }
71
+ const CONFIG_CHANGE_EVENT_PREFIX = 'new.';
72
+ const currentVersion = new Version(const_1.VERSION);
73
+ const configVersion = defineConfig('version', const_1.VERSION, v => new Version(v));
74
+ function defineConfig(k, defaultValue, compiler) {
55
75
  configProps[k] = { defaultValue };
56
- let compiled = compiler(defaultValue);
57
- if (compiler)
58
- subscribeConfig(k, (v) => compiled = compiler(v));
59
- return {
76
+ let compiled = compiler === null || compiler === void 0 ? void 0 : compiler(defaultValue, undefined, currentVersion);
77
+ const ret = {
60
78
  key() {
61
79
  return k;
62
80
  },
@@ -64,7 +82,22 @@ function defineConfig(k, defaultValue, compiler = lodash_1.default.identity) {
64
82
  return getConfig(k);
65
83
  },
66
84
  sub(cb) {
67
- return subscribeConfig(k, cb);
85
+ if (started) // initial event already passed, we'll make the first call
86
+ cb(getConfig(k), defaultValue, configVersion.compiled());
87
+ const eventName = CONFIG_CHANGE_EVENT_PREFIX + k;
88
+ return (0, misc_1.onOff)(cfgEvents, {
89
+ [eventName]() {
90
+ if (stack.includes(cb))
91
+ return; // avoid infinite loop in case a subscriber changes the value
92
+ stack.push(cb); // @ts-ignore arguments
93
+ try {
94
+ return cb.apply(this, arguments);
95
+ }
96
+ finally {
97
+ stack.pop();
98
+ }
99
+ }
100
+ });
68
101
  },
69
102
  set(v) {
70
103
  if (typeof v === 'function')
@@ -72,33 +105,22 @@ function defineConfig(k, defaultValue, compiler = lodash_1.default.identity) {
72
105
  else
73
106
  setConfig1(k, v);
74
107
  },
75
- compiled: () => compiled
108
+ compiled: () => {
109
+ if (!compiler)
110
+ throw "missing compiler";
111
+ return compiled;
112
+ }
76
113
  };
114
+ if (compiler)
115
+ ret.sub((...args) => compiled = compiler(...args));
116
+ return ret;
77
117
  }
78
118
  exports.defineConfig = defineConfig;
79
- function getConfigDefinition(k) {
80
- return configProps[k];
119
+ function configKeyExists(k) {
120
+ return k in configProps;
81
121
  }
82
- exports.getConfigDefinition = getConfigDefinition;
122
+ exports.configKeyExists = configKeyExists;
83
123
  const stack = [];
84
- function subscribeConfig(k, cb) {
85
- if (started) // initial event already passed, we'll make the first call
86
- cb(getConfig(k));
87
- const eventName = 'new.' + k;
88
- return (0, misc_1.onOff)(cfgEvents, {
89
- [eventName]() {
90
- if (stack.includes(cb))
91
- return; // avoid infinite loop in case a subscriber changes the value
92
- stack.push(cb); // @ts-ignore arguments
93
- try {
94
- return cb.apply(this, arguments);
95
- }
96
- finally {
97
- stack.pop();
98
- }
99
- }
100
- });
101
- }
102
124
  function getConfig(k) {
103
125
  var _a, _b;
104
126
  return (_a = state[k]) !== null && _a !== void 0 ? _a : lodash_1.default.cloneDeep((_b = configProps[k]) === null || _b === void 0 ? void 0 : _b.defaultValue); // clone to avoid changing
@@ -116,17 +138,17 @@ function getWholeConfig({ omit, only }) {
116
138
  exports.getWholeConfig = getWholeConfig;
117
139
  // pass a value to `save` to force saving decision, or leave undefined for auto. Passing false will also reset previously loaded configs.
118
140
  function setConfig(newCfg, save) {
119
- if (!started) { // first time we consider also CLI args
120
- const argCfg = lodash_1.default.pickBy((0, misc_1.newObj)(configProps, (x, k) => const_1.argv[k]), x => x !== undefined);
121
- if (!lodash_1.default.isEmpty(argCfg)) {
122
- (0, exports.saveConfigAsap)().then(); // don't set `save` argument, as it would interfere below at check `save===false`
123
- Object.assign(newCfg, argCfg);
124
- }
141
+ const version = lodash_1.default.isString(newCfg.version) ? new Version(newCfg.version) : undefined;
142
+ // first time we consider also CLI args
143
+ const argCfg = !started && lodash_1.default.pickBy((0, misc_1.newObj)(configProps, (x, k) => const_1.argv[k]), x => x !== undefined);
144
+ if (!lodash_1.default.isEmpty(argCfg)) {
145
+ (0, exports.saveConfigAsap)(); // don't set `save` argument, as it would interfere below at check `save===false`
146
+ Object.assign(newCfg, argCfg);
125
147
  }
126
148
  for (const k in newCfg)
127
149
  apply(k, newCfg[k]);
128
150
  if (save) {
129
- (0, exports.saveConfigAsap)().then();
151
+ (0, exports.saveConfigAsap)();
130
152
  return;
131
153
  }
132
154
  if (started) {
@@ -139,15 +161,17 @@ function setConfig(newCfg, save) {
139
161
  // first time we emit also for the default values
140
162
  for (const k of Object.keys(configProps))
141
163
  if (!newCfg.hasOwnProperty(k))
142
- apply(k, newCfg[k]);
164
+ apply(k, newCfg[k], true);
143
165
  started = true;
144
166
  events_2.default.emit('config ready');
145
- function apply(k, newV) {
146
- return setConfig1(k, newV, save === undefined);
167
+ if (version !== const_1.VERSION) // be sure to save version
168
+ (0, exports.saveConfigAsap)();
169
+ function apply(k, newV, isDefault = false) {
170
+ return setConfig1(k, newV, save === undefined, argCfg && k in argCfg || isDefault ? currentVersion : version);
147
171
  }
148
172
  }
149
173
  exports.setConfig = setConfig;
150
- function setConfig1(k, newV, saveChanges = true) {
174
+ function setConfig1(k, newV, saveChanges = true, valueVersion) {
151
175
  var _a;
152
176
  if (lodash_1.default.isPlainObject(newV))
153
177
  newV = lodash_1.default.pickBy(newV, x => x !== undefined);
@@ -158,16 +182,18 @@ function setConfig1(k, newV, saveChanges = true) {
158
182
  return; // no change
159
183
  const was = getConfig(k); // include cloned default, if necessary
160
184
  state[k] = newV;
161
- cfgEvents.emit('new.' + k, getConfig(k), was);
185
+ cfgEvents.emit(CONFIG_CHANGE_EVENT_PREFIX + k, getConfig(k), was, valueVersion);
162
186
  if (saveChanges)
163
- (0, exports.saveConfigAsap)().then();
187
+ (0, exports.saveConfigAsap)();
164
188
  }
165
- exports.saveConfigAsap = (0, misc_1.debounceAsync)(async () => {
189
+ const saveDebounced = (0, misc_1.debounceAsync)(async () => {
166
190
  while (!started)
167
191
  await (0, misc_1.wait)(100);
168
- let txt = yaml_1.default.stringify(state, { lineWidth: 1000 });
192
+ let txt = yaml_1.default.stringify({ version: const_1.VERSION, ...state }, { lineWidth: 1000 });
169
193
  if (txt.trim() === '{}') // most users wouldn't understand
170
194
  txt = '';
171
- save(path, txt)
195
+ save(filePath, txt)
172
196
  .catch(err => console.error('Failed at saving config file, please ensure it is writable.', String(err)));
173
197
  });
198
+ const saveConfigAsap = () => void (saveDebounced());
199
+ exports.saveConfigAsap = saveConfigAsap;
package/src/const.js CHANGED
@@ -27,7 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  return (mod && mod.__esModule) ? mod : { "default": mod };
28
28
  };
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.APP_PATH = exports.IS_BINARY = exports.IS_WINDOWS = exports.HTTP_SERVER_ERROR = exports.HTTP_FOOL = exports.HTTP_RANGE_NOT_SATISFIABLE = exports.HTTP_PAYLOAD_TOO_LARGE = exports.HTTP_CONFLICT = exports.HTTP_NOT_ACCEPTABLE = exports.HTTP_METHOD_NOT_ALLOWED = exports.HTTP_NOT_FOUND = exports.HTTP_FORBIDDEN = exports.HTTP_UNAUTHORIZED = exports.HTTP_BAD_REQUEST = exports.HTTP_NOT_MODIFIED = exports.HTTP_TEMPORARY_REDIRECT = exports.HTTP_PARTIAL_CONTENT = exports.HTTP_NO_CONTENT = exports.HTTP_OK = exports.PLUGINS_PUB_URI = exports.API_URI = exports.ADMIN_URI = exports.FRONTEND_URI = exports.SPECIAL_URI = exports.HFS_REPO = exports.COMPATIBLE_API_VERSION = exports.API_VERSION = exports.SESSION_DURATION = exports.DAY = exports.VERSION = exports.BUILD_TIMESTAMP = exports.HFS_STARTED = exports.ORIGINAL_CWD = exports.DEV = exports.argv = void 0;
30
+ exports.APP_PATH = exports.IS_BINARY = exports.IS_WINDOWS = exports.HTTP_SERVER_ERROR = exports.HTTP_FOOL = exports.HTTP_RANGE_NOT_SATISFIABLE = exports.HTTP_PAYLOAD_TOO_LARGE = exports.HTTP_CONFLICT = exports.HTTP_NOT_ACCEPTABLE = exports.HTTP_METHOD_NOT_ALLOWED = exports.HTTP_NOT_FOUND = exports.HTTP_FORBIDDEN = exports.HTTP_UNAUTHORIZED = exports.HTTP_BAD_REQUEST = exports.HTTP_NOT_MODIFIED = exports.HTTP_TEMPORARY_REDIRECT = exports.HTTP_PARTIAL_CONTENT = exports.HTTP_NO_CONTENT = exports.HTTP_OK = exports.PLUGINS_PUB_URI = exports.API_URI = exports.ADMIN_URI = exports.FRONTEND_URI = exports.SPECIAL_URI = exports.HFS_REPO = exports.COMPATIBLE_API_VERSION = exports.API_VERSION = exports.DAY = exports.VERSION = exports.BUILD_TIMESTAMP = exports.HFS_STARTED = exports.ORIGINAL_CWD = exports.DEV = exports.argv = void 0;
31
31
  const minimist_1 = __importDefault(require("minimist"));
32
32
  const fs = __importStar(require("fs"));
33
33
  const os_1 = require("os");
@@ -38,11 +38,10 @@ exports.DEV = process.env.DEV || exports.argv.dev ? 'DEV' : '';
38
38
  exports.ORIGINAL_CWD = process.cwd();
39
39
  exports.HFS_STARTED = new Date();
40
40
  const PKG_PATH = (0, path_1.join)(__dirname, '..', 'package.json');
41
- exports.BUILD_TIMESTAMP = "2023-05-08T23:29:34.241Z";
41
+ exports.BUILD_TIMESTAMP = "2023-05-16T09:05:52.263Z";
42
42
  const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
43
43
  exports.VERSION = pkg.version;
44
44
  exports.DAY = 86400000;
45
- exports.SESSION_DURATION = Number(process.env.SESSION_DURATION) * 1000 || exports.DAY;
46
45
  exports.API_VERSION = 8.1; // entry.uri + script.plugin + absolute frontend_*
47
46
  exports.COMPATIBLE_API_VERSION = 1; // while changes in the api are not breaking, this number stays the same, otherwise it is made equal to API_VERSION
48
47
  exports.HFS_REPO = 'rejetto/hfs';
package/src/index.js CHANGED
@@ -28,7 +28,7 @@ const koa_session_1 = __importDefault(require("koa-session"));
28
28
  const keys = ((_a = process.env.COOKIE_SIGN_KEYS) === null || _a === void 0 ? void 0 : _a.split(',')) || [(0, misc_1.randomId)(30)];
29
29
  exports.app = new koa_1.default({ keys });
30
30
  exports.app.use(middlewares_1.someSecurity)
31
- .use((0, koa_session_1.default)({ key: 'hfs_$id', signed: true, rolling: true, maxAge: const_1.SESSION_DURATION }, exports.app))
31
+ .use((0, koa_session_1.default)({ key: 'hfs_$id', signed: true, rolling: true }, exports.app))
32
32
  .use(middlewares_1.prepareState)
33
33
  .use(middlewares_1.headRequests)
34
34
  .use((0, log_1.log)())
@@ -11,4 +11,5 @@ const hfs_lang_ko_json_1 = __importDefault(require("./hfs-lang-ko.json"));
11
11
  const hfs_lang_ms_json_1 = __importDefault(require("./hfs-lang-ms.json"));
12
12
  const hfs_lang_zh_tw_json_1 = __importDefault(require("./hfs-lang-zh-tw.json"));
13
13
  const hfs_lang_fr_json_1 = __importDefault(require("./hfs-lang-fr.json"));
14
- exports.default = { it: hfs_lang_it_json_1.default, zh: hfs_lang_zh_json_1.default, ru: hfs_lang_ru_json_1.default, sr: hfs_lang_sr_json_1.default, ko: hfs_lang_ko_json_1.default, ms: hfs_lang_ms_json_1.default, 'zh-tw': hfs_lang_zh_tw_json_1.default, fr: hfs_lang_fr_json_1.default };
14
+ const hfs_lang_pt_json_1 = __importDefault(require("./hfs-lang-pt.json"));
15
+ exports.default = { it: hfs_lang_it_json_1.default, zh: hfs_lang_zh_json_1.default, ru: hfs_lang_ru_json_1.default, sr: hfs_lang_sr_json_1.default, ko: hfs_lang_ko_json_1.default, ms: hfs_lang_ms_json_1.default, 'zh-tw': hfs_lang_zh_tw_json_1.default, fr: hfs_lang_fr_json_1.default, pt: hfs_lang_pt_json_1.default };
@@ -1,71 +1,71 @@
1
1
  {
2
2
  "author": "Club Microtel Vernon",
3
- "version": 1.0,
3
+ "version": 1.1,
4
4
  "hfs_version": "0.43.0",
5
5
  "translate": {
6
6
  "Select": "Selectionner",
7
7
  "n_files": "{n,plural, one{# fichier} other{# fichiers}}",
8
8
  "n_folders": "{n,plural, one{# dossier} other{# dossiers}}",
9
- "filter_count": "{n,plural, one{# filtr\u00e9 ;} other{# filtr\u00e9s}}",
10
- "select_count": "{n,plural, one{# selectionn\u00e9} other{# selectionn\u00e9s}}",
9
+ "filter_count": "{n,plural, one{# filtré ;} other{# filtrés}}",
10
+ "select_count": "{n,plural, one{# selectionné} other{# selectionnés}}",
11
11
  "filter_placeholder": "Saisissez ici pour filtrer la liste ci-dessous",
12
- "Select some files": "S\u00e9lectionnez des fichiers",
13
- "zip_checkboxes": "Utilisez les cases \u00e0 cocher pour s\u00e9lectionner les fichiers, vous pourrez alors utiliser ZIP \u00e0 nouveau",
14
- "zip_tooltip_selected": "T\u00e9l\u00e9charger les \u00e9l\u00e9ments s\u00e9lectionn\u00e9s dans un seul fichier compress\u00e9 (.zip)",
15
- "zip_tooltip_whole": "T\u00e9l\u00e9chargez la liste compl\u00e8te (non filtr\u00e9e) sous la forme d\u0027un seul fichier compress\u00e9 (.zip). Si vous s\u00e9lectionnez certains \u00e9l\u00e9ments, seuls ceux-ci seront t\u00e9l\u00e9charg\u00e9s",
16
- "zip_confirm_search": "T\u00e9l\u00e9charger le r\u00e9sultat de la recherche dans un fichier compress\u00e9 (.zip)?",
17
- "zip_confirm_folder": "T\u00e9l\u00e9charger le dossier COMPLET compress\u00e9 (.zip)?",
18
- "select_tooltip": "La s\u00e9lection influe sur le comportement des boutons [ZIP] et [Supprimer] quand disponibles, mais vous pouvez aussi filtrer la liste",
19
- "delete_hint": "Pour supprimer, cliquez en premier sur s\u00e9lectionner",
20
- "delete_confirm": "Supprimer {n,plural, one{# \u00e9l\u00e9ment} other{# \u00e9l\u00e9ments}}?",
21
- "delete_completed": "Suppression: {n} termin\u00e9(s)",
22
- "delete_failed": ", {n,plural, one{# en \u00e9chec} other{# en \u00e9chec}}",
23
- "delete_select": "S\u00e9lectionnez un ou plusieurs \u00e9l\u00e9ment(s) \u00e0 supprimer",
12
+ "Select some files": "Sélectionnez des fichiers",
13
+ "zip_checkboxes": "Utilisez les cases à cocher pour sélectionner les fichiers, vous pourrez alors utiliser ZIP à nouveau",
14
+ "zip_tooltip_selected": "Télécharger les éléments sélectionnés dans un seul fichier compressé (.zip)",
15
+ "zip_tooltip_whole": "Téléchargez la liste complète (non filtrée) sous la forme d'un seul fichier compressé (.zip). Si vous sélectionnez certains éléments, seuls ceux-ci seront téléchargés",
16
+ "zip_confirm_search": "Télécharger le résultat de la recherche dans un fichier compressé (.zip)?",
17
+ "zip_confirm_folder": "Télécharger le dossier COMPLET compressé (.zip)?",
18
+ "select_tooltip": "La sélection influe sur le comportement des boutons [ZIP] et [Supprimer] quand disponibles, mais vous pouvez aussi filtrer la liste",
19
+ "delete_hint": "Pour supprimer, cliquez en premier sur sélectionner",
20
+ "delete_confirm": "Supprimer {n,plural, one{# élément} other{# éléments}}?",
21
+ "delete_completed": "Suppression: {n} terminé(s)",
22
+ "delete_failed": "{n,plural, one{# en échec} other{# en échec}}",
23
+ "delete_select": "Sélectionnez un ou plusieurs élément(s) à supprimer",
24
24
  "Delete": "Supprimer",
25
25
  "Options": "Options",
26
26
  "Search": "Recherche",
27
27
  "Zip": "ZIP",
28
28
  "search_msg": "Rechercher dans ce dossier et ses sous-dossiers",
29
29
  "Searching": "Recherche",
30
- "Searched": "Recherche termin\u00e9e",
30
+ "Searched": "Recherche terminée",
31
31
  "Clear search": "Effacer la recherche",
32
32
  "Interrupted": "Interrompu",
33
- "stopped_before": "Chargement annul\u00e9",
33
+ "stopped_before": "Chargement annulé",
34
34
  "empty_list": "Liste vide",
35
35
  "filter_none": "Aucun filtre",
36
36
  "Admin-panel": "Page Administration",
37
37
  "Login": "Connexion",
38
38
  "Username": "Utilisateur",
39
39
  "Password": "Mot de Passe",
40
- "login_untrusted": "Connexion annul\u00e9e: probl\u00e8me de certificat du serveur",
40
+ "login_untrusted": "Connexion annulée: problème de certificat du serveur",
41
41
  "login_bad_credentials": "Identifiant ou mot de passe invalide",
42
- "login_bad_cookies": "Probl\u00e8me de cookies : \u00e9chec de la connexion",
42
+ "login_bad_cookies": "Problème de cookies : échec de la connexion",
43
43
  "User panel": "Connexion Utilisateur",
44
44
  "Change password": "Changer le mot de passe",
45
45
  "enter_pass": "Entrez un nouveau mot de passe",
46
46
  "enter_pass2": "Confirmez le nouveau mot de passe",
47
- "pass2_mismatch": "Le second mot de passe ne correspond pas au premier : \u00e9chec de la connexion",
48
- "password_changed": "Mot de passe chang\u00e9",
49
- "Logout": "D\u00e9connexion",
47
+ "pass2_mismatch": "Le second mot de passe ne correspond pas au premier : échec de la connexion",
48
+ "password_changed": "Mot de passe modifié",
49
+ "Logout": "Déconnexion",
50
50
  "connection error": "Erreur de connexion",
51
51
  "Full timestamp:": "Horodatage complet:",
52
52
  "Search was interrupted": "Recherche interrompue",
53
- "Stop list": "Arr\u00eater le chargement de la liste",
54
- "upload_starting": "Votre t\u00e9l\u00e9-chargement devrait commencer maintenant",
55
- "wrong_account": "Aucun acc\u00e8s d\u00e9fini pour ce compte, essayez avec un autre compte",
56
- "no_upload_here": "Pas de permission de t\u00e9l\u00e9-versement pour ce dossier",
57
- "Create folder": "Cr\u00e9ez un dossier",
53
+ "Stop list": "Arrêter le chargement de la liste",
54
+ "upload_starting": "Votre télé-chargement devrait commencer maintenant",
55
+ "wrong_account": "Aucun accès défini pour ce compte, essayez avec un autre compte",
56
+ "no_upload_here": "Pas de permission de télé-versement pour ce dossier",
57
+ "Create folder": "Créez un dossier",
58
58
  "Pick files": "Choisissez les fichiers",
59
59
  "Pick folder": "Choisissez un dossier",
60
60
  "send_files": "Envoyer {n,plural,one{# fichier} other{# fichiers}}, {size}",
61
61
  "Clear": "Effacer",
62
- "failed_upload": "Impossible de transf\u00e9rer {name}",
63
- "confirm_resume": "Reprendre le t\u00e9l\u00e9-versement?",
62
+ "failed_upload": "Impossible de transférer {name}",
63
+ "confirm_resume": "Reprendre le télé-versement?",
64
64
  "file too large": "Fichier trop gros",
65
65
  "Enter folder name": "Saisissez le nom du dossier",
66
- "Successfully created": "Cr\u00e9\u00e9 avec succ\u00E8s",
66
+ "Successfully created": "Créé avec succès",
67
67
  "enter_folder": "Saisissez le dossier",
68
- "folder_exists": "Un dossier avec le m\u00eame nom \u00e9xiste d\u00e9j\u00e0",
68
+ "folder_exists": "Un dossier avec le même nom éxiste déjà",
69
69
  "Sort by": "Trier par",
70
70
  "name": "Nom",
71
71
  "extension": "Extension",
@@ -73,8 +73,8 @@
73
73
  "time": "Heure",
74
74
  "Invert order": "Inverser le tri",
75
75
  "Folders first": "Dossiers en premier",
76
- "Numeric names": "Noms num\u00E9riques",
77
- "theme:": "Th\u00E8me:",
76
+ "Numeric names": "Noms numériques",
77
+ "theme:": "Thème:",
78
78
  "auto": "Auto",
79
79
  "light": "Clair",
80
80
  "dark": "Sombre",
@@ -86,21 +86,21 @@
86
86
  "Warning": "Avertissement",
87
87
  "Error": "Erreur",
88
88
  "Info": "Info",
89
- "Unauthorized": "Non autoris\u00e9",
89
+ "Unauthorized": "Non autorisé",
90
90
  "Forbidden": "Interdit",
91
- "Not found": "Non trouv\u00e9",
91
+ "Not found": "Non trouvé",
92
92
  "Server error": "Erreur du serveur",
93
93
  "Upload": "Envoyer",
94
- "upload_concluded": "Envoi termin\u00e9:",
95
- "upload_finished": "{n} termin\u00e9(s) ({size})",
96
- "upload_errors": "{n} \u00e9chou\u00e9s",
97
- "upload_file_rejected": "Certains fichiers ont \u00e9t\u00e9 refus\u00e9s",
98
- "download counter": "Compteur de t\u00e9l\u00e9chargements",
94
+ "upload_concluded": "Envoi terminé:",
95
+ "upload_finished": "{n} terminé(s) ({size})",
96
+ "upload_errors": "{n} échoués",
97
+ "upload_file_rejected": "Certains fichiers ont été refusés",
98
+ "download counter": "Compteur de téléchargements",
99
99
  "File menu": "Menu du fichier",
100
100
  "Folder menu": "Menu du dossier",
101
101
  "Name": "Nom",
102
102
  "file_open": "Ouvrir",
103
- "Download": "T\u00e9l\u00e9charger",
103
+ "Download": "Télécharger",
104
104
  "Missing permission": "Permission manquante"
105
105
  }
106
106
  }
@@ -96,6 +96,8 @@
96
96
  "file_open": "Apri",
97
97
  "Download": "Download",
98
98
  "Missing permission": "Permesso mancante",
99
- "Reload": "Ricarica"
99
+ "Reload": "Ricarica",
100
+ "Get list": "Lista",
101
+ "Skip existing files": "Salta file esistenti"
100
102
  }
101
103
  }