optimize md-edit

This commit is contained in:
ed 2026-06-28 15:52:46 +00:00
parent 4c8203016f
commit 52c42b83e4
6 changed files with 14 additions and 20 deletions

View file

@ -443,6 +443,7 @@ class VFS(object):
self.adot: dict[str, list[str]] = {} self.adot: dict[str, list[str]] = {}
self.js_ls = {} self.js_ls = {}
self.js_htm = "" self.js_htm = ""
self.md_htm = ""
self.all_vols: dict[str, VFS] = {} # flattened recursive self.all_vols: dict[str, VFS] = {} # flattened recursive
self.all_nodes: dict[str, VFS] = {} # also jumpvols/shares self.all_nodes: dict[str, VFS] = {} # also jumpvols/shares
self.all_fvols: dict[str, VFS] = {} # volumes which are files self.all_fvols: dict[str, VFS] = {} # volumes which are files
@ -3193,7 +3194,7 @@ class AuthSrv(object):
db.close() db.close()
self.js_ls = {} self.js_ls = {}
self.js_htm = {} self.js_htm = ""
for vp, vn in self.vfs.all_nodes.items(): for vp, vn in self.vfs.all_nodes.items():
if enshare and vp.startswith(shrs): if enshare and vp.startswith(shrs):
continue # propagates later in this func continue # propagates later in this func
@ -3285,7 +3286,13 @@ class AuthSrv(object):
zs2 = getattr(self.args, zs, "") zs2 = getattr(self.args, zs, "")
if zs2: if zs2:
js_htm[zs] = zs2 js_htm[zs] = zs2
zs = "have_emp md_no_br"
md_htm = {x:js_htm[x] for x in zs.split(" ")}
md_htm["modpoll_freq"] = self.args.mcr
vn.js_htm = json_hesc(json.dumps(js_htm)) vn.js_htm = json_hesc(json.dumps(js_htm))
vn.md_htm = json_hesc(json.dumps(md_htm))
vols = list(vfs.all_nodes.values()) vols = list(vfs.all_nodes.values())
if enshare: if enshare:

View file

@ -137,6 +137,7 @@ def vf_vmap() -> dict[str, str]:
"put_ck", "put_ck",
"put_name", "put_name",
"readmes", "readmes",
"rotf_tz",
"mv_retry", "mv_retry",
"rm_retry", "rm_retry",
"rss_sort", "rss_sort",

View file

@ -5390,11 +5390,9 @@ class HttpCli(object):
"lastmod": int(ts_md * 1000), "lastmod": int(ts_md * 1000),
"lang": self.cookies.get("cplng") or self.args.lang, "lang": self.cookies.get("cplng") or self.args.lang,
"favico": self.args.favico, "favico": self.args.favico,
"have_emp": int(self.args.emp),
"md_no_br": int(vn.flags.get("md_no_br") or 0),
"md_chk_rate": self.args.mcr,
"md": boundary, "md": boundary,
"arg_base": arg_base, "arg_base": arg_base,
"cgv1": self.vn.md_htm,
} }
if self.args.js_other and "js" not in targs: if self.args.js_other and "js" not in targs:

View file

@ -134,16 +134,10 @@ write markdown (most html is 🙆 too)
<script> <script>
var SR = "{{ r }}", var SR = "{{ r }}",
CGV1 = {{ cgv1 }},
last_modified = {{ lastmod }}, last_modified = {{ lastmod }},
have_emp = {{ have_emp }},
md_no_br = {{ md_no_br }},
dfavico = "{{ favico }}"; dfavico = "{{ favico }}";
var md_opt = {
link_md_as_html: false,
modpoll_freq: {{ md_chk_rate }}
};
(function () { (function () {
var l = window.localStorage, var l = window.localStorage,
drk = (l && l.light) != 1, drk = (l && l.light) != 1,

View file

@ -316,8 +316,8 @@ function Modpoll() {
}; };
setTimeout(r.periodic, 300); setTimeout(r.periodic, 300);
if (md_opt.modpoll_freq > 0) if (modpoll_freq > 0)
setInterval(r.periodic, 1000 * md_opt.modpoll_freq); setInterval(r.periodic, 1000 * modpoll_freq);
return r; return r;
} }

View file

@ -31,16 +31,10 @@
<script> <script>
var SR = "{{ r }}", var SR = "{{ r }}",
CGV1 = {{ cgv1 }},
last_modified = {{ lastmod }}, last_modified = {{ lastmod }},
have_emp = {{ have_emp }},
md_no_br = {{ md_no_br }},
dfavico = "{{ favico }}"; dfavico = "{{ favico }}";
var md_opt = {
link_md_as_html: false,
modpoll_freq: {{ md_chk_rate }}
};
var lightswitch = (function () { var lightswitch = (function () {
var l = window.localStorage, var l = window.localStorage,
drk = (l && l.light) != 1, drk = (l && l.light) != 1,