diff --git a/README.md b/README.md index 11d0effb..4457c594 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ turn your phone or raspi into a portable file server with resumable uploads/down * [metadata from audio files](#metadata-from-audio-files) - set `-e2t` to index tags on upload * [file parser plugins](#file-parser-plugins) - provide custom parsers to index additional tags, also see [./bin/mtag/README.md](./bin/mtag/README.md) * [upload events](#upload-events) - trigger a script/program on each upload + * [hiding from google](#hiding-from-google) - tell search engines you dont wanna be indexed * [complete examples](#complete-examples) * [browser support](#browser-support) - TLDR: yes * [client examples](#client-examples) - interact with copyparty using non-browser clients @@ -792,6 +793,17 @@ and it will occupy the parsing threads, so fork anything expensive, or if you wa if this becomes popular maybe there should be a less janky way to do it actually +## hiding from google + +tell search engines you dont wanna be indexed, either using the good old [robots.txt](https://www.robotstxt.org/robotstxt.html) or through copyparty settings: + +* `--no-robots` adds HTTP (`X-Robots-Tag`) and HTML (``) headers with `noindex, nofollow` globally +* volume-flag `[...]:c,norobots` does the same thing for that single volume +* volume-flag `[...]:c,robots` ALLOWS search-engine crawling for that volume, even if `--no-robots` is set globally + +also, `--force-js` disables the plain HTML folder listing, making things harder to parse for search engines + + ## complete examples * read-only music server with bpm and key scanning diff --git a/copyparty/__version__.py b/copyparty/__version__.py index b59fafd8..10fdfe4e 100644 --- a/copyparty/__version__.py +++ b/copyparty/__version__.py @@ -1,8 +1,8 @@ # coding: utf-8 -VERSION = (1, 2, 1) +VERSION = (1, 2, 2) CODENAME = "ftp btw" -BUILD_DT = (2022, 3, 3) +BUILD_DT = (2022, 3, 20) S_VERSION = ".".join(map(str, VERSION)) S_BUILD_DT = "{0:04d}-{1:02d}-{2:02d}".format(*BUILD_DT) diff --git a/copyparty/web/browser.css b/copyparty/web/browser.css index 632a15dd..4c814e4b 100644 --- a/copyparty/web/browser.css +++ b/copyparty/web/browser.css @@ -37,7 +37,7 @@ pre, code, tt, #doc, #doc>code { display: inline-block; padding: .35em .5em .2em .5em; border-radius: 0 .3em .3em 0; - margin: 1.3em 0 0 0; + margin: 1.3em 0 -.2em 0; font-size: 1.4em; } #path #entree { diff --git a/copyparty/web/browser.js b/copyparty/web/browser.js index 560ce593..7627c30a 100644 --- a/copyparty/web/browser.js +++ b/copyparty/web/browser.js @@ -2426,6 +2426,7 @@ var showfile = (function () { lnh = doc[1], txt = doc[2], name = url.split('/').pop(), + tname = uricom_dec(name)[0], lang = r.getlang(name), is_md = lang == 'md'; @@ -2472,14 +2473,14 @@ var showfile = (function () { wr.style.display = ''; set_tabindex(); - wintitle(name + ' \u2014 '); + wintitle(tname + ' \u2014 '); document.documentElement.scrollTop = 0; var hfun = no_push ? hist_replace : hist_push; hfun(get_evpath() + '?doc=' + url.split('/').pop()); qsr('#docname'); el = mknod('span'); - el.textContent = uricom_dec(name)[0]; + el.textContent = tname; el.setAttribute('id', 'docname'); ebi('path').appendChild(el); diff --git a/docs/notes.sh b/docs/notes.sh index a5223434..f17b6fe1 100644 --- a/docs/notes.sh +++ b/docs/notes.sh @@ -3,6 +3,12 @@ echo not a script exit 1 +## +## add index.html banners + +find -name index.html | sed -r 's/index.html$//' | while IFS= read -r dir; do f="$dir/.prologue.html"; [ -e "$f" ] || echo '

open index.html

' >"$f"; done + + ## ## delete all partial uploads ## (supports linux/macos, probably windows+msys2) @@ -95,6 +101,7 @@ var t=[]; var b=document.location.href.split('#')[0].slice(0, -1); document.quer # debug md-editor line tracking var s=mknod('style');s.innerHTML='*[data-ln]:before {content:attr(data-ln)!important;color:#f0c;background:#000;position:absolute;left:-1.5em;font-size:1rem}';document.head.appendChild(s); + ## ## bash oneliners @@ -199,6 +206,7 @@ git remote add all git@github.com:9001/copyparty.git git remote set-url --add --push all git@gitlab.com:9001/copyparty.git git remote set-url --add --push all git@github.com:9001/copyparty.git + ## ## http 206 diff --git a/scripts/make-sfx.sh b/scripts/make-sfx.sh index 75f9c5bc..fc87bba7 100755 --- a/scripts/make-sfx.sh +++ b/scripts/make-sfx.sh @@ -356,7 +356,14 @@ for d in copyparty dep-j2 dep-ftp; do find $d -type f; done | sed -r 's/(.*)\.(.*)/\2 \1/' | LC_ALL=C sort | sed -r 's/([^ ]*) (.*)/\2.\1/' | grep -vE '/list1?$' > list1 -(grep -vE '\.(gz|br)$' list1; grep -E '\.(gz|br)$' list1 | shuf) >list || true +for n in {1..50}; do + (grep -vE '\.(gz|br)$' list1; grep -E '\.(gz|br)$' list1 | shuf) >list || true + s=$(md5sum list | cut -c-16) + grep -q $s "$zdir/h" && continue + echo $s >> "$zdir/h" + break +done +[ $n -eq 50 ] && exit echo creating tar args=(--owner=1000 --group=1000) diff --git a/scripts/rls.sh b/scripts/rls.sh index 19a23a75..359048a9 100755 --- a/scripts/rls.sh +++ b/scripts/rls.sh @@ -4,19 +4,22 @@ set -e cd ~/dev/copyparty/scripts v=$1 -printf '%s\n' "$v" | grep -qE '^[0-9\.]+$' || exit 1 -grep -E "(${v//./, })" ../copyparty/__version__.py || exit 1 -git push all -git tag v$v -git push all --tags +[ "$v" = sfx ] || { + printf '%s\n' "$v" | grep -qE '^[0-9\.]+$' || exit 1 + grep -E "(${v//./, })" ../copyparty/__version__.py || exit 1 -rm -rf ../dist + git push all + git tag v$v + git push all --tags -./make-pypi-release.sh u -(cd .. && python3 ./setup.py clean2) + rm -rf ../dist -./make-tgz-release.sh $v + ./make-pypi-release.sh u + (cd .. && python3 ./setup.py clean2) + + ./make-tgz-release.sh $v +} rm -f ../dist/copyparty-sfx.* f=../dist/copyparty-sfx.py diff --git a/tests/test_httpcli.py b/tests/test_httpcli.py index ab9485dc..0189d475 100644 --- a/tests/test_httpcli.py +++ b/tests/test_httpcli.py @@ -52,9 +52,12 @@ class Cfg(Namespace): mth="", textfiles="", doctitle="", + html_head="", hist=None, no_idx=None, no_hash=None, + force_js=False, + no_robots=False, js_browser=None, css_browser=None, **{k: False for k in "e2d e2ds e2dsa e2t e2ts e2tsr no_acode".split()} diff --git a/tests/test_vfs.py b/tests/test_vfs.py index 1a327a86..7bcdf603 100644 --- a/tests/test_vfs.py +++ b/tests/test_vfs.py @@ -17,13 +17,14 @@ from copyparty import util class Cfg(Namespace): def __init__(self, a=None, v=None, c=None): - ex = "nw e2d e2ds e2dsa e2t e2ts e2tsr no_logues no_readme no_acode" + ex = "nw e2d e2ds e2dsa e2t e2ts e2tsr no_logues no_readme no_acode force_js no_robots" ex = {k: False for k in ex.split()} ex2 = { "mtp": [], "mte": "a", "mth": "", "doctitle": "", + "html_head": "", "hist": None, "no_idx": None, "no_hash": None,