hfs 0.52.0-beta4 → 0.52.0-beta5

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.
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.ariaOnly{position:absolute;clip-path:rect(1px 1px 1px 1px);clip:rect(1px,1px,1px,1px)}:root{height:100dvh;--bg: #fff;--text: #555;--ghost-contrast: #8882;--ghost-contrast-alt: #eee;--faint-contrast: #8884;--mild-contrast: #8886;--good-contrast: #000a;--button-bg: #6080aa;--button-text: #eaeaea;--focus-color: #468;--separator: " – "}@supports (content: ""/""){:root{--separator: " – " / ""}}:root .highlightedText,:root .file-menu a:hover{color:#0006;text-shadow:0 0 3px rgba(0,0,0,.4)}:root .theme-dark{--bg: #000;--text: #999;--ghost-contrast-alt: #181818;--good-contrast: #fffa;--button-bg: #345;--button-text: #999;color-scheme:dark}:root .theme-dark .highlightedText,:root .theme-dark .file-menu a:hover,:root .file-menu .theme-dark a:hover{color:#fff;text-shadow:0 0 3px #fff}:root .theme-dark a{color:#8ac}:root .theme-dark .dialog-closer{background:#633}:root .theme-dark .dialog-icon{color:#ccc}:root .theme-dark .dialog-icon .icon{color:#aaa}:root .theme-dark .dialog-backdrop{background:#333b}:root .theme-dark .error-msg{color:#b88;background-color:#623}:root .theme-dark button.toggled,:root .theme-dark a.toggled{color:#eee;text-shadow:0 0 3px #fff}body{background-color:var(--bg);margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}body,button,select,input{font-size:12pt}.list-wrapper{max-width:54em;margin:auto;min-height:100vh;display:flex;flex-direction:column}body,input{color:var(--text)}code{font-family:source-code-pro,Menlo,Monaco,Consolas,Courier New,monospace}input:not([type=checkbox],[type=range]),select,textarea{padding:.3em .4em;border-radius:.5em;background:var(--bg);border-color:var(--mild-contrast);color:var(--good-contrast);max-width:100%;box-sizing:border-box;width:100%}input[type=range]{width:calc(100% - 1px)}input[type=checkbox]{transform:scale(1.7);accent-color:var(--button-bg)}textarea{font-size:14pt}label input[type=checkbox]{margin-right:.8em}select{text-align:center}.hidden{display:none!important}[class^=fa-]:before,[class*=" fa-"]:before{margin:0}.icon{font-size:1.2em;height:1.2em;width:1.4em;display:inline-block;text-align:center}img.file-icon{height:1em}.file-icon{background-size:contain;background-repeat:no-repeat;background-position:center;vertical-align:text-bottom}.icon.mirror:before{transform:scaleX(-1)}a{text-decoration:none;color:var(--button-bg)}button{background-color:var(--button-bg);color:var(--button-text);padding:.5em;border:transparent;text-decoration:none;border-radius:.3em;vertical-align:middle;cursor:pointer;transition:background-color .5s}button:not(.before-sliding){min-width:2em}button.small{padding:0 .4em;height:30px}button .icon{position:relative;top:.05em}button:hover{outline:1px solid var(--mild-contrast)}button[disabled]{background-color:var(--faint-contrast)}button.toggled{color:#fff;text-shadow:0 0 3px #fff}a.toggled{color:#223;text-shadow:0 0 5px #223}button:focus-visible,.breadcrumb:focus-visible{outline:3px solid var(--focus-color)}a>button{width:100%;height:100%}input:focus-visible,select:focus-visible,ul a:focus-visible{border-radius:.3em;border-color:transparent;outline:2px solid var(--focus-color)}.icon-button,ul.dir li .entry-panel .file-menu-button{font-size:.7em;padding:.2em .4em;margin-left:.4em;vertical-align:bottom}.error-msg{background-color:#faa;color:#833;padding:.5em 1em}.hide-back,.upload-toolbar,header{background-color:var(--bg)}header{position:sticky;top:0;padding:.2em .1em;z-index:3}kbd{background-color:#eee;border-radius:3px;border:1px solid #b4b4b4;box-shadow:0 1px 1px #0003,0 2px #ffffffb3 inset;color:#333;display:inline-block;font-size:.85em;font-weight:700;line-height:1;padding:2px 4px;white-space:nowrap;margin-right:.5em}.before-sliding{width:0!important;flex:0!important;margin:0!important;height:0!important;padding:0!important;overflow:hidden!important;transition:flex .5s}.show-sliding{transition:flex .5s;overflow:clip;flex:1;white-space:nowrap}.ani-working{animation:1s blink infinite}@keyframes blink{0%{opacity:1}50%{opacity:.2}}@keyframes spin{to{transform:rotate(360deg)}}@keyframes fade-in{0%{opacity:0}to{opacity:1}}.spinner,.icon.spinner:before{animation:1.5s spin infinite linear;display:inline-flex;justify-content:center;align-items:center;width:min-content}.breadcrumb{padding:.1em .6em .2em;line-height:1.8em;border-radius:.7em;background-color:var(--button-bg);color:var(--button-text);border-top:1px solid #666;margin-right:-.1em}.breadcrumb:nth-child(-n+3) .icon{padding:0 .2em}#folder-stats,#filter-bar>span{font-size:90%}#folder-stats{margin-left:.5em;line-height:2em;float:right}#folder-stats .icon{margin-right:.3em}#filter{flex:1;box-sizing:border-box}#filter-bar{display:flex;align-items:center;gap:.8em;margin:.2em 0 0;padding:2px 0 1px 3px;height:1.8em}#filter-bar input[type=checkbox]{margin-top:.3em}#filter-bar span:empty{display:none}ul.dir{flex:1;padding:0;margin:0;clear:both}ul.dir>p{text-align:center}ul.dir li{display:block;list-style-type:none;padding:.3em .3em .4em;border-bottom:1px solid var(--faint-contrast)}ul.dir li:nth-of-type(odd){background-color:var(--ghost-contrast)}ul.dir li input[type=checkbox]{margin-right:1em}@media (hover: none){ul.dir li .link-wrapper .popup-menu-button{display:none}}@media (hover: hover){ul.dir li .link-wrapper:not(:hover) .popup-menu-button{display:none}ul.dir li .link-wrapper:hover{padding:1em;margin:-1em}}ul.dir li .link-wrapper a:last-of-type{word-break:break-word;padding-right:.3em}ul.dir li .link-wrapper a .icon{margin-right:.5em;display:inline-block;text-align:center}ul.dir li .link-wrapper a img.icon,ul.dir li .link-wrapper a video.icon{vertical-align:bottom;position:relative;top:1px}ul.dir li .link-wrapper a:hover{text-decoration:underline}ul.dir li .entry-panel{float:right;padding-top:.3em;display:flex;align-items:center}ul.dir li .entry-panel .file-menu-button{margin:-3px 0 -3px .4em}ul.dir li .entry-panel .entry-details{font-size:90%;margin-left:4px;font-variant-numeric:tabular-nums}ul.dir li .entry-panel .entry-details .entry-size-unit{margin-left:.3em}ul.dir li>div:last-of-type{clear:both}ul.dir li.page-separator{margin-top:.7em;position:relative}ul.dir li.page-separator:before{content:attr(label);position:absolute;top:-1.5em;font-size:smaller;margin-left:calc(50% - 1em);opacity:.9}.entry-comment{display:inline;white-space:pre-wrap;word-break:break-word}.entry-comment:before,.entry-comment:after{font-size:1.5em;font-family:serif;line-height:1px;position:relative}.entry-comment:before{content:"“";margin-left:.5em;margin-right:.1em;top:.2em}.entry-comment:after{content:"„";top:-.1em;margin-left:.1em}#menu-bar{display:flex;justify-content:space-evenly;flex-wrap:wrap}#menu-bar>*{flex:1;margin:.1em}#menu-bar>*:first-child{margin-left:0}#menu-bar>*:last-child{margin-right:0}#menu-bar button{padding:min(1vh,.5em) 0}#searched{margin:.2em}#user-panel{display:flex;flex-direction:column;gap:1em}#user-panel a>button{width:100%}button .icon+.label{cursor:inherit;margin-left:.4em}.dialog-backdrop.working{font-size:5em;animation:1s fade-in}.dialog-content{padding:.2em}.dialog-alert .dialog-content{text-align:center}.dialog-alert .dialog-content p{text-align:left;display:inline-block}.dialog{min-width:11em;--color: var(--button-bg)}.dialog-icon .icon{margin-left:-1px;font-size:95%;margin-top:.4em;border-radius:.6em 0}#paging{position:sticky;bottom:0;display:flex;gap:.1em;background-color:var(--bg);padding:0 .2em .2em}#paging>button{z-index:1}#paging button{box-shadow:0 0 .3em .3em #0003}#paging #paging-middle{padding:0 .5em;margin:0 -.3em;display:flex;gap:.5em;flex:1;overflow-x:auto}#paging #paging-middle>button{flex:1;min-width:unset;padding-top:0;padding-bottom:0}#paging button{background:var(--button-bg);text-align:center;white-space:nowrap;padding:.5em}.upload-toolbar{position:sticky;top:-4px}.upload-progress:before{content:var(--separator)}.entry-size:after{content:var(--separator)}.upload-progress{min-width:4em;display:inline-block;margin-left:.5em}.upload-progress-bar{display:block;width:100%}.upload-list{margin-top:.5em}.upload-list td:nth-child(1){width:0}.upload-list td:nth-child(2){text-align:right;width:0;white-space:nowrap;padding-left:.5em}.upload-list td:nth-child(3){padding:.2em .5em;word-break:break-word}.nowrap{white-space:nowrap}.dialog-login form{display:flex;flex-direction:column;gap:1.2em}.dialog-login label{display:block;margin-bottom:.5em;margin-left:.1em}.miss-perm{margin:0 .3em}.popup-menu-button{font-size:.8em;padding:.2em .3em;position:absolute;opacity:.8;white-space:nowrap}.popup-menu-button:hover{opacity:1}.file-dialog .dialog{min-width:13em}.file-dialog-properties{word-break:break-word;line-height:1.5em;margin:0}.file-dialog-properties dt{font-weight:700}.file-dialog-properties dd{margin-left:1.5em}.file-menu{margin-top:1em;padding-top:1em;border-top:1px solid var(--faint-contrast);display:flex;flex-direction:column;gap:.7em 1em}.file-menu a{display:flex;align-items:flex-start}.file-menu a label{margin-top:.1em}.file-menu a label small{display:block}.file-menu a .icon{margin-right:.5em}.unauthorized{text-align:center}#clipBar{position:sticky;bottom:0;background:var(--bg);box-shadow:0 0 .3em .3em var(--bg);display:flex;align-items:center;gap:.5em}.tiles-mode{max-width:none;--tile-size: 5;--name-lines: 3;--name-height: calc(4.7em + var(--tile-size) * .4em + 1.2em * var(--name-lines));--tile-width: calc(5em + 1em * var(--tile-size))}@media (min-width: 42em){.tiles-mode{margin:0 1em}}.tiles-mode ul.dir{display:grid;grid-template-columns:repeat(auto-fill,minmax(var(--tile-width),1fr));grid-auto-rows:calc(var(--name-height) + 1.3em);gap:0 20px}.tiles-mode ul.dir li{text-align:center;position:relative;display:flex;flex-direction:column;border-bottom:none;overflow-x:clip;padding:.5em 0 0}.tiles-mode ul.dir li .link-wrapper:not(:hover){max-height:var(--name-height);display:block;display:-webkit-box;overflow:hidden;-webkit-line-clamp:calc(var(--name-lines) + 1);-webkit-box-orient:vertical}.tiles-mode ul.dir li .link-wrapper a:last-of-type{padding:0}.tiles-mode ul.dir li .link-wrapper a span{display:block}.tiles-mode ul.dir li .link-wrapper a .icon.icon{font-size:calc(1.2rem + .6rem * var(--tile-size))}.tiles-mode ul.dir li .link-wrapper a img.icon,.tiles-mode ul.dir li .link-wrapper a video.icon{width:auto;height:1em;padding:.1em 0}.tiles-mode ul.dir li .link-wrapper a .icon{font-size:4rem;display:block;margin:auto}.tiles-mode ul.dir li .link-wrapper:hover{overflow:visible;display:block;z-index:1}.tiles-mode ul.dir li .link-wrapper:hover .icon:before{text-decoration:none}.tiles-mode ul.dir li .link-wrapper:hover{padding:0;margin:0}.tiles-mode ul.dir li:nth-of-type(odd){background-color:var(--bg)}.tiles-mode ul.dir li .entry-panel{justify-content:center;font-size:10pt}.tiles-mode ul.dir li .entry-details{font-size:80%}.tiles-mode ul.dir li.page-separator:before{content:""}.tiles-mode ul.dir li input[type=checkbox]{margin:0;position:absolute;top:.3em;right:1em}.tiles-mode ul.dir li .link-wrapper a{display:inline}.tiles-mode ul.dir li:hover{--bg: var(--ghost-contrast-alt);background:var(--bg)}.tiles-mode ul.dir li:hover .link-wrapper,.tiles-mode ul.dir li:hover .entry-panel{z-index:1;background:var(--bg)}.tiles-mode ul.dir li:hover input[type=checkbox]{z-index:2}.tiles-mode ul.dir li:hover .entry-panel{padding-bottom:.3em}.tiles-mode .entry-size:after{content:none}.tiles-mode .entry-ts{display:none}.tiles-mode .popup-menu-button{position:absolute;top:0;left:0}.tiles-mode #filter-bar{margin-bottom:1em}.tiles-mode #paging{z-index:1}#root .file-show{--nav-size: min(25vh, 25vw)}#root .file-show>div{height:100%;width:100%}@media (max-width: 30em){#root .file-show>div{flex-direction:column-reverse!important}}#root .file-show .showing-container{width:100%;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;position:relative}#root .file-show .meta-tags{position:relative;width:100%;text-align:center;display:flex;justify-content:center}#root .file-show .meta-tags>div{position:absolute;margin:1em}#root .file-show .showing{max-width:calc(100% - (min(4vw,var(--nav-size))*2));max-height:100%}#root .file-show .cover{position:absolute;width:100%;height:100%;background-repeat:no-repeat;background-size:contain;background-position:center;z-index:-1;opacity:.3;transition:opacity 1s}#root .file-show .cover.none{opacity:0}#root .file-show audio.showing{min-width:60%}#root .file-show audio.showing,#root .file-show img.showing{max-width:100%}#root .file-show .main{flex:1;position:relative;max-height:100%;overflow:hidden}#root .file-show .freeY .main,#root .file-show .fullWidth .main{overflow-y:auto}#root .file-show .freeY .showing,#root .file-show .fullWidth .showing{max-height:initial;margin:auto}#root .file-show .freeY .showing-container,#root .file-show .fullWidth .showing-container{overflow:auto;align-items:flex-start}#root .file-show .fullWidth .showing-container,#root .file-show .fullWidth .showing{width:100%}#root .file-show .nav{position:absolute;width:.5em;font-size:var(--nav-size);cursor:pointer;opacity:.3;-webkit-text-stroke:2px black;user-select:none;transition:opacity .3s}#root .file-show .nav:hover{opacity:.7}#root .file-show .nav.nav-hidden{opacity:0}#root .file-show .bar{padding:.5em min(2vw,1em);background:var(--bg);opacity:.8;flex-wrap:wrap}#root .file-show .bar,#root .file-show .bar>.controls{display:flex;align-items:center;justify-content:flex-end;gap:.5em}#root .file-show .bar .entry-details{font-size:smaller;margin-left:1em}#root .file-show .bar .entry-ts{display:inherit;font-size:smaller}#root .file-show .bar .entry-size:after{display:none}.file-show-help kbd{margin:.5em}.file-show-help kbd:first-of-type{margin-top:1em}@media (min-width: 42em){body{scrollbar-width:thin;scrollbar-color:var(--button-bg) var(--ghost-contrast)}body::-webkit-scrollbar{width:12px}body::-webkit-scrollbar-track{background:var(--ghost-contrast)}body::-webkit-scrollbar-thumb{background-color:var(--button-bg);border-radius:20px;border:1px solid var(--ghost-contrast)}button{padding:.5em 1em}}@media (max-width: 42em){:root{--ghost-contrast: #8883}body,button,select{font-size:14pt}#menu-bar button .label,#filter-bar button .label,#clipBar button .label{display:none}#filter-bar{margin-top:.4em}#filter-bar button{width:17.6vw;height:2.3em}.breadcrumb{word-break:break-all}.breadcrumb .icon{font-size:24px}#root>.tiles-mode{margin:0}}@media (max-height: 600px){.file-dialog .dialog-content{display:flex;gap:3em;margin:1em}.file-dialog .dialog-content .file-menu{margin-top:0;padding-top:0;border-top:none;margin-left:2em;padding-left:2em;border-left:1px solid var(--faint-contrast)}}@media (pointer: coarse){#root>.tiles-mode .file-menu-button{font-size:1em;margin-top:.3em}}.dialog-backdrop{position:fixed;top:0;bottom:0;left:0;right:0;background:#8886;backdrop-filter:blur(2px);display:flex;justify-content:center;align-items:center;z-index:1000}.dialog{background:#fff;background:var(--bg);padding:.5em;padding:max(.5em,1vw,2vh);padding-top:0;border-radius:1em;position:relative;margin:0 3vw;overflow:hidden;max-height:calc(100vh - 2em);display:flex;flex-direction:column;justify-content:center}.dialog-icon{color:#fff;background-color:var(--color);position:absolute;top:0;width:2em;height:1.8em;text-align:center;border-radius:.8em 0}.dialog-icon-text{display:flex;align-items:center;justify-content:center}.dialog-title{font-size:120%;margin:.3em 0;padding:0 .5em;min-height:1.2em}.dialog-closer~.dialog-title{margin-right:2em}.dialog-type~.dialog-title{margin-left:2em}.dialog-icon~.dialog-title{text-align:center}.dialog-closer{border-radius:0 .8em;right:0;padding:0;background-color:#c88}.dialog-icon~.dialog-content{margin-top:1em}.dialog-type{left:0;top:0;overflow:hidden;opacity:.7}.dialog-content{overflow:auto;max-height:calc(100vh - 4.5em)}.dialog-content p{white-space:pre-wrap;margin:.5em 0}.dialog-confirm .dialog-content button{margin-top:1em}.dialog-alert-info{--color: #282 }.dialog-alert-warning{--color: #c91 }.dialog-alert-error{--color: #822}@media (max-width: 42em){.dialog-icon{font-size:120%}.dialog-icon~.dialog-content{margin-top:1.5em}}.dialog-prompt label{display:block;margin:.5em .1em}
@@ -1,4 +1,4 @@
1
- import{g as OF,c as UF}from"./index-SY22o0dA.js";function gF(sF,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 sF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(sF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(sF,Symbol.toStringTag,{value:"Module"}))}var dF={exports:{}};/*
1
+ import{g as OF,c as UF}from"./index-Q_GrPW0f.js";function gF(sF,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 sF)){const lF=Object.getOwnPropertyDescriptor(tF,w);lF&&Object.defineProperty(sF,w,lF.get?lF:{enumerable:!0,get:()=>tF[w]})}}}return Object.freeze(Object.defineProperty(sF,Symbol.toStringTag,{value:"Module"}))}var dF={exports:{}};/*
2
2
  * [js-sha512]{@link https://github.com/emn178/js-sha512}
3
3
  *
4
4
  * @version 0.8.0
@@ -5,8 +5,8 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=0" />
6
6
  <link href="/fontello.css" rel="stylesheet" />
7
7
  <script src="//polyfill.io/v3/polyfill.min.js?features=es2022%2Ces2021%2Ces2020%2Ces2019%2Ces2018%2Ces2017"></script>
8
- <script type="module" crossorigin src="/assets/index-SY22o0dA.js"></script>
9
- <link rel="stylesheet" crossorigin href="/assets/index-Kys6yJtN.css">
8
+ <script type="module" crossorigin src="/assets/index-Q_GrPW0f.js"></script>
9
+ <link rel="stylesheet" crossorigin href="/assets/index-tFXsZ4SK.css">
10
10
  </head>
11
11
  <body>
12
12
  <noscript>You need to enable JavaScript to run this app.</noscript>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hfs",
3
- "version": "0.52.0-beta4",
3
+ "version": "0.52.0-beta5",
4
4
  "description": "HTTP File Server",
5
5
  "keywords": [
6
6
  "file server",
@@ -16,7 +16,7 @@
16
16
  "start-frontend": "npm run start --workspace=frontend",
17
17
  "start-admin": "npm run start --workspace=admin",
18
18
  "build-all": "npm audit --omit=dev --audit-level=moderate && rm -rf dist && npm i && npm run build-server & npm run build-frontend & npm run build-admin & wait && echo COMPLETED",
19
- "build-server": "rm -rf dist/src dist/plugins && tsc --target es2018 && touch package.json && cp -v -r package.json central.json README* LICENSE* plugins dist && find dist -name .DS_Store -delete && node afterbuild.js",
19
+ "build-server": "rm -rf dist/src dist/plugins && tsc --target es2018 && touch package.json && cp -v -r package.json central.json README* LICENSE* plugins dist && find dist \\( -name .DS_Store -o -name storage \\) -delete && node afterbuild.js",
20
20
  "build-frontend": "npm run build --workspace=frontend",
21
21
  "build-admin": "npm run build --workspace=admin",
22
22
  "server-for-test": "node dist/src --cwd . --config tests && rm custom.html",
package/src/acme.js CHANGED
@@ -89,7 +89,7 @@ exports.makeCert = (0, debounceAsync_1.debounceAsync)(async (domain, email, altN
89
89
  if (!domain)
90
90
  return new apiMiddleware_1.ApiError(cross_1.HTTP_BAD_REQUEST, 'bad params');
91
91
  const res = await generateSSLCert(domain, email, altNames);
92
- const CERT_FILE = 'acme.cert';
92
+ const CERT_FILE = 'acme.cer';
93
93
  const KEY_FILE = 'acme.key';
94
94
  await promises_1.default.writeFile(CERT_FILE, res.cert);
95
95
  await promises_1.default.writeFile(KEY_FILE, res.key);
package/src/adminApis.js CHANGED
@@ -113,7 +113,7 @@ exports.adminApis = {
113
113
  async save_pem({ cert, private_key, name = 'self' }) {
114
114
  if (!cert || !private_key)
115
115
  return new apiMiddleware_1.ApiError(const_1.HTTP_BAD_REQUEST);
116
- const files = { cert: name + '.cert', private_key: name + '.key' };
116
+ const files = { cert: name + '.cer', private_key: name + '.key' };
117
117
  await (0, promises_1.writeFile)(files.private_key, private_key);
118
118
  await (0, promises_1.writeFile)(files.cert, cert);
119
119
  return files;
package/src/block.js CHANGED
@@ -19,7 +19,7 @@ const block = (0, config_1.defineConfig)('block', [], rules => {
19
19
  });
20
20
  function applyBlock(socket, ip = (0, connections_1.normalizeIp)(socket.remoteAddress || '')) {
21
21
  if (ip && block.compiled().find(rule => rule(ip)))
22
- return (0, connections_1.disconnect)(socket);
22
+ return (0, connections_1.disconnect)(socket, 'block-ip');
23
23
  }
24
24
  exports.applyBlock = applyBlock;
25
25
  setInterval(() => {
@@ -68,9 +68,11 @@ function updateConnection(conn, change, changeState) {
68
68
  events_1.default.emit('connectionUpdated', conn, change);
69
69
  }
70
70
  exports.updateConnection = updateConnection;
71
- function disconnect(what) {
71
+ function disconnect(what, debugLog = '') {
72
72
  if ('socket' in what)
73
73
  what = what.socket;
74
+ if (debugLog)
75
+ console.debug("disconnection:", debugLog, what.remoteAddress);
74
76
  return what.destroy();
75
77
  }
76
78
  exports.disconnect = disconnect;
package/src/const.js CHANGED
@@ -37,7 +37,7 @@ const os_1 = require("os");
37
37
  const fs_1 = require("fs");
38
38
  const path_1 = require("path");
39
39
  __exportStar(require("./cross-const"), exports);
40
- exports.API_VERSION = 8.65;
40
+ exports.API_VERSION = 8.71;
41
41
  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
42
42
  exports.HFS_REPO = 'rejetto/hfs';
43
43
  exports.argv = (0, minimist_1.default)(process.argv.slice(2));
@@ -45,7 +45,7 @@ exports.DEV = process.env.DEV || exports.argv.dev ? 'DEV' : '';
45
45
  exports.ORIGINAL_CWD = process.cwd();
46
46
  exports.HFS_STARTED = new Date();
47
47
  const PKG_PATH = (0, path_1.join)(__dirname, '..', 'package.json');
48
- exports.BUILD_TIMESTAMP = "2024-02-11T10:59:36.071Z";
48
+ exports.BUILD_TIMESTAMP = "2024-02-24T18:13:41.294Z";
49
49
  const pkg = JSON.parse(fs.readFileSync(PKG_PATH, 'utf8'));
50
50
  exports.VERSION = pkg.version;
51
51
  exports.RUNNING_BETA = exports.VERSION.includes('-');
package/src/cross.js CHANGED
@@ -18,7 +18,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
20
  exports.typedEntries = exports.typedKeys = exports.objRenameKey = exports.randomId = exports.getOrSet = exports.waitFor = exports.newObj = exports.findDefined = exports.isOrderedEqual = exports.swap = exports.tryJson = exports.dirname = exports.basename = exports.pendingPromise = exports._dbg = exports._log = exports.wantArray = exports.formatPerc = exports.with_ = exports.try_ = exports.setHidden = exports.onlyTruthy = exports.truthy = exports.splitAt = exports.strinsert = exports.removeStarting = exports.enforceFinal = exports.objSameKeys = exports.haveTimeout = exports.wait = exports.prefix = exports.formatSpeed = exports.formatBytes = exports.isWhoObject = exports.PERM_KEYS = exports.defaultPerms = exports.WHO_ANY_ACCOUNT = exports.WHO_NO_ONE = exports.WHO_ANYONE = exports.LIST = exports.CFG = exports.THEME_OPTIONS = exports.SORT_BY_OPTIONS = exports.FRONTEND_OPTIONS = exports.MAX_TILE_SIZE = exports.DAY = exports.HOUR = exports.MINUTE = exports.WIKI_URL = exports.REPO_URL = void 0;
21
- exports.shortenAgent = exports.inCommon = exports.replace = exports.matches = exports.makeMatcher = exports.runAt = exports.pathEncode = exports.promiseBestEffort = exports.escapeHTML = exports.ipForUrl = exports.isIpLan = exports.isIpLocalHost = exports.xlate = exports.isEqualLax = exports.isWindowsDrive = exports.isIP = exports.isPrimitive = exports.formatTimestamp = exports.repeat = exports.asyncGeneratorToArray = exports.filterMapGenerator = exports.throw_ = exports.hasProp = void 0;
21
+ exports.shortenAgent = exports.mapFilter = exports.inCommon = exports.replace = exports.matches = exports.makeMatcher = exports.runAt = exports.pathEncode = exports.promiseBestEffort = exports.escapeHTML = exports.ipForUrl = exports.isIpLan = exports.isIpLocalHost = exports.xlate = exports.isEqualLax = exports.isWindowsDrive = exports.isIP = exports.isPrimitive = exports.formatTimestamp = exports.repeat = exports.asyncGeneratorToArray = exports.filterMapGenerator = exports.throw_ = exports.hasProp = void 0;
22
22
  // This file is part of HFS - Copyright 2021-2023, Massimo Melina <a@rejetto.com> - License https://www.gnu.org/licenses/gpl-3.0.txt
23
23
  // all content here is shared between client and server
24
24
  const lodash_1 = __importDefault(require("lodash"));
@@ -82,7 +82,7 @@ function formatSpeed(n, options = {}) {
82
82
  }
83
83
  exports.formatSpeed = formatSpeed;
84
84
  function prefix(pre, v, post = '') {
85
- return v ? pre + v + post : '';
85
+ return v ? (pre || '') + v + (post || '') : '';
86
86
  }
87
87
  exports.prefix = prefix;
88
88
  function wait(ms, val) {
@@ -413,6 +413,15 @@ function inCommon(a, b) {
413
413
  return i;
414
414
  }
415
415
  exports.inCommon = inCommon;
416
+ function mapFilter(arr, map, filter = (x) => x === undefined, invert = false) {
417
+ return arr[invert ? 'reduceRight' : 'reduce']((ret, x, idx) => {
418
+ const y = map(x, idx);
419
+ if (filter(y))
420
+ ret.push(y); // push is much faster than unshift, therefore invert using reduceRight https://measurethat.net/Benchmarks/Show/29/0/array-push-vs-unshift
421
+ return ret;
422
+ }, []);
423
+ }
424
+ exports.mapFilter = mapFilter;
416
425
  function shortenAgent(agent) {
417
426
  var _a;
418
427
  return lodash_1.default.findKey(BROWSERS, re => re.test(agent))
package/src/geo.js CHANGED
@@ -27,7 +27,7 @@ const geoFilter = async (ctx, next) => {
27
27
  (0, connections_1.updateConnection)(connection, { country });
28
28
  if (!ctx.state.skipFilters && allow.get() !== null)
29
29
  if (country ? list.get().includes(country) !== allow.get() : !allowUnknown.get())
30
- return (0, connections_1.disconnect)(ctx);
30
+ return (0, connections_1.disconnect)(ctx, 'geo-filter');
31
31
  }
32
32
  await next();
33
33
  };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Pultsari",
3
- "version": 1.0,
4
- "hfs_version": "0.47.0",
3
+ "version": 1.1,
4
+ "hfs_version": "0.51.1",
5
5
  "translate": {
6
6
  "Select": "Valitse",
7
7
  "n_files": "{n,plural,one{# tiedosto} other{# tiedostoa}}",
@@ -100,7 +100,7 @@
100
100
  "Name": "Nimi",
101
101
  "file_open": "Avaa",
102
102
  "Download": "Lataa",
103
- "Missing permission": "Oikeudet puuuttuvat",
103
+ "Missing permission": "Oikeudet puuttuvat",
104
104
  "Reload": "Päivitä",
105
105
  "Get list": "Näytä listana",
106
106
  "Skip existing files": "Ohita jo olemassa olevat tiedostot",
@@ -126,6 +126,20 @@
126
126
  "showHelp_space_body": "valitse",
127
127
  "showHelp_D_body": "lataa",
128
128
  "showHelp_Z_body": "vaihda zoomauksen tilaa",
129
- "showHelp_F_body": "koko näyttö"
129
+ "showHelp_F_body": "koko näyttö",
130
+ "Destination": "Kohde",
131
+ "in_queue": "{n} jonossa",
132
+ "enter_comment": "Kirjoita kommentti tälle tiedostolle / hakemistolle",
133
+ "Comment": "Kommentti",
134
+ "upload_dd_hint": "Voit lähettää tiedostoja raahaamalla niitä tiedostolistauksessa",
135
+ "Upload not available": "Lähettäminen ei ole mahdollista",
136
+ "Cut": "Leikkaa",
137
+ "n_items": "{n,plural, one{# tiedosto / hakemisto leikepöydällä} other{# tiedostoa / hakemistoa leikepöydällä}}",
138
+ "good_bad": "{good} siirretty, {bad} epäonnistui",
139
+ "after_cut": "Valintasi on nyt leikepöydällä.\nMene kohdekansioon liittääksesi.",
140
+ "Cancel clipboard": "Sulje leikepöytä",
141
+ "to_clipboard_source": "Takaisin lähdekansioon",
142
+ "Paste": "Liitä",
143
+ "clipboard_list": "Kohteet leikepöydällä:"
130
144
  }
131
145
  }
@@ -141,6 +141,10 @@
141
141
  "Shuffle": "Riproduzione casuale",
142
142
  "Repeat": "Ripeti a fine lista",
143
143
  "showHelpListShortcut": "Dalla lista dei file, clicca tenendo {key} per accedere velocemente al File Show",
144
- "Invalid value": "Valore non valido"
144
+ "Invalid value": "Valore non valido",
145
+ "upload_skipped": "{n,plural, one{# saltato} other{# saltati}}",
146
+ "Overwrite policy": "Per i file esistenti",
147
+ "Rename to avoid overwriting": "Rinomina per non sovrascrivere",
148
+ "Overwrite existing files": "Sovrascrivi i file esistenti"
145
149
  }
146
150
  }
package/src/listen.js CHANGED
@@ -58,11 +58,12 @@ function getHttpsWorkingPort() {
58
58
  return (httpsSrv === null || httpsSrv === void 0 ? void 0 : httpsSrv.listening) && ((_a = httpsSrv.address()) === null || _a === void 0 ? void 0 : _a.port);
59
59
  }
60
60
  exports.getHttpsWorkingPort = getHttpsWorkingPort;
61
- const commonOptions = { requestTimeout: 0 };
61
+ const commonServerOptions = { requestTimeout: 0 };
62
+ const commonServerAssign = { headersTimeout: 30000, timeout: misc_1.MINUTE }; // 'headersTimeout' is not recognized by type lib, and 'timeout' is not effective when passed in parameters
62
63
  const considerHttp = (0, misc_1.debounceAsync)(async () => {
63
64
  await (0, misc_1.waitFor)(() => index_1.app);
64
65
  stopServer(httpSrv).then();
65
- httpSrv = Object.assign(http.createServer(commonOptions, index_1.app.callback()), { name: 'http' });
66
+ httpSrv = Object.assign(http.createServer(commonServerOptions, index_1.app.callback()), { name: 'http' }, commonServerAssign);
66
67
  const port = await startServer(httpSrv, { port: exports.portCfg.get(), host: listenInterface.get() });
67
68
  if (!port)
68
69
  return;
@@ -110,7 +111,7 @@ const considerHttps = (0, misc_1.debounceAsync)(async () => {
110
111
  let port = exports.httpsPortCfg.get();
111
112
  try {
112
113
  await (0, misc_1.waitFor)(() => index_1.app);
113
- httpsSrv = Object.assign(https.createServer(port === const_1.PORT_DISABLED ? {} : { ...commonOptions, key: httpsOptions.private_key, cert: httpsOptions.cert }, index_1.app.callback()), { name: 'https' });
114
+ httpsSrv = Object.assign(https.createServer(port === const_1.PORT_DISABLED ? {} : { ...commonServerOptions, key: httpsOptions.private_key, cert: httpsOptions.cert }, index_1.app.callback()), { name: 'https' }, commonServerAssign);
114
115
  if (port >= 0) {
115
116
  const cert = getCertObject();
116
117
  if (cert) {
package/src/log.js CHANGED
@@ -158,12 +158,21 @@ function doubleDigit(n) {
158
158
  return n > 9 ? n : '0' + n;
159
159
  }
160
160
  // dump console.error to file
161
- const debugLogFile = (0, fs_1.createWriteStream)('debug.log', { flags: 'a' });
162
- debugLogFile.on('open', () => {
161
+ let debugLogFile = (0, fs_1.createWriteStream)('debug.log', { flags: 'a' });
162
+ debugLogFile.once('open', () => {
163
163
  const was = console.error;
164
164
  console.error = function (...args) {
165
165
  was.apply(this, args);
166
166
  args = args.map(x => { var _a; return typeof x === 'string' ? x : ((_a = (0, misc_1.tryJson)(x)) !== null && _a !== void 0 ? _a : String(x)); });
167
167
  debugLogFile.write(new Date().toLocaleString() + ': ' + args.join(' ') + '\n');
168
168
  };
169
+ // limit log size
170
+ const LIMIT = 1000000;
171
+ const { path } = debugLogFile;
172
+ (0, misc_1.repeat)(misc_1.DAY, () => {
173
+ if ((0, fs_1.statSync)(path).size < LIMIT)
174
+ return; // no need
175
+ (0, fs_1.renameSync)(path, 'old-' + path);
176
+ debugLogFile = (0, fs_1.createWriteStream)(path, { flags: 'w' }); // new file
177
+ });
169
178
  }).on('error', () => console.log("cannot create debug.log"));
@@ -75,8 +75,8 @@ const someSecurity = async (ctx, next) => {
75
75
  catch (_a) {
76
76
  return ctx.status = const_1.HTTP_FOOL;
77
77
  }
78
- if (!ctx.state.skipFilters && forceBaseUrl.get() && !(0, misc_1.isLocalHost)(ctx) && ctx.host !== listen_1.baseUrl.compiled())
79
- return (0, connections_1.disconnect)(ctx);
78
+ if (!ctx.state.skipFilters && forceBaseUrl.get() && listen_1.baseUrl.compiled() && !(0, misc_1.isLocalHost)(ctx) && ctx.host !== listen_1.baseUrl.compiled())
79
+ return (0, connections_1.disconnect)(ctx, 'force-domain');
80
80
  if (!ctx.secure && forceHttps.get() && (0, listen_1.getHttpsWorkingPort)() && !(0, misc_1.isLocalHost)(ctx)) {
81
81
  const { URL } = ctx;
82
82
  URL.protocol = 'https';
package/src/misc.js CHANGED
@@ -50,7 +50,8 @@ function onFirstEvent(emitter, events, cb) {
50
50
  }
51
51
  exports.onFirstEvent = onFirstEvent;
52
52
  function pattern2filter(pattern) {
53
- const matcher = (0, cross_1.makeMatcher)(pattern.includes('*') ? pattern : `*${pattern}*`); // if you specify *, we'll respect its position
53
+ const matcher = (0, cross_1.makeMatcher)(pattern.includes('*') ? pattern // if you specify *, we'll respect its position
54
+ : pattern.split('|').map(x => `*${x}*`).join('|'));
54
55
  return (s) => !s || !pattern || matcher((0, path_1.basename)(s));
55
56
  }
56
57
  exports.pattern2filter = pattern2filter;
package/src/roots.js CHANGED
@@ -41,7 +41,7 @@ const rootsMiddleware = (ctx, next) => (() => {
41
41
  if (root === undefined) {
42
42
  if (ctx.state.skipFilters || !rootsMandatory.get() || (0, misc_1.isLocalHost)(ctx))
43
43
  return;
44
- (0, connections_1.disconnect)(ctx);
44
+ (0, connections_1.disconnect)(ctx, 'no-root');
45
45
  return true; // true will avoid calling next
46
46
  }
47
47
  if (!params) {
@@ -42,6 +42,7 @@ const customHtml_1 = require("./customHtml");
42
42
  const lodash_1 = __importDefault(require("lodash"));
43
43
  const config_1 = require("./config");
44
44
  const lang_1 = require("./lang");
45
+ const upload_1 = require("./upload");
45
46
  exports.logGui = (0, config_1.defineConfig)(misc_1.CFG.log_gui, false);
46
47
  lodash_1.default.each(misc_1.FRONTEND_OPTIONS, (v, k) => (0, config_1.defineConfig)(k, v)); // define default values
47
48
  // in case of dev env we have our static files within the 'dist' folder'
@@ -118,6 +119,7 @@ async function treatIndex(ctx, filesUri, body) {
118
119
  session: session instanceof apiMiddleware_1.ApiError ? null : session,
119
120
  plugins,
120
121
  prefixUrl: ctx.state.revProxyPath,
122
+ dontOverwriteUploading: upload_1.dontOverwriteUploading.get(),
121
123
  customHtml: lodash_1.default.omit(Object.fromEntries(customHtml_1.customHtmlState.sections), ['top', 'bottom']),
122
124
  ...(0, misc_1.newObj)(misc_1.FRONTEND_OPTIONS, (v, k) => (0, config_1.getConfig)(k)),
123
125
  lang
package/src/upload.js CHANGED
@@ -52,7 +52,7 @@ function uploadWriter(base, path, ctx) {
52
52
  catch (e) { // warn, but let it through
53
53
  console.warn("can't check disk size:", e.message || String(e));
54
54
  }
55
- if (ctx.query.skipExisting && fs_1.default.existsSync(fullPath))
55
+ if (ctx.query.existing === 'skip' && fs_1.default.existsSync(fullPath))
56
56
  return fail(const_1.HTTP_CONFLICT);
57
57
  if (fs_1.default.mkdirSync(dir, { recursive: true }))
58
58
  setUploadMeta(dir, ctx);
@@ -116,7 +116,8 @@ function uploadWriter(base, path, ctx) {
116
116
  });
117
117
  return ret;
118
118
  async function overwriteAnyway() {
119
- if (ctx.query.overwrite === undefined)
119
+ if (ctx.query.overwrite === undefined // legacy pre-0.52
120
+ || ctx.query.existing === 'overwrite')
120
121
  return;
121
122
  const n = await (0, vfs_1.getNodeByName)(path, base);
122
123
  return n && (0, vfs_1.hasPermission)(n, 'can_delete', ctx);
package/src/util-files.js CHANGED
@@ -182,7 +182,7 @@ function createFileWithPath(path, options) {
182
182
  }
183
183
  exports.createFileWithPath = createFileWithPath;
184
184
  function isValidFileName(name) {
185
- return !/^\.\.?$|[/:*?"<>|\\]/.test(name) && !dirTraversal(name);
185
+ return !/[/*?<>|\\]/.test(name) && !dirTraversal(name);
186
186
  }
187
187
  exports.isValidFileName = isValidFileName;
188
188
  const FILE_ATTR_PREFIX = 'user.hfs.'; // user. prefix to be linux compatible
package/src/vfs.js CHANGED
@@ -288,8 +288,9 @@ function masksCouldGivePermission(masks, perm) {
288
288
  }
289
289
  exports.masksCouldGivePermission = masksCouldGivePermission;
290
290
  function parentMaskApplier(parent) {
291
- const matchers = (0, misc_1.onlyTruthy)(Object.entries(parent.masks || {}).map(([k, { maskOnly, ...mods }]) => {
291
+ const matchers = (0, misc_1.onlyTruthy)(lodash_1.default.map(parent.masks, (v, k) => {
292
292
  k = k.startsWith('**/') ? k.slice(3) : !k.includes('/') ? k : ''; // ** globstar matches also zero subfolders, so this mask must be applied here too
293
+ const { maskOnly, ...mods } = v || {};
293
294
  // k is stored into the object for debugging purposes
294
295
  return k && { k, mods, matcher: (0, misc_1.makeMatcher)(k), mustBeFolder: maskOnly && (maskOnly === 'folders') };
295
296
  }));