filter appledoubles from uploads

should catch all the garbage that macs sprinkle onto flashdrives;
https://a.ocv.me/pub/stuff/?doc=appledoubles-and-friends.txt

will notice and suggest to skip the following files/dirs:

* __MACOSX
* .DS_Store
* .AppleDouble
* .LSOverride
* .DocumentRevisions-*
* .fseventsd
* .Spotlight-V*
* .TemporaryItems
* .Trashes
* .VolumeIcon.icns
* .com.apple.timemachine.donotpresent
* .AppleDB
* .AppleDesktop
* .apdisk

and conditionally ._foo.jpg if foo.jpg is also being uploaded
This commit is contained in:
ed 2025-03-15 21:16:54 +00:00
parent 494179bd1c
commit 782084056d
3 changed files with 81 additions and 8 deletions

View file

@ -542,6 +542,7 @@ var Ls = {
"u_enoow": "overwrite will not work here; need Delete-permission", "u_enoow": "overwrite will not work here; need Delete-permission",
"u_badf": 'These {0} files (of {1} total) were skipped, possibly due to filesystem permissions:\n\n', "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_blankf": 'These {0} files (of {1} total) are blank / empty; upload them anyways?\n\n',
"u_applef": 'These {0} files (of {1} total) are probably undesirable;\nPress <code>OK/Enter</code> to SKIP the following files,\nPress <code>Cancel/ESC</code> to NOT exclude, and UPLOAD those as well:\n\n',
"u_just1": '\nMaybe it works better if you select just one file', "u_just1": '\nMaybe it works better if you select just one file',
"u_ff_many": "if you're using <b>Linux / MacOS / Android,</b> then this amount of files <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=1790500\" target=\"_blank\"><em>may</em> crash Firefox!</a>\nif that happens, please try again (or use Chrome).", "u_ff_many": "if you're using <b>Linux / MacOS / Android,</b> then this amount of files <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=1790500\" target=\"_blank\"><em>may</em> crash Firefox!</a>\nif that happens, please try again (or use Chrome).",
"u_up_life": "This upload will be deleted from the server\n{0} after it completes", "u_up_life": "This upload will be deleted from the server\n{0} after it completes",
@ -1144,6 +1145,7 @@ var Ls = {
"u_enoow": "kan ikke overskrive filer her (Delete-rettigheten er nødvendig)", "u_enoow": "kan ikke overskrive filer her (Delete-rettigheten er nødvendig)",
"u_badf": 'Disse {0} filene (av totalt {1}) kan ikke leses, kanskje pga rettighetsproblemer i filsystemet på datamaskinen din:\n\n', "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_blankf": 'Disse {0} filene (av totalt {1}) er blanke / uten innhold; ønsker du å laste dem opp uansett?\n\n',
"u_applef": 'Disse {0} filene (av totalt {1}) er antagelig uønskede;\nTrykk <code>OK/Enter</code> for å HOPPE OVER disse filene,\nTrykk <code>Avbryt/ESC</code> for å LASTE OPP disse filene også:\n\n',
"u_just1": '\nFunker kanskje bedre hvis du bare tar én fil om gangen', "u_just1": '\nFunker kanskje bedre hvis du bare tar én fil om gangen',
"u_ff_many": 'Hvis du bruker <b>Linux / MacOS / Android,</b> så kan dette antallet filer<br /><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1790500" target="_blank"><em>kanskje</em> krasje Firefox!</a> Hvis det skjer, så prøv igjen (eller bruk Chrome).', "u_ff_many": 'Hvis du bruker <b>Linux / MacOS / Android,</b> så kan dette antallet filer<br /><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1790500" target="_blank"><em>kanskje</em> krasje Firefox!</a> Hvis det skjer, så prøv igjen (eller bruk Chrome).',
"u_up_life": "Filene slettes fra serveren {0}\netter at opplastningen er fullført", "u_up_life": "Filene slettes fra serveren {0}\netter at opplastningen er fullført",
@ -1746,6 +1748,7 @@ var Ls = {
"u_enoow": "无法覆盖此处的文件;需要删除权限", //m "u_enoow": "无法覆盖此处的文件;需要删除权限", //m
"u_badf": '这些 {0} 个文件(共 {1} 个)被跳过,可能是由于文件系统权限:\n\n', "u_badf": '这些 {0} 个文件(共 {1} 个)被跳过,可能是由于文件系统权限:\n\n',
"u_blankf": '这些 {0} 个文件(共 {1} 个)是空白的;是否仍然上传?\n\n', "u_blankf": '这些 {0} 个文件(共 {1} 个)是空白的;是否仍然上传?\n\n',
"u_applef": "这些 {0} 个文件(共 {1} 个)可能是不需要的;\n按 <code>确定/Enter</code> 跳过以下文件,\n按 <code>取消/ESC</code> 取消排除,并上传这些文件:\n\n", //m
"u_just1": '\n也许如果你只选择一个文件会更好', "u_just1": '\n也许如果你只选择一个文件会更好',
"u_ff_many": "如果你使用的是 <b>Linux / MacOS / Android</b> 那么这个文件数量 <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=1790500\" target=\"_blank\"><em>可能</em> 崩溃 Firefox!</a>\n如果发生这种情况请再试一次或使用 Chrome。", "u_ff_many": "如果你使用的是 <b>Linux / MacOS / Android</b> 那么这个文件数量 <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=1790500\" target=\"_blank\"><em>可能</em> 崩溃 Firefox!</a>\n如果发生这种情况请再试一次或使用 Chrome。",
"u_up_life": "此上传将在 {0} 后从服务器删除", "u_up_life": "此上传将在 {0} 后从服务器删除",

View file

@ -1343,10 +1343,68 @@ function up2k_init(subtle) {
}); });
} }
var fps = new Set(), pdp = '';
for (var a = 0; a < good_files.length; a++) {
var fp = good_files[a][1],
dp = vsplit(fp)[0];
fps.add(fp);
if (pdp != dp) {
pdp = dp;
dp = dp.slice(0, -1);
while (dp) {
fps.add(dp);
dp = vsplit(dp)[0].slice(0, -1);
}
}
}
var junk = [], rmi = [];
for (var a = 0; a < good_files.length; a++) {
var fn = good_files[a][1];
if (fn.indexOf("/.") < 0 && fn.indexOf("/__MACOS") < 0)
continue;
if (/\/__MACOS|\/\.(DS_Store|AppleDouble|LSOverride|DocumentRevisions-|fseventsd|Spotlight-V[0-9]|TemporaryItems|Trashes|VolumeIcon\.icns|com\.apple\.timemachine\.donotpresent|AppleDB|AppleDesktop|apdisk)/.exec(fn)) {
junk.push(good_files[a]);
rmi.push(a);
continue;
}
if (fn.indexOf("/._") + 1 &&
fps.has(fn.replace("/._", "/")) &&
fn.split("/").pop().startsWith("._") &&
!has(rmi, a)
) {
junk.push(good_files[a]);
rmi.push(a);
}
}
if (!junk.length)
return gotallfiles2(good_files);
junk.sort();
rmi.sort(function (a, b) { return a - b; });
var msg = L.u_applef.format(junk.length, good_files.length);
for (var a = 0, aa = Math.min(1000, junk.length); a < aa; a++)
msg += '-- ' + esc(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) { good_files.sort(function (a, b) {
a = a[1]; return a[1] < b[1] ? -1 : 1;
b = b[1];
return a < b ? -1 : a > b ? 1 : 0;
}); });
var msg = []; var msg = [];
@ -1399,9 +1457,7 @@ function up2k_init(subtle) {
if (!uc.az) if (!uc.az)
good_files.sort(function (a, b) { good_files.sort(function (a, b) {
a = a[0].size; return a[0].size - b[0].size;
b = b[0].size;
return a < b ? -1 : a > b ? 1 : 0;
}); });
for (var a = 0; a < good_files.length; a++) { for (var a = 0; a < good_files.length; a++) {

View file

@ -148,6 +148,7 @@ var tl_browser = {
["U/O", "skip 10sec back/fwd"], ["U/O", "skip 10sec back/fwd"],
["0..9", "jump to 0%..90%"], ["0..9", "jump to 0%..90%"],
["P", "play/pause (also initiates)"], ["P", "play/pause (also initiates)"],
["S", "select playing song"],
["Y", "download song"], ["Y", "download song"],
], [ ], [
"image-viewer", "image-viewer",
@ -156,6 +157,7 @@ var tl_browser = {
["F", "fullscreen"], ["F", "fullscreen"],
["R", "rotate clockwise"], ["R", "rotate clockwise"],
["🡅 R", "rotate ccw"], ["🡅 R", "rotate ccw"],
["S", "select pic"],
["Y", "download pic"], ["Y", "download pic"],
], [ ], [
"video-player", "video-player",
@ -235,7 +237,8 @@ var tl_browser = {
"ul_par": "parallel uploads:", "ul_par": "parallel uploads:",
"ut_rand": "randomize filenames", "ut_rand": "randomize filenames",
"ut_u2ts": "copy the last-modified timestamp$Nfrom your filesystem to the server", "ut_u2ts": "copy the last-modified timestamp$Nfrom your filesystem to the server\">📅",
"ut_ow": "overwrite existing files on the server?$N🛡: never (will generate a new filename instead)$N🕒: overwrite if server-file is older than yours$N♻: always overwrite if the files are different",
"ut_mt": "continue hashing other files while uploading$N$Nmaybe disable if your CPU or HDD is a bottleneck", "ut_mt": "continue hashing other files while uploading$N$Nmaybe disable if your CPU or HDD is a bottleneck",
"ut_ask": 'ask for confirmation before upload starts">💭', "ut_ask": 'ask for confirmation before upload starts">💭',
"ut_pot": "improve upload speed on slow devices$Nby making the UI less complex", "ut_pot": "improve upload speed on slow devices$Nby making the UI less complex",
@ -327,7 +330,7 @@ var tl_browser = {
"cut_nag": "OS notification when upload completes$N(only if the browser or tab is not active)", "cut_nag": "OS notification when upload completes$N(only if the browser or tab is not active)",
"cut_sfx": "audible alert when upload completes$N(only if the browser or tab is not active)", "cut_sfx": "audible alert when upload completes$N(only if the browser or tab is not active)",
"cut_mt": "use multithreading to accelerate file hashing$N$Nthis uses web-workers and requires$Nmore RAM (up to 512 MiB extra)$N$N30% faster https, 4.5x faster http,$Nand 5.3x faster on android phones\">mt", "cut_mt": "use multithreading to accelerate file hashing$N$Nthis uses web-workers and requires$Nmore RAM (up to 512 MiB extra)$N$Nmakes https 30% faster, http 4.5x faster\">mt",
"cft_text": "favicon text (blank and refresh to disable)", "cft_text": "favicon text (blank and refresh to disable)",
"cft_fg": "foreground color", "cft_fg": "foreground color",
@ -349,6 +352,7 @@ var tl_browser = {
"ml_pmode": "at end of folder...", "ml_pmode": "at end of folder...",
"ml_btns": "cmds", "ml_btns": "cmds",
"ml_tcode": "transcode", "ml_tcode": "transcode",
"ml_tcode2": "transcode to",
"ml_tint": "tint", "ml_tint": "tint",
"ml_eq": "audio equalizer", "ml_eq": "audio equalizer",
"ml_drc": "dynamic range compressor", "ml_drc": "dynamic range compressor",
@ -372,6 +376,14 @@ var tl_browser = {
"mt_cflac": "convert flac / wav to opus\">flac", "mt_cflac": "convert flac / wav to opus\">flac",
"mt_caac": "convert aac / m4a to opus\">aac", "mt_caac": "convert aac / m4a to opus\">aac",
"mt_coth": "convert all others (not mp3) to opus\">oth", "mt_coth": "convert all others (not mp3) to opus\">oth",
"mt_c2opus": "best choice for desktops, laptops, android\">opus",
"mt_c2owa": "opus-weba, for iOS 17.5 and newer\">owa",
"mt_c2caf": "opus-caf, for iOS 11 through 17\">caf",
"mt_c2mp3": "use this on very old devices\">mp3",
"mt_c2ok": "nice, good choice",
"mt_c2nd": "that's not the recommended output format for your device, but that's fine",
"mt_c2ng": "your device does not seem to support this output format, but let's try anyways",
"mt_xowa": "there are bugs in iOS preventing background playback using this format; please use caf or mp3 instead",
"mt_tint": "background level (0-100) on the seekbar$Nto make buffering less distracting", "mt_tint": "background level (0-100) on the seekbar$Nto make buffering less distracting",
"mt_eq": "enables the equalizer and gain control;$N$Nboost &lt;code&gt;0&lt;/code&gt; = standard 100% volume (unmodified)$N$Nwidth &lt;code&gt;1 &nbsp;&lt;/code&gt; = standard stereo (unmodified)$Nwidth &lt;code&gt;0.5&lt;/code&gt; = 50% left-right crossfeed$Nwidth &lt;code&gt;0 &nbsp;&lt;/code&gt; = mono$N$Nboost &lt;code&gt;-0.8&lt;/code&gt; &amp; width &lt;code&gt;10&lt;/code&gt; = vocal removal :^)$N$Nenabling the equalizer makes gapless albums fully gapless, so leave it on with all the values at zero (except width = 1) if you care about that", "mt_eq": "enables the equalizer and gain control;$N$Nboost &lt;code&gt;0&lt;/code&gt; = standard 100% volume (unmodified)$N$Nwidth &lt;code&gt;1 &nbsp;&lt;/code&gt; = standard stereo (unmodified)$Nwidth &lt;code&gt;0.5&lt;/code&gt; = 50% left-right crossfeed$Nwidth &lt;code&gt;0 &nbsp;&lt;/code&gt; = mono$N$Nboost &lt;code&gt;-0.8&lt;/code&gt; &amp; width &lt;code&gt;10&lt;/code&gt; = vocal removal :^)$N$Nenabling the equalizer makes gapless albums fully gapless, so leave it on with all the values at zero (except width = 1) if you care about that",
"mt_drc": "enables the dynamic range compressor (volume flattener / brickwaller); will also enable EQ to balance the spaghetti, so set all EQ fields except for 'width' to 0 if you don't want it$N$Nlowers the volume of audio above THRESHOLD dB; for every RATIO dB past THRESHOLD there is 1 dB of output, so default values of tresh -24 and ratio 12 means it should never get louder than -22 dB and it is safe to increase the equalizer boost to 0.8, or even 1.8 with ATK 0 and a huge RLS like 90 (only works in firefox; RLS is max 1 in other browsers)$N$N(see wikipedia, they explain it much better)", "mt_drc": "enables the dynamic range compressor (volume flattener / brickwaller); will also enable EQ to balance the spaghetti, so set all EQ fields except for 'width' to 0 if you don't want it$N$Nlowers the volume of audio above THRESHOLD dB; for every RATIO dB past THRESHOLD there is 1 dB of output, so default values of tresh -24 and ratio 12 means it should never get louder than -22 dB and it is safe to increase the equalizer boost to 0.8, or even 1.8 with ATK 0 and a huge RLS like 90 (only works in firefox; RLS is max 1 in other browsers)$N$N(see wikipedia, they explain it much better)",
@ -613,8 +625,10 @@ var tl_browser = {
"u_ewrite": 'you do not have write-access to this folder', "u_ewrite": 'you do not have write-access to this folder',
"u_eread": 'you do not have read-access to this folder', "u_eread": 'you do not have read-access to this folder',
"u_enoi": 'file-search is not enabled in server config', "u_enoi": 'file-search is not enabled in server config',
"u_enoow": "overwrite will not work here; need Delete-permission",
"u_badf": 'These {0} files (of {1} total) were skipped, possibly due to filesystem permissions:\n\n', "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_blankf": 'These {0} files (of {1} total) are blank / empty; upload them anyways?\n\n',
"u_applef": 'These {0} files (of {1} total) are probably undesirable;\nPress <code>OK/Enter</code> to SKIP the following files,\nPress <code>Cancel/ESC</code> to NOT exclude, and UPLOAD those as well:\n\n',
"u_just1": '\nMaybe it works better if you select just one file', "u_just1": '\nMaybe it works better if you select just one file',
"u_ff_many": "if you're using <b>Linux / MacOS / Android,</b> then this amount of files <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=1790500\" target=\"_blank\"><em>may</em> crash Firefox!</a>\nif that happens, please try again (or use Chrome).", "u_ff_many": "if you're using <b>Linux / MacOS / Android,</b> then this amount of files <a href=\"https://bugzilla.mozilla.org/show_bug.cgi?id=1790500\" target=\"_blank\"><em>may</em> crash Firefox!</a>\nif that happens, please try again (or use Chrome).",
"u_up_life": "This upload will be deleted from the server\n{0} after it completes", "u_up_life": "This upload will be deleted from the server\n{0} after it completes",