diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index f152b152..fb07a5ae 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -204,6 +204,8 @@ var Ls = { "cut_datechk": "has no effect unless the turbo button is enabled$N$Nreduces the yolo factor by a tiny amount; checks whether the file timestamps on the server matches yours$N$Nshould theoretically catch most unfinished / corrupted uploads, but is not a substitute for doing a verification pass with turbo disabled afterwards", + "cut_appl": "skip uploading apple/macos metadata files$Nsuch as __MACOSX, .DS_Store, .fseventsd", + "cut_flag": "ensure only one tab is uploading at a time $N -- other tabs must have this enabled too $N -- only affects tabs on the same domain", "cut_az": "upload files in alphabetical order, rather than smallest-file-first$N$Nalphabetical order can make it easier to eyeball if something went wrong on the server, but it makes uploading slightly slower on fiber / LAN", @@ -428,6 +430,7 @@ var Ls = { "u_enoi": 'file-search is not enabled in server config', "u_badf": 'These {0} files (of {1} total) were skipped, possibly due to filesystem permissions:\n\n', "u_blankf": 'These {0} files (of {1} total) are blank / empty; upload them anyways?\n\n', + "u_applef": 'Because the apple/macos filter is enabled ("up2k switches" in settings),\nsome files ({0} out of {1} in total) will be excluded / skipped.\n\nPress OK/Enter to SKIP the following files,\nPress Cancel/ESC to NOT exclude, and UPLOAD those as well:\n\n', "u_just1": '\nMaybe it works better if you select just one file', "u_ff_many": "This amount of files may cause Firefox to skip some files, or crash.\nPlease try again with fewer files (or use Chrome) if that happens.", "u_up_life": "This upload will be deleted from the server\n{0} after it completes", @@ -684,6 +687,8 @@ var Ls = { "cut_datechk": "har ingen effekt dersom turbo er avslått$N$Ngjør turbo bittelitt tryggere ved å sjekke datostemplingen på filene (i tillegg til filstørrelse)$N$Nburde oppdage og gjenoppta de fleste ufullstendige opplastninger, men er ikke en fullverdig erstatning for å deaktivere turbo og gjøre en skikkelig sjekk", + "cut_appl": "filtrer vekk apple/macos tilleggsfiler før opplastning,$Nf.eks. __MACOSX, .DS_Store, .fseventsd", + "cut_flag": "samkjører nettleserfaner slik at bare én $N kan holde på med befaring / opplastning $N -- andre faner må også ha denne skrudd på $N -- fungerer kun innenfor samme domene", "cut_az": "last opp filer i alfabetisk rekkefølge, istedenfor minste-fil-først$N$Nalfabetisk kan gjøre det lettere å anslå om alt gikk bra, men er bittelitt tregere på fiber / LAN", @@ -908,6 +913,7 @@ var Ls = { "u_enoi": 'filsøk er deaktivert i serverkonfigurasjonen', "u_badf": 'Disse {0} filene (av totalt {1}) kan ikke leses, kanskje pga rettighetsproblemer i filsystemet på datamaskinen din:\n\n', "u_blankf": 'Disse {0} filene (av totalt {1}) er blanke / uten innhold; ønsker du å laste dem opp uansett?\n\n', + "u_applef": 'Fordi apple/macos-filteret er aktivert (eple-knappen i innstillinger),\nså er følgende {0} (av totalt {1}) filer anbefalt ekskludert.\n\nTrykk OK/Enter for å HOPPE OVER disse filene,\nTrykk Avbryt/ESC for å LASTE OPP disse filene også:\n\n', "u_just1": '\nFunker kanskje bedre hvis du bare tar én fil om gangen', "u_ff_many": "Det var mange filer! Mulig at Firefox kommer til å krasje, eller\nhoppe over et par av dem. Smart å ha Chrome på lur i tilfelle.", "u_up_life": "Filene slettes fra serveren {0}\netter at opplastningen er fullført", @@ -1180,6 +1186,7 @@ ebi('op_cfg').innerHTML = ( ' mt\n' + ' turbo\n' + ' date-chk\n' + + ' 🍎\n' + ' 💤\n' + ' az\n' + ' 🔔\n' + diff --git a/copyparty/web/up2k.js b/copyparty/web/up2k.js index 1e43e074..17c66345 100644 --- a/copyparty/web/up2k.js +++ b/copyparty/web/up2k.js @@ -867,6 +867,7 @@ function up2k_init(subtle) { bcfg_bind(uc, 'flag_en', 'flag_en', false, apply_flag_cfg); bcfg_bind(uc, 'turbo', 'u2turbo', turbolvl > 1, draw_turbo); bcfg_bind(uc, 'datechk', 'u2tdate', turbolvl < 3, null); + bcfg_bind(uc, 'appl', 'u2appl', true, null); bcfg_bind(uc, 'az', 'u2sort', u2sort.indexOf('n') + 1, set_u2sort); bcfg_bind(uc, 'hashw', 'hashw', !!window.WebAssembly && (!subtle || !CHROME || MOBILE || VCHROME >= 107), set_hashw); bcfg_bind(uc, 'upnag', 'upnag', false, set_upnag); @@ -1310,6 +1311,45 @@ function up2k_init(subtle) { }); } + applefilter(good_files); + } + + function applefilter(good_files) { + if (!uc.appl) + return gotallfiles2(good_files); + + var junk = [], rmi = []; + for (var a = 0; a < good_files.length; a++) { + if (/\/(__MACOS|Icon\r\r)|\/\.(_|DS_Store|AppleDouble|LSOverride|DocumentRevisions-|fseventsd|Spotlight-|TemporaryItems|Trashes|VolumeIcon\.icns|com\.apple\.timemachine\.donotpresent|AppleDB|AppleDesktop|apdisk)/.exec(good_files[a][1])) { + junk.push(good_files[a]); + rmi.push(a); + } + } + + if (!junk.length) + return gotallfiles2(good_files); + + // todo: if there's hits so far, start looking for appledoubles + // (files named ._foo where foo is another file in the list) + // and get rid of those too + + var msg = L.u_applef.format(junk.length, good_files.length); + for (var a = 0, aa = Math.min(20, junk.length); a < aa; a++) + msg += '-- ' + junk[a][1] + '\n'; + + return modal.confirm(msg, function () { + for (var a = rmi.length - 1; a >= 0; a--) + good_files.splice(rmi[a], 1); + + start_actx(); + gotallfiles2(good_files); + }, function () { + start_actx(); + gotallfiles2(good_files); + }); + } + + function gotallfiles2(good_files) { good_files.sort(function (a, b) { a = a[1]; b = b[1];