opdf: fix merge issues

This commit is contained in:
ed 2025-09-22 20:37:33 +00:00
parent 0941fd4ec1
commit c214a93caa
2 changed files with 14 additions and 13 deletions

View file

@ -6630,8 +6630,12 @@ class HttpCli(object):
dirs = [] dirs = []
files = [] files = []
ptn_hr = RE_HR ptn_hr = RE_HR
use_abs_url = is_opds or ( use_abs_url = (
not is_ls and not is_js and not self.trailing_slash and vpath not is_opds
and not is_ls
and not is_js
and not self.trailing_slash
and vpath
) )
for fn in ls_names: for fn in ls_names:
base = "" base = ""
@ -6906,11 +6910,6 @@ class HttpCli(object):
dirs.sort(key=itemgetter("name")) dirs.sort(key=itemgetter("name"))
if is_opds: if is_opds:
url_base = "%s://%s%s" % (
"https" if self.is_https else "http",
self.host,
self.args.SR,
)
# exclude files which don't match --opds-exts # exclude files which don't match --opds-exts
allowed_exts = vf.get("opds_exts") or self.args.opds_exts allowed_exts = vf.get("opds_exts") or self.args.opds_exts
if allowed_exts: if allowed_exts:
@ -6918,14 +6917,16 @@ class HttpCli(object):
x for x in files if x["name"].rsplit(".", 1)[-1] in allowed_exts x for x in files if x["name"].rsplit(".", 1)[-1] in allowed_exts
] ]
for item in dirs: for item in dirs:
href = url_base + item["href"] href = item["href"]
href += ("&" if "?" in href else "?") + "opds" href += ("&" if "?" in href else "?") + "opds"
item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T")) item["href"] = href
item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T"),)
for item in files: for item in files:
href = url_base + item["href"] href = item["href"]
href += ("&" if "?" in href else "?") + "dl" href += ("&" if "?" in href else "?") + "dl"
item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T")) item["href"] = href
item["iso8601"] = "%sZ" % (item["dt"].replace(" ", "T"),)
if "rmagic" in self.vn.flags: if "rmagic" in self.vn.flags:
ap = "%s/%s" % (fsroot, item["name"]) ap = "%s/%s" % (fsroot, item["name"])

View file

@ -143,7 +143,7 @@ class Cfg(Namespace):
def __init__(self, a=None, v=None, c=None, **ka0): def __init__(self, a=None, v=None, c=None, **ka0):
ka = {} ka = {}
ex = "allow_flac allow_wav chpw cookie_lax daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only ih ihead localtime log_badxml magic md_no_br nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_fnugg no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_u2abrt no_zip nrand nsort nw og og_no_head og_s_title ohead q rand re_dirsz reflink rmagic rss smb srch_dbg srch_excl srch_icase stats uqe usernames vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs" ex = "allow_flac allow_wav chpw cookie_lax daw dav_auth dav_mac dav_rt e2d e2ds e2dsa e2t e2ts e2tsr e2v e2vu e2vp early_ban ed emp exp force_js getmod grid gsel hardlink hardlink_only ih ihead localtime log_badxml magic md_no_br nid nih no_acode no_athumb no_bauth no_clone no_cp no_dav no_db_ip no_del no_dirsz no_dupe no_fnugg no_lifetime no_logues no_mv no_pipe no_poll no_readme no_robots no_sb_md no_sb_lg no_scandir no_tail no_tarcmp no_thumb no_vthumb no_u2abrt no_zip nrand nsort nw og og_no_head og_s_title ohead opds q rand re_dirsz reflink rmagic rss smb srch_dbg srch_excl srch_icase stats uqe usernames vague_403 vc ver wo_up_readme write_uplog xdev xlink xvol zipmaxu zs"
ka.update(**{k: False for k in ex.split()}) ka.update(**{k: False for k in ex.split()})
ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump wram re_dhash see_dots plain_ip" ex = "dav_inf dedup dotpart dotsrch hook_v no_dhash no_fastboot no_fpool no_htp no_rescan no_sendfile no_ses no_snap no_up_list no_voldump wram re_dhash see_dots plain_ip"
@ -164,7 +164,7 @@ class Cfg(Namespace):
ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin qr_wait re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs" ex = "ctl_re db_act forget_ip idp_cookie idp_store k304 loris no304 nosubtle qr_pin qr_wait re_maxage rproxy rsp_jtr rsp_slp s_wr_slp snap_wri theme themes turbo u2ow zipmaxn zipmaxs"
ka.update(**{k: 0 for k in ex.split()}) ka.update(**{k: 0 for k in ex.split()})
ex = "ah_alg bname chdir chmod_f chpw_db doctitle df exit favico ipa html_head idp_login idp_logout lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i shr tcolor textfiles txt_eol unlist vname xff_src zipmaxt R RS SR" ex = "ah_alg bname chdir chmod_f chpw_db doctitle df exit favico ipa html_head idp_login idp_logout lg_sba lg_sbf log_fk md_sba md_sbf name og_desc og_site og_th og_title og_title_a og_title_v og_title_i opds_exts shr tcolor textfiles txt_eol unlist vname xff_src zipmaxt R RS SR"
ka.update(**{k: "" for k in ex.split()}) ka.update(**{k: "" for k in ex.split()})
ex = "ban_403 ban_404 ban_422 ban_pw ban_pwc ban_url spinner" ex = "ban_403 ban_404 ban_422 ban_pw ban_pwc ban_url spinner"