mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add norwegian translation
This commit is contained in:
parent
49e962a7dc
commit
187feee0c1
|
@ -563,6 +563,7 @@ def run_argparse(argv, formatter):
|
|||
ap2.add_argument("-mtp", metavar="M=[f,]BIN", type=u, action="append", help="read tag M using program BIN to parse the file")
|
||||
|
||||
ap2 = ap.add_argument_group('ui options')
|
||||
ap2.add_argument("--lang", metavar="LANG", type=u, default="eng", help="language")
|
||||
ap2.add_argument("--theme", metavar="NUM", type=int, default=0, help="default theme to use")
|
||||
ap2.add_argument("--themes", metavar="NUM", type=int, default=6, help="number of themes installed")
|
||||
ap2.add_argument("--js-browser", metavar="L", type=u, help="URL to additional JS to include")
|
||||
|
|
|
@ -2252,6 +2252,7 @@ class HttpCli(object):
|
|||
"readme": readme,
|
||||
"title": html_escape(self.vpath, crlf=True),
|
||||
"srv_info": srv_info,
|
||||
"lang": self.args.lang,
|
||||
"dtheme": self.args.theme,
|
||||
"themes": self.args.themes,
|
||||
"turbolvl": self.args.turbo,
|
||||
|
|
|
@ -1839,27 +1839,29 @@ html.y #bbox-overlay figcaption a {
|
|||
position: absolute;
|
||||
top: 40%;
|
||||
top: calc(50% - .5em);
|
||||
top: calc(50% - 1.2vw);
|
||||
left: -.8em;
|
||||
transition: top 0.12s;
|
||||
}
|
||||
.dropdesc>div>div+div {
|
||||
left: auto;
|
||||
right: -.8em;
|
||||
}
|
||||
.dropdesc b {
|
||||
position: relative;
|
||||
font-size: .5em;
|
||||
font-size: 2vw;
|
||||
top: -.25em;
|
||||
top: -.2vw;
|
||||
margin: 0 .8em;
|
||||
margin: 0 1.25vw;
|
||||
transition: font-size 0.12s;
|
||||
}
|
||||
.dropdesc.hl b {
|
||||
.dropdesc.hl.ok b {
|
||||
border-bottom: .1em solid #fff;
|
||||
font-size: .6em;
|
||||
font-size: 2.5vw;
|
||||
}
|
||||
.dropdesc.hl.ok>div>div {
|
||||
top: calc(50% - 1.7vw);
|
||||
}
|
||||
.dropzone {
|
||||
z-index: 80386;
|
||||
height: 50%;
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<div id="op_cfg" class="opview opbox opwide"></div>
|
||||
|
||||
<h1 id="path">
|
||||
<a href="#" id="entree" tt="show navpane (directory tree sidebar)$NHotkey: B">🌲</a>
|
||||
<a href="#" id="entree">🌲</a>
|
||||
{%- for n in vpnodes %}
|
||||
<a href="/{{ n[0] }}">{{ n[1] }}</a>
|
||||
{%- endfor %}
|
||||
|
@ -120,7 +120,7 @@
|
|||
|
||||
<div id="epi" class="logue">{{ logues[1] }}</div>
|
||||
|
||||
<h2><a href="/?h">control-panel</a></h2>
|
||||
<h2><a href="/?h" id="goh">control-panel</a></h2>
|
||||
|
||||
<a href="#" id="repl">π</a>
|
||||
|
||||
|
@ -138,6 +138,7 @@
|
|||
themes = {{ themes }},
|
||||
dtheme = "{{ dtheme }}",
|
||||
srvinf = "{{ srv_info }}",
|
||||
lang = "{{ lang }}",
|
||||
def_hcols = {{ def_hcols|tojson }},
|
||||
have_up2k_idx = {{ have_up2k_idx|tojson }},
|
||||
have_tags_idx = {{ have_tags_idx|tojson }},
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -75,6 +75,9 @@ html {
|
|||
margin-right: -1.2em;
|
||||
padding-right: .7em;
|
||||
}
|
||||
#toast.r #toastb {
|
||||
text-align: right;
|
||||
}
|
||||
#toast pre {
|
||||
margin: 0;
|
||||
}
|
||||
|
|
|
@ -592,14 +592,7 @@ function up2k_init(subtle) {
|
|||
ebi('u2notbtn').innerHTML = '';
|
||||
}
|
||||
|
||||
var suggest_up2k = 'this is the basic uploader; <a href="#" id="u2yea">up2k</a> is better';
|
||||
|
||||
var shame = 'your browser <a href="https://www.chromium.org/blink/webcrypto">disables sha512</a> unless you <a href="' + (window.location + '').replace(':', 's:') + '">use https</a>',
|
||||
is_https = (window.location + '').indexOf('https:') === 0;
|
||||
|
||||
if (is_https)
|
||||
// chrome<37 firefox<34 edge<12 opera<24 safari<7
|
||||
shame = 'your browser is impressively ancient';
|
||||
var suggest_up2k = L.u_su2k;
|
||||
|
||||
function got_deps() {
|
||||
return subtle || window.asmCrypto || window.hashwasm;
|
||||
|
@ -608,15 +601,18 @@ function up2k_init(subtle) {
|
|||
var loading_deps = false;
|
||||
function init_deps() {
|
||||
if (!loading_deps && !got_deps()) {
|
||||
var fn = 'sha512.' + sha_js + '.js';
|
||||
showmodal('<h1>loading ' + fn + '</h1><h2>since ' + shame + '</h2><h4>thanks chrome</h4>');
|
||||
var fn = 'sha512.' + sha_js + '.js',
|
||||
m = L.u_https1 + ' <a href="' + (window.location + '').replace(':', 's:') + '">' + L.u_https2 + '</a> ' + L.u_https3;
|
||||
|
||||
showmodal('<h1>loading ' + fn + '</h1>');
|
||||
import_js('/.cpr/deps/' + fn, unmodal);
|
||||
|
||||
if (is_https)
|
||||
ebi('u2foot').innerHTML = shame + ' so <em>this</em> uploader will do like 500 KiB/s at best';
|
||||
else
|
||||
ebi('u2foot').innerHTML = 'seems like ' + shame + ' so do that if you want more performance <span style="color:#' +
|
||||
(sha_js == 'ac' ? 'c84">(expecting 20' : '8a5">(but dont worry too much, expect 100') + ' MiB/s)</span>';
|
||||
if (is_https) {
|
||||
// chrome<37 firefox<34 edge<12 opera<24 safari<7
|
||||
m = L.u_ancient;
|
||||
setmsg('');
|
||||
}
|
||||
ebi('u2foot').innerHTML = '<big>' + m + '</big>';
|
||||
}
|
||||
loading_deps = true;
|
||||
}
|
||||
|
@ -648,16 +644,6 @@ function up2k_init(subtle) {
|
|||
|
||||
setmsg(suggest_up2k, 'msg');
|
||||
|
||||
if (!String.prototype.format) {
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/{(\d+)}/g, function (match, number) {
|
||||
return typeof args[number] != 'undefined' ?
|
||||
args[number] : match;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var parallel_uploads = icfg_get('nthread'),
|
||||
uc = {},
|
||||
fdom_ctr = 0,
|
||||
|
@ -715,7 +701,7 @@ function up2k_init(subtle) {
|
|||
bobslice = File.prototype.slice || File.prototype.mozSlice || File.prototype.webkitSlice;
|
||||
|
||||
if (!bobslice || !window.FileReader || !window.FileList)
|
||||
return un2k("this is the basic uploader; up2k needs at least<br />chrome 21 // firefox 13 // edge 12 // opera 12 // safari 5.1");
|
||||
return un2k(L.u_ever);
|
||||
|
||||
var flag = false;
|
||||
apply_flag_cfg();
|
||||
|
@ -737,14 +723,14 @@ function up2k_init(subtle) {
|
|||
var mup, up = QS('#up_zd');
|
||||
var msr, sr = QS('#srch_zd');
|
||||
if (!has(perms, 'write'))
|
||||
mup = 'you do not have write-access to this folder';
|
||||
mup = L.u_ewrite;
|
||||
if (!has(perms, 'read'))
|
||||
msr = 'you do not have read-access to this folder';
|
||||
msr = L.u_eread;
|
||||
if (!have_up2k_idx)
|
||||
msr = 'file-search is not enabled in server config';
|
||||
msr = L.u_enoi;
|
||||
|
||||
up.querySelector('span').textContent = mup || 'drop it here';
|
||||
sr.querySelector('span').textContent = msr || 'drop it here';
|
||||
up.querySelector('span').textContent = mup || L.udt_drop;
|
||||
sr.querySelector('span').textContent = msr || L.udt_drop;
|
||||
clmod(up, 'err', mup);
|
||||
clmod(sr, 'err', msr);
|
||||
clmod(up, 'ok', !mup);
|
||||
|
@ -970,22 +956,22 @@ function up2k_init(subtle) {
|
|||
function gotallfiles(good_files, nil_files, bad_files) {
|
||||
var ntot = good_files.concat(nil_files, bad_files).length;
|
||||
if (bad_files.length) {
|
||||
var msg = 'These {0} files (of {1} total) were skipped, possibly due to filesystem permissions:\n'.format(bad_files.length, ntot);
|
||||
var msg = L.u_badf.format(bad_files.length, ntot);
|
||||
for (var a = 0, aa = Math.min(20, bad_files.length); a < aa; a++)
|
||||
msg += '-- ' + bad_files[a][1] + '\n';
|
||||
|
||||
msg += '\nMaybe it works better if you select just one file';
|
||||
msg += L.u_just1;
|
||||
return modal.alert(msg, function () {
|
||||
gotallfiles(good_files, nil_files, []);
|
||||
});
|
||||
}
|
||||
|
||||
if (nil_files.length) {
|
||||
var msg = 'These {0} files (of {1} total) are blank/empty; upload them anyways?\n'.format(nil_files.length, ntot);
|
||||
var msg = L.u_blankf.format(nil_files.length, ntot);
|
||||
for (var a = 0, aa = Math.min(20, nil_files.length); a < aa; a++)
|
||||
msg += '-- ' + nil_files[a][1] + '\n';
|
||||
|
||||
msg += '\nMaybe it works better if you select just one file';
|
||||
msg += L.u_just1;
|
||||
return modal.confirm(msg, function () {
|
||||
gotallfiles(good_files.concat(nil_files), [], []);
|
||||
}, function () {
|
||||
|
@ -999,7 +985,7 @@ function up2k_init(subtle) {
|
|||
return a < b ? -1 : a > b ? 1 : 0;
|
||||
});
|
||||
|
||||
var msg = ['{0} these {1} files?<ul>'.format(uc.fsearch ? 'search' : 'upload', good_files.length)];
|
||||
var msg = [(uc.fsearch ? L.u_asks : L.u_asku).format(good_files.length) + '<ul>'];
|
||||
for (var a = 0, aa = Math.min(20, good_files.length); a < aa; a++)
|
||||
msg.push('<li>' + esc(good_files[a][1]) + '</li>');
|
||||
|
||||
|
@ -1056,7 +1042,7 @@ function up2k_init(subtle) {
|
|||
pvis.addfile([
|
||||
uc.fsearch ? esc(entry.name) : linksplit(
|
||||
entry.purl + uricom_enc(entry.name)).join(' '),
|
||||
'📐 hash',
|
||||
'📐 ' + L.u_hashing,
|
||||
''
|
||||
], fobj.size, draw_each);
|
||||
|
||||
|
@ -1104,11 +1090,11 @@ function up2k_init(subtle) {
|
|||
}
|
||||
|
||||
if (!nhash)
|
||||
ebi('u2etah').innerHTML = 'Done ({0}, {1} files)'.format(humansize(st.bytes.hashed), pvis.ctr["ok"] + pvis.ctr["ng"]);
|
||||
ebi('u2etah').innerHTML = L.u_etadone.format(humansize(st.bytes.hashed), pvis.ctr["ok"] + pvis.ctr["ng"]);
|
||||
|
||||
if (!nsend && !nhash)
|
||||
ebi('u2etau').innerHTML = ebi('u2etat').innerHTML = (
|
||||
'Done ({0}, {1} files)'.format(humansize(st.bytes.uploaded), pvis.ctr["ok"] + pvis.ctr["ng"]));
|
||||
L.u_etadone.format(humansize(st.bytes.uploaded), pvis.ctr["ok"] + pvis.ctr["ng"]));
|
||||
|
||||
if (!st.busy.hash.length && !hashing_permitted())
|
||||
nhash = 0;
|
||||
|
@ -1129,7 +1115,7 @@ function up2k_init(subtle) {
|
|||
}
|
||||
if ((nhash || nsend) && !uc.fsearch) {
|
||||
if (!st.bytes.finished) {
|
||||
ebi('u2etat').innerHTML = '(preparing to upload)';
|
||||
ebi('u2etat').innerHTML = L.u_etaprep;
|
||||
}
|
||||
else {
|
||||
st.time.busy += td;
|
||||
|
@ -1142,7 +1128,7 @@ function up2k_init(subtle) {
|
|||
eta = Math.floor(rem / bps);
|
||||
|
||||
if (t[a][1] < 1024 || t[a][3] < 0.1) {
|
||||
ebi(t[a][0]).innerHTML = '(preparing to upload)';
|
||||
ebi(t[a][0]).innerHTML = L.u_etaprep;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1530,7 +1516,7 @@ function up2k_init(subtle) {
|
|||
|
||||
t.t_hashed = Date.now();
|
||||
|
||||
pvis.seth(t.n, 2, 'hashing done');
|
||||
pvis.seth(t.n, 2, L.u_hashdone);
|
||||
pvis.seth(t.n, 1, '📦 wait');
|
||||
apop(st.busy.hash, t);
|
||||
st.todo.handshake.push(t);
|
||||
|
@ -1734,7 +1720,7 @@ function up2k_init(subtle) {
|
|||
'npart': t.postlist[a]
|
||||
});
|
||||
|
||||
msg = 'uploading';
|
||||
msg = L.u_upping;
|
||||
done = false;
|
||||
|
||||
if (sort)
|
||||
|
@ -1811,8 +1797,8 @@ function up2k_init(subtle) {
|
|||
tasker();
|
||||
return;
|
||||
}
|
||||
err = t.t_uploading ? "finalize upload" : t.srch ? "perform search" : "initiate upload";
|
||||
xhrchk(xhr, "server rejected the request to " + err + ";\n\nfile: " + t.name + "\n\nerror ", "404, target folder not found");
|
||||
err = t.t_uploading ? L.u_ehsfin : t.srch ? L.u_ehssrch : L.u_ehsinit;
|
||||
xhrchk(xhr, err + ";\n\nfile: " + t.name + "\n\nerror ", "404, target folder not found");
|
||||
}
|
||||
}
|
||||
xhr.onload = function (e) {
|
||||
|
@ -1871,7 +1857,7 @@ function up2k_init(subtle) {
|
|||
console.log("ignoring dupe-segment error", t);
|
||||
}
|
||||
else {
|
||||
xhrchk(xhr, "server rejected upload (chunk {0} of {1});\n\nfile: {2}\n\nerror ".format(npart, Math.ceil(t.size / chunksize), t.name), "404, target folder not found (???)");
|
||||
xhrchk(xhr, L.u_cuerr2.format(npart, Math.ceil(t.size / chunksize), t.name), "404, target folder not found (???)");
|
||||
|
||||
chill(t);
|
||||
}
|
||||
|
@ -1900,7 +1886,7 @@ function up2k_init(subtle) {
|
|||
return;
|
||||
|
||||
if (!toast.visible)
|
||||
toast.warn(9.98, "failed to upload chunk {0} of {1};\nprobably harmless, continuing\n\nfile: {2}".format(npart, Math.ceil(t.size / chunksize), t.name));
|
||||
toast.warn(9.98, L.u_cuerr.format(npart, Math.ceil(t.size / chunksize), t.name));
|
||||
|
||||
console.log('chunkpit onerror,', ++tries, t);
|
||||
orz2(xhr);
|
||||
|
@ -2062,7 +2048,7 @@ function up2k_init(subtle) {
|
|||
|
||||
try {
|
||||
var ico = uc.fsearch ? '🔎' : '🚀',
|
||||
desc = uc.fsearch ? 'S E A R C H' : 'U P L O A D';
|
||||
desc = uc.fsearch ? L.ul_btns : L.ul_btnu;
|
||||
|
||||
clmod(ebi('op_up2k'), 'srch', uc.fsearch);
|
||||
ebi('u2bm').innerHTML = ico + ' <sup>' + desc + '</sup>';
|
||||
|
|
|
@ -7,6 +7,7 @@ if (!window['console'])
|
|||
|
||||
|
||||
var is_touch = 'ontouchstart' in window,
|
||||
is_https = (window.location + '').indexOf('https:') === 0,
|
||||
IPHONE = is_touch && /iPhone|iPad|iPod/i.test(navigator.userAgent),
|
||||
WINDOWS = navigator.platform ? navigator.platform == 'Win32' : /Windows/.test(navigator.userAgent);
|
||||
|
||||
|
@ -253,6 +254,14 @@ if (!Element.prototype.closest)
|
|||
} while (el !== null && el.nodeType === 1);
|
||||
};
|
||||
|
||||
if (!String.prototype.format)
|
||||
String.prototype.format = function () {
|
||||
var args = arguments;
|
||||
return this.replace(/{(\d+)}/g, function (match, number) {
|
||||
return typeof args[number] != 'undefined' ?
|
||||
args[number] : match;
|
||||
});
|
||||
};
|
||||
|
||||
// https://stackoverflow.com/a/950146
|
||||
function import_js(url, cb) {
|
||||
|
@ -1397,7 +1406,7 @@ function xhrchk(xhr, prefix, e404) {
|
|||
return true;
|
||||
|
||||
if (xhr.status == 403)
|
||||
return toast.err(0, prefix + "403, access denied\n\ntry pressing F5, maybe you got logged out");
|
||||
return toast.err(0, prefix + (window.L && L.xhr403 || "403: access denied\n\ntry pressing F5, maybe you got logged out"));
|
||||
|
||||
if (xhr.status == 404)
|
||||
return toast.err(0, prefix + e404);
|
||||
|
|
|
@ -14,6 +14,9 @@ help() { exec cat <<'EOF'
|
|||
#
|
||||
# `gz` creates a gzip-compressed python sfx instead of bzip2
|
||||
#
|
||||
# `lang` limits which languages/translations to include,
|
||||
# for example `lang eng` or `lang eng|nor`
|
||||
#
|
||||
# `no-cm` saves ~82k by removing easymde/codemirror
|
||||
# (the fancy markdown editor)
|
||||
#
|
||||
|
@ -61,6 +64,7 @@ pybin=$(command -v python3 || command -v python) || {
|
|||
exit 1
|
||||
}
|
||||
|
||||
langs=
|
||||
use_gz=
|
||||
zopf=2560
|
||||
while [ ! -z "$1" ]; do
|
||||
|
@ -73,6 +77,7 @@ while [ ! -z "$1" ]; do
|
|||
no-dd) no_dd=1 ; ;;
|
||||
no-cm) no_cm=1 ; ;;
|
||||
fast) zopf=100 ; ;;
|
||||
lang) shift;langs="$1"; ;;
|
||||
*) help ; ;;
|
||||
esac
|
||||
shift
|
||||
|
@ -262,6 +267,13 @@ rm have
|
|||
tmv "$f"
|
||||
}
|
||||
|
||||
[ $langs ] && {
|
||||
f=copyparty/web/browser.js
|
||||
gzip -d "$f.gz" || true
|
||||
awk '/^\}/{l=0} !l; /^var Ls =/{l=1;next} o; /^\t["}]/{o=0} /^\t"'"$langs"'"/{o=1;print}' <$f >t
|
||||
tmv "$f"
|
||||
}
|
||||
|
||||
[ $repack ] ||
|
||||
find | grep -E '\.py$' |
|
||||
grep -vE '__version__' |
|
||||
|
|
Loading…
Reference in a new issue