mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
make prism optional
This commit is contained in:
parent
3899c7ad56
commit
cb7674b091
|
@ -2281,6 +2281,9 @@ class HttpCli(object):
|
|||
|
||||
j2a["doc"] = doc
|
||||
|
||||
if not self.conn.hsrv.prism:
|
||||
j2a["no_prism"] = True
|
||||
|
||||
for d in dirs:
|
||||
d["name"] += "/"
|
||||
|
||||
|
@ -2289,7 +2292,7 @@ class HttpCli(object):
|
|||
j2a["files"] = dirs + files
|
||||
j2a["logues"] = logues
|
||||
j2a["taglist"] = taglist
|
||||
j2a["txt_ext"] = self.args.textfiles.replace(',', ' ')
|
||||
j2a["txt_ext"] = self.args.textfiles.replace(",", " ")
|
||||
|
||||
if "mth" in vn.flags:
|
||||
j2a["def_hcols"] = vn.flags["mth"].split(",")
|
||||
|
|
|
@ -76,6 +76,7 @@ class HttpSrv(object):
|
|||
x: env.get_template(x + ".html")
|
||||
for x in ["splash", "browser", "browser2", "msg", "md", "mde"]
|
||||
}
|
||||
self.prism = os.path.exists(os.path.join(E.mod, "web", "deps", "prism.js.gz"))
|
||||
|
||||
cert_path = os.path.join(E.cfg, "cert.pem")
|
||||
if bos.path.exists(cert_path):
|
||||
|
|
|
@ -142,6 +142,7 @@
|
|||
have_unpost = {{ have_unpost|tojson }},
|
||||
have_zip = {{ have_zip|tojson }},
|
||||
txt_ext = "{{ txt_ext }}",
|
||||
{% if no_prism %}no_prism = 1,{% endif %}
|
||||
readme = {{ readme|tojson }};
|
||||
|
||||
document.documentElement.setAttribute("class", localStorage.lightmode == 1 ? "light" : "dark");
|
||||
|
|
|
@ -2336,6 +2336,9 @@ var showfile = (function () {
|
|||
em = [r.sname(window.location.search), window.location.hash, em.textContent];
|
||||
|
||||
r.setstyle = function () {
|
||||
if (window['no_prism'])
|
||||
return;
|
||||
|
||||
qsr('#prism_css');
|
||||
var el = mknod('link');
|
||||
el.rel = 'stylesheet';
|
||||
|
@ -2438,11 +2441,13 @@ var showfile = (function () {
|
|||
else {
|
||||
el.textContent = txt;
|
||||
el.innerHTML = '<code>' + el.innerHTML + '</code>';
|
||||
el.setAttribute('class', 'prism linkable-line-numbers line-numbers language-' + lang);
|
||||
if (!defer)
|
||||
fun(el.firstChild);
|
||||
else
|
||||
import_js('/.cpr/deps/prism.js', function () { fun(); });
|
||||
if (!window['no_prism']) {
|
||||
el.setAttribute('class', 'prism linkable-line-numbers line-numbers language-' + lang);
|
||||
if (!defer)
|
||||
fun(el.firstChild);
|
||||
else
|
||||
import_js('/.cpr/deps/prism.js', function () { fun(); });
|
||||
}
|
||||
}
|
||||
|
||||
wr.appendChild(el);
|
||||
|
|
|
@ -29,7 +29,8 @@ set -e
|
|||
# 259288 copyparty-extras/sfx-lite/copyparty-sfx.sh
|
||||
# 270004 copyparty-extras/sfx-lite/copyparty-sfx.py
|
||||
# 293159 copyparty-extras/sfx-lite/copyparty-sfx-gz.py
|
||||
# `- also removed the codemirror markdown editor,
|
||||
# `- also removed the codemirror markdown editor
|
||||
# and the text-viewer syntax hilighting,
|
||||
# only essential features remaining
|
||||
#
|
||||
# 646297 copyparty-extras/copyparty-1.0.14.tar.gz
|
||||
|
@ -141,8 +142,8 @@ repack() {
|
|||
repack sfx-full "re gz no-sh"
|
||||
repack sfx-ent "re no-dd no-ogv"
|
||||
repack sfx-ent "re no-dd no-ogv gz no-sh"
|
||||
repack sfx-lite "re no-dd no-ogv no-cm"
|
||||
repack sfx-lite "re no-dd no-ogv no-cm gz no-sh"
|
||||
repack sfx-lite "re no-dd no-ogv no-cm no-hl"
|
||||
repack sfx-lite "re no-dd no-ogv no-cm no-hl gz no-sh"
|
||||
|
||||
|
||||
# move fuse and up2k clients into copyparty-extras/,
|
||||
|
|
|
@ -22,6 +22,8 @@ help() { exec cat <<'EOF'
|
|||
# `no-cm` saves ~92k by removing easymde/codemirror
|
||||
# (the fancy markdown editor)
|
||||
#
|
||||
# `no-hl` saves ~41k by removing syntax hilighting in the text viewer
|
||||
#
|
||||
# `no-fnt` saves ~9k by removing the source-code-pro font
|
||||
# (browsers will try to use 'Consolas' instead)
|
||||
#
|
||||
|
@ -75,6 +77,7 @@ while [ ! -z "$1" ]; do
|
|||
gz) use_gz=1 ; ;;
|
||||
no-ogv) no_ogv=1 ; ;;
|
||||
no-fnt) no_fnt=1 ; ;;
|
||||
no-hl) no_hl=1 ; ;;
|
||||
no-dd) no_dd=1 ; ;;
|
||||
no-cm) no_cm=1 ; ;;
|
||||
no-sh) do_sh= ; ;;
|
||||
|
@ -226,6 +229,9 @@ rm have
|
|||
tmv "$f"
|
||||
}
|
||||
|
||||
[ $no_hl ] &&
|
||||
rm -rf copyparty/web/deps/prism*
|
||||
|
||||
[ $no_fnt ] && {
|
||||
rm -f copyparty/web/deps/scp.woff2
|
||||
f=copyparty/web/ui.css
|
||||
|
|
|
@ -57,6 +57,9 @@ copyparty/web/deps/ogv-demuxer-ogg-wasm.js,
|
|||
copyparty/web/deps/ogv-demuxer-ogg-wasm.wasm,
|
||||
copyparty/web/deps/ogv-worker-audio.js,
|
||||
copyparty/web/deps/ogv.js,
|
||||
copyparty/web/deps/prism.js,
|
||||
copyparty/web/deps/prism.css,
|
||||
copyparty/web/deps/prismd.css,
|
||||
copyparty/web/deps/scp.woff2,
|
||||
copyparty/web/deps/sha512.ac.js,
|
||||
copyparty/web/deps/sha512.hw.js,
|
||||
|
|
Loading…
Reference in a new issue