Introduce new caching mechanism, no longer require unique file paths

pull/154/head
zanllp 2023-05-18 01:13:51 +08:00
parent 404fbbeb41
commit e563d69290
23 changed files with 138 additions and 148 deletions

View File

@ -12,7 +12,7 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-4a2169ff.js"></script>
<script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-703b9a2d.js"></script>
<link rel="stylesheet" href="/infinite_image_browsing/fe-static/assets/index-050489b7.css">
</head>

View File

@ -64,115 +64,105 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
file_paths: List[str]
@app.post(pre + "/delete_files/{target}")
async def delete_files(req: DeleteFilesReq, target: Literal["local", "netdisk"]):
if target == "local":
conn = DataBase.get_conn()
for path in req.file_paths:
try:
if os.path.isdir(path):
if len(os.listdir(path)):
error_msg = (
"When a folder is not empty, it is not allowed to be deleted."
if locale == "en"
else "文件夹不为空时不允许删除。"
)
raise HTTPException(400, detail=error_msg)
shutil.rmtree(path)
else:
os.remove(path)
img = DbImg.get(conn, os.path.normpath(path))
if img:
logger.info("delete file: %s", path)
ImageTag.remove(conn, img.id)
DbImg.remove(conn, img.id)
except OSError as e:
# 处理删除失败的情况
logger.error("delete failed")
error_msg = (
f"Error deleting file {path}: {e}"
if locale == "en"
else f"删除文件 {path} 时出错:{e}"
)
raise HTTPException(400, detail=error_msg)
else:
pass
async def delete_files(req: DeleteFilesReq):
conn = DataBase.get_conn()
for path in req.file_paths:
try:
if os.path.isdir(path):
if len(os.listdir(path)):
error_msg = (
"When a folder is not empty, it is not allowed to be deleted."
if locale == "en"
else "文件夹不为空时不允许删除。"
)
raise HTTPException(400, detail=error_msg)
shutil.rmtree(path)
else:
os.remove(path)
img = DbImg.get(conn, os.path.normpath(path))
if img:
logger.info("delete file: %s", path)
ImageTag.remove(conn, img.id)
DbImg.remove(conn, img.id)
except OSError as e:
# 处理删除失败的情况
logger.error("delete failed")
error_msg = (
f"Error deleting file {path}: {e}"
if locale == "en"
else f"删除文件 {path} 时出错:{e}"
)
raise HTTPException(400, detail=error_msg)
class MoveFilesReq(BaseModel):
file_paths: List[str]
dest: str
@app.post(pre + "/move_files/{target}")
async def move_files(req: MoveFilesReq, target: Literal["local", "netdisk"]):
async def move_files(req: MoveFilesReq):
conn = DataBase.get_conn()
if target == "local":
for path in req.file_paths:
try:
shutil.move(path, req.dest)
img = DbImg.get(conn, os.path.normpath(path))
if img:
ImageTag.remove(conn, img.id)
DbImg.remove(conn, img.id)
except OSError as e:
error_msg = (
f"Error moving file {path} to {req.dest}: {e}"
if locale == "en"
else f"移动文件 {path}{req.dest} 时出错:{e}"
)
raise HTTPException(400, detail=error_msg)
else:
pass
for path in req.file_paths:
try:
shutil.move(path, req.dest)
img = DbImg.get(conn, os.path.normpath(path))
if img:
ImageTag.remove(conn, img.id)
DbImg.remove(conn, img.id)
except OSError as e:
error_msg = (
f"Error moving file {path} to {req.dest}: {e}"
if locale == "en"
else f"移动文件 {path}{req.dest} 时出错:{e}"
)
raise HTTPException(400, detail=error_msg)
@app.get(pre + "/files/{target}")
@app.get(pre + "/files")
async def get_target_floder_files(
target: Literal["local", "netdisk"], folder_path: str
folder_path: str
):
files = []
try:
if target == "local":
if is_win and folder_path == "/":
for item in get_windows_drives():
files.append(
{"type": "dir", "size": "-", "name": item, "fullpath": item}
)
else:
for item in os.listdir(folder_path):
path = os.path.join(folder_path, item)
if not os.path.exists(path):
continue
date = get_modified_date(path)
created_time = get_created_date(path)
if os.path.isfile(path):
bytes = os.path.getsize(path)
size = human_readable_size(bytes)
files.append(
{
"type": "file",
"date": date,
"size": size,
"name": item,
"bytes": bytes,
"created_time": created_time,
"fullpath": os.path.normpath(
os.path.join(folder_path, item)
),
}
)
elif os.path.isdir(path):
files.append(
{
"type": "dir",
"date": date,
"created_time": created_time,
"size": "-",
"name": item,
"fullpath": os.path.normpath(
os.path.join(folder_path, item)
),
}
)
if is_win and folder_path == "/":
for item in get_windows_drives():
files.append(
{"type": "dir", "size": "-", "name": item, "fullpath": item}
)
else:
pass
for item in os.listdir(folder_path):
path = os.path.join(folder_path, item)
if not os.path.exists(path):
continue
date = get_modified_date(path)
created_time = get_created_date(path)
if os.path.isfile(path):
bytes = os.path.getsize(path)
size = human_readable_size(bytes)
files.append(
{
"type": "file",
"date": date,
"size": size,
"name": item,
"bytes": bytes,
"created_time": created_time,
"fullpath": os.path.normpath(
os.path.join(folder_path, item)
),
}
)
elif os.path.isdir(path):
files.append(
{
"type": "dir",
"date": date,
"created_time": created_time,
"size": "-",
"name": item,
"fullpath": os.path.normpath(
os.path.join(folder_path, item)
),
}
)
except Exception as e:
logger.error(e)
raise HTTPException(status_code=400, detail=str(e))
@ -180,13 +170,15 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
return {"files": files}
@app.get(pre + "/image-thumbnail")
async def thumbnail(path: str, size: str = "256,256"):
async def thumbnail(path: str, created_time: str , size: str = "256,256"):
if not temp_path:
encoded_params = urlencode({"filename": path})
encoded_params = urlencode({"filename": path, "created_time" : created_time })
return RedirectResponse(url=f"{pre}/file?{encoded_params}")
# 生成缓存文件的路径
hash = hashlib.md5((path + size).encode("utf-8")).hexdigest()
cache_path = os.path.join(temp_path, f"{hash}.webp")
hash_dir = hashlib.md5((path + created_time).encode("utf-8")).hexdigest()
hash = hashlib.md5((path + created_time + size).encode("utf-8")).hexdigest()
cache_dir = os.path.join(temp_path, 'iib_cache', hash_dir)
cache_path = os.path.join(cache_dir, f"{size}.webp")
# 如果缓存文件存在,则直接返回该文件
if os.path.exists(cache_path):
@ -200,6 +192,7 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
with Image.open(path) as img:
w, h = size.split(",")
img.thumbnail((int(w), int(h)))
os.makedirs(cache_dir, exist_ok=True)
img.save(cache_path, "webp")
# 返回缓存文件
@ -230,9 +223,8 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
return False
@app.get(pre + "/file")
async def get_file(filename: str, disposition: Optional[str] = None):
async def get_file(filename: str, created_time: str , disposition: Optional[str] = None):
import mimetypes
if not os.path.exists(filename):
raise HTTPException(status_code=404)
if not os.path.isfile(filename):
@ -243,7 +235,7 @@ def infinite_image_browsing_api(_: Any, app: FastAPI, **kwargs):
if disposition:
headers["Content-Disposition"] = f'attachment; filename="{disposition}"'
if need_cache(filename) and is_valid_image_path(filename): # 认为永远不变,不要协商缓存了试试
headers["Cache-Control"] = "public, max-age=31536000"
headers["Cache-Control"] = "public, max-age=31536000" # 针对同样名字文件但实际上不同内容的文件要求必须传入创建时间来避免浏览器缓存
headers["Expires"] = (datetime.now() + timedelta(days=365)).strftime(
"%a, %d %b %Y %H:%M:%S GMT"
)

View File

@ -49,8 +49,12 @@ def update_image_data(search_dirs: List[str]):
process_folder(file_path)
elif is_valid_image_path(file_path):
if DbImg.get(conn, file_path): # 已存在的跳过
continue
img = DbImg.get(conn, file_path)
if img: # 已存在的跳过
if img.date == get_modified_date(img.path):
continue
else:
DbImg.safe_batch_remove(conn=conn, image_ids=[img.id])
parsed_params, info = get_exif_data(file_path)
img = DbImg(
file_path,

View File

@ -1 +1 @@
import{d as U,x as q,o as r,l as _,c as t,m as a,n as e,p as y,q as h,A as E,t as b,B as L,y as M,J as u,I as S,L as O,Q as D}from"./index-4a2169ff.js";import{i as Q,j,t as J,L as H,R as K,k as W,S as X}from"./fullScreenContextMenu-726eab7c.js";import{g as Y,M as Z}from"./db-267adb61.js";import{u as ee}from"./hook-1a4757cd.js";import"./index-aec6f11e.js";import"./_baseIteratee-b77b0e83.js";import"./button-bdfaf6a0.js";const ie={class:"hint"},le={key:1,class:"preview-switch"},se=U({__name:"MatchedImageGrid",props:{tabIdx:null,paneIdx:null,selectedTagIds:null,id:null},setup(V){const m=V,{queue:p,images:l,onContextMenuClickU:v,stackViewEl:T,previewIdx:n,previewing:f,onPreviewVisibleChange:z,previewImgMove:g,canPreview:I,itemSize:k,gridItems:B,showGenInfo:o,imageGenInfo:w,q:$,multiSelectedIdxs:A,onFileItemClick:G,scroller:C,showMenuIdx:d}=ee();return q(()=>m.selectedTagIds,async()=>{var i;const{res:c}=p.pushAction(()=>Y(m.selectedTagIds));l.value=await c,(i=C.value)==null||i.scrollToItem(0)},{immediate:!0}),(c,i)=>{const F=O,N=Z,P=X;return r(),_("div",{class:"container",ref_key:"stackViewEl",ref:T},[t(P,{size:"large",spinning:!e(p).isIdle},{default:a(()=>[t(N,{visible:e(o),"onUpdate:visible":i[1]||(i[1]=s=>y(o)?o.value=s:null),width:"70vw","mask-closable":"",onOk:i[2]||(i[2]=s=>o.value=!1)},{cancelText:a(()=>[]),default:a(()=>[t(F,{active:"",loading:!e($).isIdle},{default:a(()=>[h("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:i[0]||(i[0]=s=>e(E)(e(w)))},[h("div",ie,b(c.$t("doubleClickToCopy")),1),L(" "+b(e(w)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),e(l)?(r(),M(e(Q),{key:0,ref_key:"scroller",ref:C,class:"file-list",items:e(l),"item-size":e(k).first,"key-field":"fullpath","item-secondary-size":e(k).second,gridItems:e(B)},{default:a(({item:s,index:x})=>[t(j,{idx:x,file:s,"show-menu-idx":e(d),"onUpdate:showMenuIdx":i[3]||(i[3]=R=>y(d)?d.value=R:null),onFileItemClick:e(G),"full-screen-preview-image-url":e(l)[e(n)]?e(J)(e(l)[e(n)]):"",selected:e(A).includes(x),onContextMenuClick:e(v),onPreviewVisibleChange:e(z)},null,8,["idx","file","show-menu-idx","onFileItemClick","full-screen-preview-image-url","selected","onContextMenuClick","onPreviewVisibleChange"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):u("",!0),e(f)?(r(),_("div",le,[t(e(H),{onClick:i[4]||(i[4]=s=>e(g)("prev")),class:S({disable:!e(I)("prev")})},null,8,["class"]),t(e(K),{onClick:i[5]||(i[5]=s=>e(g)("next")),class:S({disable:!e(I)("next")})},null,8,["class"])])):u("",!0)]),_:1},8,["spinning"]),e(f)&&e(l)&&e(l)[e(n)]?(r(),M(W,{key:0,file:e(l)[e(n)],idx:e(n),onContextMenuClick:e(v)},null,8,["file","idx","onContextMenuClick"])):u("",!0)],512)}}});const ue=D(se,[["__scopeId","data-v-2a47e96e"]]);export{ue as default};
import{d as U,x as q,o as r,l as _,c as t,m as a,n as e,p as y,q as h,A as E,t as b,B as L,y as M,J as u,I as S,L as O,Q as D}from"./index-703b9a2d.js";import{i as Q,j,t as J,L as H,R as K,k as W,S as X}from"./fullScreenContextMenu-01c77980.js";import{g as Y,M as Z}from"./db-c7244e20.js";import{u as ee}from"./hook-67165478.js";import"./index-3d320019.js";import"./_baseIteratee-13f7736e.js";import"./button-ae2b29f9.js";const ie={class:"hint"},le={key:1,class:"preview-switch"},se=U({__name:"MatchedImageGrid",props:{tabIdx:null,paneIdx:null,selectedTagIds:null,id:null},setup(V){const m=V,{queue:p,images:l,onContextMenuClickU:v,stackViewEl:T,previewIdx:n,previewing:f,onPreviewVisibleChange:z,previewImgMove:g,canPreview:I,itemSize:k,gridItems:B,showGenInfo:o,imageGenInfo:w,q:$,multiSelectedIdxs:A,onFileItemClick:G,scroller:C,showMenuIdx:d}=ee();return q(()=>m.selectedTagIds,async()=>{var i;const{res:c}=p.pushAction(()=>Y(m.selectedTagIds));l.value=await c,(i=C.value)==null||i.scrollToItem(0)},{immediate:!0}),(c,i)=>{const F=O,N=Z,P=X;return r(),_("div",{class:"container",ref_key:"stackViewEl",ref:T},[t(P,{size:"large",spinning:!e(p).isIdle},{default:a(()=>[t(N,{visible:e(o),"onUpdate:visible":i[1]||(i[1]=s=>y(o)?o.value=s:null),width:"70vw","mask-closable":"",onOk:i[2]||(i[2]=s=>o.value=!1)},{cancelText:a(()=>[]),default:a(()=>[t(F,{active:"",loading:!e($).isIdle},{default:a(()=>[h("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:i[0]||(i[0]=s=>e(E)(e(w)))},[h("div",ie,b(c.$t("doubleClickToCopy")),1),L(" "+b(e(w)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),e(l)?(r(),M(e(Q),{key:0,ref_key:"scroller",ref:C,class:"file-list",items:e(l),"item-size":e(k).first,"key-field":"fullpath","item-secondary-size":e(k).second,gridItems:e(B)},{default:a(({item:s,index:x})=>[t(j,{idx:x,file:s,"show-menu-idx":e(d),"onUpdate:showMenuIdx":i[3]||(i[3]=R=>y(d)?d.value=R:null),onFileItemClick:e(G),"full-screen-preview-image-url":e(l)[e(n)]?e(J)(e(l)[e(n)]):"",selected:e(A).includes(x),onContextMenuClick:e(v),onPreviewVisibleChange:e(z)},null,8,["idx","file","show-menu-idx","onFileItemClick","full-screen-preview-image-url","selected","onContextMenuClick","onPreviewVisibleChange"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):u("",!0),e(f)?(r(),_("div",le,[t(e(H),{onClick:i[4]||(i[4]=s=>e(g)("prev")),class:S({disable:!e(I)("prev")})},null,8,["class"]),t(e(K),{onClick:i[5]||(i[5]=s=>e(g)("next")),class:S({disable:!e(I)("next")})},null,8,["class"])])):u("",!0)]),_:1},8,["spinning"]),e(f)&&e(l)&&e(l)[e(n)]?(r(),M(W,{key:0,file:e(l)[e(n)],idx:e(n),onContextMenuClick:e(v)},null,8,["file","idx","onContextMenuClick"])):u("",!0)],512)}}});const ue=D(se,[["__scopeId","data-v-2a47e96e"]]);export{ue as default};

View File

@ -1 +1 @@
import{d as j,r as B,ac as H,b2 as J,b3 as K,o as a,l as k,c as o,y as m,m as r,B as C,t as v,n as e,J as f,p as $,q as A,A as W,I as V,b7 as X,T as Y,L as Z,Q as ee}from"./index-4a2169ff.js";import{i as te,j as se,t as ie,L as ne,R as le,k as ae,S as oe}from"./fullScreenContextMenu-726eab7c.js";import{I as re}from"./index-30174a88.js";import{a as U,b as ue,d as de,M as ce,u as pe}from"./db-267adb61.js";import{u as me}from"./hook-1a4757cd.js";import{B as ve}from"./button-bdfaf6a0.js";import"./index-aec6f11e.js";import"./_baseIteratee-b77b0e83.js";const fe={key:0,class:"search-bar"},ge={class:"hint"},ke={key:1,class:"preview-switch"},Ce=j({__name:"SubstrSearch",setup(be){const{queue:u,images:n,onContextMenuClickU:b,stackViewEl:D,previewIdx:d,previewing:w,onPreviewVisibleChange:E,previewImgMove:y,canPreview:I,itemSize:_,gridItems:F,showGenInfo:c,imageGenInfo:x,q:R,multiSelectedIdxs:T,onFileItemClick:q,scroller:h,showMenuIdx:g}=me(),p=B(""),s=B();H(async()=>{s.value=await U(),s.value.img_count&&s.value.expired&&S()});const S=J(()=>u.pushAction(async()=>(await pe(),s.value=await U(),s.value)).res),L=async()=>{var i;n.value=await u.pushAction(()=>de(p.value)).res,(i=h.value)==null||i.scrollToItem(0),n.value.length||X.info(Y("fuzzy-search-noResults"))};return K("return-to-iib",async()=>{const i=await u.pushAction(ue).res;s.value.expired=i.expired}),(i,t)=>{const N=re,M=ve,P=Z,G=ce,O=oe;return a(),k("div",{class:"container",ref_key:"stackViewEl",ref:D},[s.value?(a(),k("div",fe,[o(N,{value:p.value,"onUpdate:value":t[0]||(t[0]=l=>p.value=l),placeholder:i.$t("fuzzy-search-placeholder")},null,8,["value","placeholder"]),s.value.expired||!s.value.img_count?(a(),m(M,{key:0,onClick:e(S),loading:!e(u).isIdle,type:"primary"},{default:r(()=>[C(v(s.value.img_count===0?i.$t("generateIndexHint"):i.$t("UpdateIndex")),1)]),_:1},8,["onClick","loading"])):(a(),m(M,{key:1,type:"primary",onClick:L,loading:!e(u).isIdle,disabled:!p.value},{default:r(()=>[C(v(i.$t("search")),1)]),_:1},8,["loading","disabled"]))])):f("",!0),o(O,{size:"large",spinning:!e(u).isIdle},{default:r(()=>[o(G,{visible:e(c),"onUpdate:visible":t[2]||(t[2]=l=>$(c)?c.value=l:null),width:"70vw","mask-closable":"",onOk:t[3]||(t[3]=l=>c.value=!1)},{cancelText:r(()=>[]),default:r(()=>[o(P,{active:"",loading:!e(R).isIdle},{default:r(()=>[A("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:t[1]||(t[1]=l=>e(W)(e(x)))},[A("div",ge,v(i.$t("doubleClickToCopy")),1),C(" "+v(e(x)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),e(n)?(a(),m(e(te),{key:0,ref_key:"scroller",ref:h,class:"file-list",items:e(n),"item-size":e(_).first,"key-field":"fullpath","item-secondary-size":e(_).second,gridItems:e(F)},{default:r(({item:l,index:z})=>[o(se,{idx:z,file:l,"show-menu-idx":e(g),"onUpdate:showMenuIdx":t[4]||(t[4]=Q=>$(g)?g.value=Q:null),onFileItemClick:e(q),"full-screen-preview-image-url":e(n)[e(d)]?e(ie)(e(n)[e(d)]):"",selected:e(T).includes(z),onContextMenuClick:e(b),onPreviewVisibleChange:e(E)},null,8,["idx","file","show-menu-idx","onFileItemClick","full-screen-preview-image-url","selected","onContextMenuClick","onPreviewVisibleChange"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):f("",!0),e(w)?(a(),k("div",ke,[o(e(ne),{onClick:t[5]||(t[5]=l=>e(y)("prev")),class:V({disable:!e(I)("prev")})},null,8,["class"]),o(e(le),{onClick:t[6]||(t[6]=l=>e(y)("next")),class:V({disable:!e(I)("next")})},null,8,["class"])])):f("",!0)]),_:1},8,["spinning"]),e(w)&&e(n)&&e(n)[e(d)]?(a(),m(ae,{key:1,file:e(n)[e(d)],idx:e(d),onContextMenuClick:e(b)},null,8,["file","idx","onContextMenuClick"])):f("",!0)],512)}}});const ze=ee(Ce,[["__scopeId","data-v-2feb1838"]]);export{ze as default};
import{d as j,r as B,ac as H,b2 as J,b3 as K,o as a,l as k,c as o,y as m,m as r,B as C,t as v,n as e,J as f,p as $,q as A,A as W,I as V,b7 as X,T as Y,L as Z,Q as ee}from"./index-703b9a2d.js";import{i as te,j as se,t as ie,L as ne,R as le,k as ae,S as oe}from"./fullScreenContextMenu-01c77980.js";import{I as re}from"./index-75757489.js";import{a as U,b as ue,d as de,M as ce,u as pe}from"./db-c7244e20.js";import{u as me}from"./hook-67165478.js";import{B as ve}from"./button-ae2b29f9.js";import"./index-3d320019.js";import"./_baseIteratee-13f7736e.js";const fe={key:0,class:"search-bar"},ge={class:"hint"},ke={key:1,class:"preview-switch"},Ce=j({__name:"SubstrSearch",setup(be){const{queue:u,images:n,onContextMenuClickU:b,stackViewEl:D,previewIdx:d,previewing:w,onPreviewVisibleChange:E,previewImgMove:y,canPreview:I,itemSize:_,gridItems:F,showGenInfo:c,imageGenInfo:x,q:R,multiSelectedIdxs:T,onFileItemClick:q,scroller:h,showMenuIdx:g}=me(),p=B(""),s=B();H(async()=>{s.value=await U(),s.value.img_count&&s.value.expired&&S()});const S=J(()=>u.pushAction(async()=>(await pe(),s.value=await U(),s.value)).res),L=async()=>{var i;n.value=await u.pushAction(()=>de(p.value)).res,(i=h.value)==null||i.scrollToItem(0),n.value.length||X.info(Y("fuzzy-search-noResults"))};return K("return-to-iib",async()=>{const i=await u.pushAction(ue).res;s.value.expired=i.expired}),(i,t)=>{const N=re,M=ve,P=Z,G=ce,O=oe;return a(),k("div",{class:"container",ref_key:"stackViewEl",ref:D},[s.value?(a(),k("div",fe,[o(N,{value:p.value,"onUpdate:value":t[0]||(t[0]=l=>p.value=l),placeholder:i.$t("fuzzy-search-placeholder")},null,8,["value","placeholder"]),s.value.expired||!s.value.img_count?(a(),m(M,{key:0,onClick:e(S),loading:!e(u).isIdle,type:"primary"},{default:r(()=>[C(v(s.value.img_count===0?i.$t("generateIndexHint"):i.$t("UpdateIndex")),1)]),_:1},8,["onClick","loading"])):(a(),m(M,{key:1,type:"primary",onClick:L,loading:!e(u).isIdle,disabled:!p.value},{default:r(()=>[C(v(i.$t("search")),1)]),_:1},8,["loading","disabled"]))])):f("",!0),o(O,{size:"large",spinning:!e(u).isIdle},{default:r(()=>[o(G,{visible:e(c),"onUpdate:visible":t[2]||(t[2]=l=>$(c)?c.value=l:null),width:"70vw","mask-closable":"",onOk:t[3]||(t[3]=l=>c.value=!1)},{cancelText:r(()=>[]),default:r(()=>[o(P,{active:"",loading:!e(R).isIdle},{default:r(()=>[A("div",{style:{width:"100%","word-break":"break-all","white-space":"pre-line","max-height":"70vh",overflow:"auto"},onDblclick:t[1]||(t[1]=l=>e(W)(e(x)))},[A("div",ge,v(i.$t("doubleClickToCopy")),1),C(" "+v(e(x)),1)],32)]),_:1},8,["loading"])]),_:1},8,["visible"]),e(n)?(a(),m(e(te),{key:0,ref_key:"scroller",ref:h,class:"file-list",items:e(n),"item-size":e(_).first,"key-field":"fullpath","item-secondary-size":e(_).second,gridItems:e(F)},{default:r(({item:l,index:z})=>[o(se,{idx:z,file:l,"show-menu-idx":e(g),"onUpdate:showMenuIdx":t[4]||(t[4]=Q=>$(g)?g.value=Q:null),onFileItemClick:e(q),"full-screen-preview-image-url":e(n)[e(d)]?e(ie)(e(n)[e(d)]):"",selected:e(T).includes(z),onContextMenuClick:e(b),onPreviewVisibleChange:e(E)},null,8,["idx","file","show-menu-idx","onFileItemClick","full-screen-preview-image-url","selected","onContextMenuClick","onPreviewVisibleChange"])]),_:1},8,["items","item-size","item-secondary-size","gridItems"])):f("",!0),e(w)?(a(),k("div",ke,[o(e(ne),{onClick:t[5]||(t[5]=l=>e(y)("prev")),class:V({disable:!e(I)("prev")})},null,8,["class"]),o(e(le),{onClick:t[6]||(t[6]=l=>e(y)("next")),class:V({disable:!e(I)("next")})},null,8,["class"])])):f("",!0)]),_:1},8,["spinning"]),e(w)&&e(n)&&e(n)[e(d)]?(a(),m(ae,{key:1,file:e(n)[e(d)],idx:e(d),onContextMenuClick:e(b)},null,8,["file","idx","onContextMenuClick"])):f("",!0)],512)}}});const ze=ee(Ce,[["__scopeId","data-v-2feb1838"]]);export{ze as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{cc as C,c5 as P,cd as g,ce as m,bB as w,ap as O,aP as h,cf as E,aR as A,cg as R,aN as b,a$ as x}from"./index-4a2169ff.js";function y(e,n){for(var r=0;r<n.length;r++){var t=n[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,C(t.key),t)}}function H(e,n,r){return n&&y(e.prototype,n),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function J(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function D(e){return function(n){return n==null?void 0:n[e]}}var G=function(){return P()&&window.document.documentElement},u,Q=function(){if(!G())return!1;if(u!==void 0)return u;var n=document.createElement("div");return n.style.display="flex",n.style.flexDirection="column",n.style.rowGap="1px",n.appendChild(document.createElement("div")),n.appendChild(document.createElement("div")),document.body.appendChild(n),u=n.scrollHeight===1,document.body.removeChild(n),u},M=1,F=2;function I(e,n,r,t){var i=r.length,s=i,o=!t;if(e==null)return!s;for(e=Object(e);i--;){var f=r[i];if(o&&f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++i<s;){f=r[i];var a=f[0],l=e[a],c=f[1];if(o&&f[2]){if(l===void 0&&!(a in e))return!1}else{var d=new g;if(t)var p=t(l,c,a,e,n,d);if(!(p===void 0?m(c,l,M|F,t,d):p))return!1}}return!0}function _(e){return e===e&&!w(e)}function L(e){for(var n=O(e),r=n.length;r--;){var t=n[r],i=e[t];n[r]=[t,i,_(i)]}return n}function v(e,n){return function(r){return r==null?!1:r[e]===n&&(n!==void 0||e in Object(r))}}function S(e){var n=L(e);return n.length==1&&n[0][2]?v(n[0][0],n[0][1]):function(r){return r===e||I(r,e,n)}}function U(e,n,r){var t=e==null?void 0:h(e,n);return t===void 0?r:t}var K=1,N=2;function T(e,n){return E(e)&&_(n)?v(A(e),n):function(r){var t=U(r,e);return t===void 0&&t===n?R(r,e):m(n,t,K|N)}}function $(e){return function(n){return h(n,e)}}function q(e){return E(e)?D(A(e)):$(e)}function W(e){return typeof e=="function"?e:e==null?b:typeof e=="object"?x(e)?T(e[0],e[1]):S(e):q(e)}export{H as _,J as a,W as b,G as c,Q as d};
import{cc as C,c5 as P,cd as g,ce as m,bB as w,ap as O,aP as h,cf as E,aR as A,cg as R,aN as b,a$ as x}from"./index-703b9a2d.js";function y(e,n){for(var r=0;r<n.length;r++){var t=n[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(e,C(t.key),t)}}function H(e,n,r){return n&&y(e.prototype,n),r&&y(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function J(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")}function D(e){return function(n){return n==null?void 0:n[e]}}var G=function(){return P()&&window.document.documentElement},u,Q=function(){if(!G())return!1;if(u!==void 0)return u;var n=document.createElement("div");return n.style.display="flex",n.style.flexDirection="column",n.style.rowGap="1px",n.appendChild(document.createElement("div")),n.appendChild(document.createElement("div")),document.body.appendChild(n),u=n.scrollHeight===1,document.body.removeChild(n),u},M=1,F=2;function I(e,n,r,t){var i=r.length,s=i,o=!t;if(e==null)return!s;for(e=Object(e);i--;){var f=r[i];if(o&&f[2]?f[1]!==e[f[0]]:!(f[0]in e))return!1}for(;++i<s;){f=r[i];var a=f[0],l=e[a],c=f[1];if(o&&f[2]){if(l===void 0&&!(a in e))return!1}else{var d=new g;if(t)var p=t(l,c,a,e,n,d);if(!(p===void 0?m(c,l,M|F,t,d):p))return!1}}return!0}function _(e){return e===e&&!w(e)}function L(e){for(var n=O(e),r=n.length;r--;){var t=n[r],i=e[t];n[r]=[t,i,_(i)]}return n}function v(e,n){return function(r){return r==null?!1:r[e]===n&&(n!==void 0||e in Object(r))}}function S(e){var n=L(e);return n.length==1&&n[0][2]?v(n[0][0],n[0][1]):function(r){return r===e||I(r,e,n)}}function U(e,n,r){var t=e==null?void 0:h(e,n);return t===void 0?r:t}var K=1,N=2;function T(e,n){return E(e)&&_(n)?v(A(e),n):function(r){var t=U(r,e);return t===void 0&&t===n?R(r,e):m(n,t,K|N)}}function $(e){return function(n){return h(n,e)}}function q(e){return E(e)?D(A(e)):$(e)}function W(e){return typeof e=="function"?e:e==null?b:typeof e=="object"?x(e)?T(e[0],e[1]):S(e):q(e)}export{H as _,J as a,W as b,G as c,Q as d};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{c as w,R as L,d as x,v as B,T as f,U as O,o,l as c,q as s,t as r,J as h,n as d,z as k,s as v,C as g,m as F,B as M,V as q,W as N,X as V,Y as j,Z as H,Q as P}from"./index-4a2169ff.js";import{B as R}from"./button-bdfaf6a0.js";var E={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm376 116c-119.3 0-216 96.7-216 216s96.7 216 216 216 216-96.7 216-216-96.7-216-216-216zm107.5 323.5C750.8 868.2 712.6 884 672 884s-78.8-15.8-107.5-44.5C535.8 810.8 520 772.6 520 732s15.8-78.8 44.5-107.5C593.2 595.8 631.4 580 672 580s78.8 15.8 107.5 44.5C808.2 653.2 824 691.4 824 732s-15.8 78.8-44.5 107.5zM761 656h-44.3c-2.6 0-5 1.2-6.5 3.3l-63.5 87.8-23.1-31.9a7.92 7.92 0 00-6.5-3.3H573c-6.5 0-10.3 7.4-6.5 12.7l73.8 102.1c3.2 4.4 9.7 4.4 12.9 0l114.2-158c3.9-5.3.1-12.7-6.4-12.7zM440 852H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"file-done",theme:"outlined"};const T=E;function D(a){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?Object(arguments[l]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable}))),i.forEach(function(u){W(a,u,t[u])})}return a}function W(a,l,t){return l in a?Object.defineProperty(a,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[l]=t,a}var C=function(l,t){var i=D({},l,t.attrs);return w(L,D({},i,{icon:T}),null)};C.displayName="FileDoneOutlined";C.inheritAttrs=!1;const A=C,Q=a=>(j("data-v-4cfb5adf"),a=a(),H(),a),G={class:"container"},J={class:"header"},U=Q(()=>s("div",{"flex-placeholder":""},null,-1)),X={class:"last-record"},Y=["onClick"],Z={href:"https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/90",target:"_blank",class:"last-record"},K={class:"content"},ee={key:0,class:"quick-start"},te={key:1,class:"quick-start"},se=["onClick"],ne={class:"quick-start__text line-clamp-1"},ae={class:"quick-start"},oe=["onClick"],ce={class:"quick-start__text line-clamp-1"},le={key:2,class:"quick-start"},re=["onClick"],ie={class:"quick-start__text line-clamp-1"},ue=x({__name:"emptyStartup",props:{tabIdx:null,paneIdx:null},setup(a){const l=a,t=B(),i={local:f("local"),"tag-search":f("imgSearch"),"fuzzy-search":f("fuzzy-search"),"global-setting":f("globalSettings")},u=(e,_,b=!1)=>{let p;switch(e){case"tag-search-matched-image-grid":return;case"global-setting":case"tag-search":case"fuzzy-search":case"empty":p={type:e,name:i[e],key:Date.now()+q()};break;case"local":p={type:e,name:i[e],key:Date.now()+q(),path:_,walkMode:b}}const n=t.tabList[l.tabIdx];n.panes.splice(l.paneIdx,1,p),n.key=p.key},m=O(()=>{var e;return(e=t.lastTabListRecord)==null?void 0:e[1]});console.log(m.value);const z=O(()=>t.autoCompletedDirList.filter(({key:e})=>e==="outdir_txt2img_samples"||e==="outdir_img2img_samples")),I=window.parent!==window,S=()=>window.parent.open("/infinite_image_browsing"),$=()=>{N(m.value),t.tabList=m.value.tabs.map(e=>V(e,!0)),t.tabList.forEach(e=>{e.panes.forEach(_=>{typeof _.name!="string"&&(_.name="")})})};return(e,_)=>{var p;const b=R;return o(),c("div",G,[s("div",J,[s("h1",null,r(e.$t("welcome")),1),U,I?(o(),c("div",{key:0,class:"last-record",onClick:S},[s("a",null,r(e.$t("openInNewWindow")),1)])):h("",!0),s("div",X,[(p=d(m))!=null&&p.tabs.length?(o(),c("a",{key:0,onClick:k($,["prevent"])},r(e.$t("restoreLastRecord")),9,Y)):h("",!0)]),s("a",Z,r(e.$t("faq")),1)]),s("div",K,[d(z).length?(o(),c("div",ee,[s("h2",null,r(e.$t("walkMode")),1),s("ul",null,[(o(!0),c(v,null,g(d(z),n=>(o(),c("li",{key:n.dir,class:"quick-start__item"},[w(b,{onClick:y=>u("local",n.dir,!0),ghost:"",type:"primary",block:""},{default:F(()=>[M(r(n.zh),1)]),_:2},1032,["onClick"])]))),128))])])):h("",!0),d(t).autoCompletedDirList.length?(o(),c("div",te,[s("h2",null,r(e.$t("launchFromQuickMove")),1),s("ul",null,[(o(!0),c(v,null,g(d(t).autoCompletedDirList,n=>(o(),c("li",{key:n.key,class:"quick-start__item",onClick:k(y=>u("local",n.dir),["prevent"])},[s("span",ne,r(n.zh),1)],8,se))),128))])])):h("",!0),s("div",ae,[s("h2",null,r(e.$t("launch")),1),s("ul",null,[(o(!0),c(v,null,g(Object.keys(i),n=>(o(),c("li",{key:n,class:"quick-start__item",onClick:k(y=>u(n),["prevent"])},[s("span",ce,r(i[n]),1)],8,oe))),128))])]),d(t).recent.length?(o(),c("div",le,[s("h2",null,r(e.$t("recent")),1),s("ul",null,[(o(!0),c(v,null,g(d(t).recent,n=>(o(),c("li",{key:n.key,class:"quick-start__item",onClick:k(y=>u("local",n.path),["prevent"])},[w(d(A),{class:"quick-start__icon"}),s("span",ie,r(n.path),1)],8,re))),128))])])):h("",!0)])])}}});const _e=P(ue,[["__scopeId","data-v-4cfb5adf"]]);export{_e as default};
import{c as w,R as L,d as x,v as B,T as f,U as O,o,l as c,q as s,t as r,J as h,n as d,z as k,s as v,C as g,m as F,B as M,V as q,W as N,X as V,Y as j,Z as H,Q as P}from"./index-703b9a2d.js";import{B as R}from"./button-ae2b29f9.js";var E={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M688 312v-48c0-4.4-3.6-8-8-8H296c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h384c4.4 0 8-3.6 8-8zm-392 88c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h184c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H296zm376 116c-119.3 0-216 96.7-216 216s96.7 216 216 216 216-96.7 216-216-96.7-216-216-216zm107.5 323.5C750.8 868.2 712.6 884 672 884s-78.8-15.8-107.5-44.5C535.8 810.8 520 772.6 520 732s15.8-78.8 44.5-107.5C593.2 595.8 631.4 580 672 580s78.8 15.8 107.5 44.5C808.2 653.2 824 691.4 824 732s-15.8 78.8-44.5 107.5zM761 656h-44.3c-2.6 0-5 1.2-6.5 3.3l-63.5 87.8-23.1-31.9a7.92 7.92 0 00-6.5-3.3H573c-6.5 0-10.3 7.4-6.5 12.7l73.8 102.1c3.2 4.4 9.7 4.4 12.9 0l114.2-158c3.9-5.3.1-12.7-6.4-12.7zM440 852H208V148h560v344c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8V108c0-17.7-14.3-32-32-32H168c-17.7 0-32 14.3-32 32v784c0 17.7 14.3 32 32 32h272c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8z"}}]},name:"file-done",theme:"outlined"};const T=E;function D(a){for(var l=1;l<arguments.length;l++){var t=arguments[l]!=null?Object(arguments[l]):{},i=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(i=i.concat(Object.getOwnPropertySymbols(t).filter(function(u){return Object.getOwnPropertyDescriptor(t,u).enumerable}))),i.forEach(function(u){W(a,u,t[u])})}return a}function W(a,l,t){return l in a?Object.defineProperty(a,l,{value:t,enumerable:!0,configurable:!0,writable:!0}):a[l]=t,a}var C=function(l,t){var i=D({},l,t.attrs);return w(L,D({},i,{icon:T}),null)};C.displayName="FileDoneOutlined";C.inheritAttrs=!1;const A=C,Q=a=>(j("data-v-4cfb5adf"),a=a(),H(),a),G={class:"container"},J={class:"header"},U=Q(()=>s("div",{"flex-placeholder":""},null,-1)),X={class:"last-record"},Y=["onClick"],Z={href:"https://github.com/zanllp/sd-webui-infinite-image-browsing/issues/90",target:"_blank",class:"last-record"},K={class:"content"},ee={key:0,class:"quick-start"},te={key:1,class:"quick-start"},se=["onClick"],ne={class:"quick-start__text line-clamp-1"},ae={class:"quick-start"},oe=["onClick"],ce={class:"quick-start__text line-clamp-1"},le={key:2,class:"quick-start"},re=["onClick"],ie={class:"quick-start__text line-clamp-1"},ue=x({__name:"emptyStartup",props:{tabIdx:null,paneIdx:null},setup(a){const l=a,t=B(),i={local:f("local"),"tag-search":f("imgSearch"),"fuzzy-search":f("fuzzy-search"),"global-setting":f("globalSettings")},u=(e,_,b=!1)=>{let p;switch(e){case"tag-search-matched-image-grid":return;case"global-setting":case"tag-search":case"fuzzy-search":case"empty":p={type:e,name:i[e],key:Date.now()+q()};break;case"local":p={type:e,name:i[e],key:Date.now()+q(),path:_,walkMode:b}}const n=t.tabList[l.tabIdx];n.panes.splice(l.paneIdx,1,p),n.key=p.key},m=O(()=>{var e;return(e=t.lastTabListRecord)==null?void 0:e[1]});console.log(m.value);const z=O(()=>t.autoCompletedDirList.filter(({key:e})=>e==="outdir_txt2img_samples"||e==="outdir_img2img_samples")),I=window.parent!==window,S=()=>window.parent.open("/infinite_image_browsing"),$=()=>{N(m.value),t.tabList=m.value.tabs.map(e=>V(e,!0)),t.tabList.forEach(e=>{e.panes.forEach(_=>{typeof _.name!="string"&&(_.name="")})})};return(e,_)=>{var p;const b=R;return o(),c("div",G,[s("div",J,[s("h1",null,r(e.$t("welcome")),1),U,I?(o(),c("div",{key:0,class:"last-record",onClick:S},[s("a",null,r(e.$t("openInNewWindow")),1)])):h("",!0),s("div",X,[(p=d(m))!=null&&p.tabs.length?(o(),c("a",{key:0,onClick:k($,["prevent"])},r(e.$t("restoreLastRecord")),9,Y)):h("",!0)]),s("a",Z,r(e.$t("faq")),1)]),s("div",K,[d(z).length?(o(),c("div",ee,[s("h2",null,r(e.$t("walkMode")),1),s("ul",null,[(o(!0),c(v,null,g(d(z),n=>(o(),c("li",{key:n.dir,class:"quick-start__item"},[w(b,{onClick:y=>u("local",n.dir,!0),ghost:"",type:"primary",block:""},{default:F(()=>[M(r(n.zh),1)]),_:2},1032,["onClick"])]))),128))])])):h("",!0),d(t).autoCompletedDirList.length?(o(),c("div",te,[s("h2",null,r(e.$t("launchFromQuickMove")),1),s("ul",null,[(o(!0),c(v,null,g(d(t).autoCompletedDirList,n=>(o(),c("li",{key:n.key,class:"quick-start__item",onClick:k(y=>u("local",n.dir),["prevent"])},[s("span",ne,r(n.zh),1)],8,se))),128))])])):h("",!0),s("div",ae,[s("h2",null,r(e.$t("launch")),1),s("ul",null,[(o(!0),c(v,null,g(Object.keys(i),n=>(o(),c("li",{key:n,class:"quick-start__item",onClick:k(y=>u(n),["prevent"])},[s("span",ce,r(i[n]),1)],8,oe))),128))])]),d(t).recent.length?(o(),c("div",le,[s("h2",null,r(e.$t("recent")),1),s("ul",null,[(o(!0),c(v,null,g(d(t).recent,n=>(o(),c("li",{key:n.key,class:"quick-start__item",onClick:k(y=>u("local",n.path),["prevent"])},[w(d(A),{class:"quick-start__icon"}),s("span",ie,r(n.path),1)],8,re))),128))])])):h("",!0)])])}}});const _e=P(ue,[["__scopeId","data-v-4cfb5adf"]]);export{_e as default};

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
import{r as l,b1 as S,aN as y}from"./index-4a2169ff.js";import{u as q,b as P,f as z,c as G,d as N,e as Q}from"./fullScreenContextMenu-726eab7c.js";const D=()=>{const e=l(),c=S(),o=l(),s={tabIdx:-1,target:"local",paneIdx:-1,walkMode:!1},{stackViewEl:u,multiSelectedIdxs:t,stack:r}=q().toRefs(),{itemSize:f,gridItems:m}=P(s),{showMenuIdx:v}=z();G();const{showGenInfo:I,imageGenInfo:d,q:p,onContextMenuClick:i,onFileItemClick:w}=N(s,{openNext:y}),{previewIdx:k,previewing:g,onPreviewVisibleChange:x,previewImgMove:C,canPreview:M}=Q(s,{scroller:o,files:e});return{scroller:o,queue:c,images:e,onContextMenuClickU:async(a,b,n)=>{r.value=[{curr:"",files:e.value}];const h=t.value.includes(n)?t.value:[n];await i(a,b,n),a.key==="deleteFiles"&&(e.value=e.value.filter((U,F)=>!h.includes(F)))},stackViewEl:u,previewIdx:k,previewing:g,onPreviewVisibleChange:x,previewImgMove:C,canPreview:M,itemSize:f,gridItems:m,showGenInfo:I,imageGenInfo:d,q:p,onContextMenuClick:i,onFileItemClick:w,showMenuIdx:v,multiSelectedIdxs:t}};export{D as u};
import{r as l,b1 as S,aN as y}from"./index-703b9a2d.js";import{u as q,b as P,f as z,c as G,d as N,e as Q}from"./fullScreenContextMenu-01c77980.js";const D=()=>{const e=l(),c=S(),o=l(),s={tabIdx:-1,target:"local",paneIdx:-1,walkMode:!1},{stackViewEl:u,multiSelectedIdxs:t,stack:r}=q().toRefs(),{itemSize:f,gridItems:m}=P(s),{showMenuIdx:v}=z();G();const{showGenInfo:I,imageGenInfo:d,q:p,onContextMenuClick:i,onFileItemClick:w}=N(s,{openNext:y}),{previewIdx:k,previewing:g,onPreviewVisibleChange:x,previewImgMove:C,canPreview:M}=Q(s,{scroller:o,files:e});return{scroller:o,queue:c,images:e,onContextMenuClickU:async(a,b,n)=>{r.value=[{curr:"",files:e.value}];const h=t.value.includes(n)?t.value:[n];await i(a,b,n),a.key==="deleteFiles"&&(e.value=e.value.filter((U,F)=>!h.includes(F)))},stackViewEl:u,previewIdx:k,previewing:g,onPreviewVisibleChange:x,previewImgMove:C,canPreview:M,itemSize:f,gridItems:m,showGenInfo:I,imageGenInfo:d,q:p,onContextMenuClick:i,onFileItemClick:w,showMenuIdx:v,multiSelectedIdxs:t}};export{D as u};

View File

@ -1 +1 @@
import{aO as n,bd as c,be as a}from"./index-4a2169ff.js";var i="[object Object]",s=Function.prototype,b=Object.prototype,e=s.toString,p=b.hasOwnProperty,f=e.call(Object);function j(o){if(!n(o)||c(o)!=i)return!1;var r=a(o);if(r===null)return!0;var t=p.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&e.call(t)==f}export{j as i};
import{aO as n,bd as c,be as a}from"./index-703b9a2d.js";var i="[object Object]",s=Function.prototype,b=Object.prototype,e=s.toString,p=b.hasOwnProperty,f=e.call(Object);function j(o){if(!n(o)||c(o)!=i)return!1;var r=a(o);if(r===null)return!0;var t=p.call(r,"constructor")&&r.constructor;return typeof t=="function"&&t instanceof t&&e.call(t)==f}export{j as i};

View File

@ -1 +1 @@
import{c2 as i}from"./index-4a2169ff.js";var r=1/0,o=17976931348623157e292;function s(n){if(!n)return n===0?n:0;if(n=i(n),n===r||n===-r){var t=n<0?-1:1;return t*o}return n===n?n:0}function c(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}export{c as l,s as t};
import{c2 as i}from"./index-703b9a2d.js";var r=1/0,o=17976931348623157e292;function s(n){if(!n)return n===0?n:0;if(n=i(n),n===r||n===-r){var t=n<0?-1:1;return t*o}return n===n?n:0}function c(n){var t=n==null?0:n.length;return t?n[t-1]:void 0}export{c as l,s as t};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
import{i as Pe,I as P,t as Ie,f as Be,C as Oe,a as Fe,r as ie}from"./index-30174a88.js";import{d as Q,u as te,U as q,h as S,c as _,a as f,a4 as ce,P as Ne,r as F,_ as Ee,b8 as $e,a8 as Te,a1 as ne,a7 as ae,$ as je,a3 as H,w as Ve,x as Re,ad as J,ac as ke,b9 as De,ba as Le,bb as Ge,bc as _e,j as Ue,aA as He,i as ee,b as de,R as Ze,an as Ye}from"./index-4a2169ff.js";import{E as qe}from"./db-267adb61.js";import{i as Qe}from"./index-f4c27e0f.js";import{B as We}from"./button-bdfaf6a0.js";const Xe=Q({compatConfig:{MODE:3},name:"AInputGroup",props:{prefixCls:String,size:{type:String},compact:{type:Boolean,default:void 0},onMouseenter:{type:Function},onMouseleave:{type:Function},onFocus:{type:Function},onBlur:{type:Function}},setup:function(e,n){var a=n.slots,c=te("input-group",e),b=c.prefixCls,m=c.direction,i=q(function(){var l,d=b.value;return l={},S(l,"".concat(d),!0),S(l,"".concat(d,"-lg"),e.size==="large"),S(l,"".concat(d,"-sm"),e.size==="small"),S(l,"".concat(d,"-compact"),e.compact),S(l,"".concat(d,"-rtl"),m.value==="rtl"),l});return function(){var l;return _("span",{class:i.value,onMouseenter:e.onMouseenter,onMouseleave:e.onMouseleave,onFocus:e.onFocus,onBlur:e.onBlur},[(l=a.default)===null||l===void 0?void 0:l.call(a)])}}});var oe=/iPhone/i,fe=/iPod/i,ge=/iPad/i,le=/\bAndroid(?:.+)Mobile\b/i,me=/Android/i,Z=/\bAndroid(?:.+)SD4930UR\b/i,K=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,k=/Windows Phone/i,be=/\bWindows(?:.+)ARM\b/i,pe=/BlackBerry/i,he=/BB10/i,xe=/Opera Mini/i,ye=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ce=/Mobile(?:.+)Firefox\b/i;function r(o,e){return o.test(e)}function ze(o){var e=o||(typeof navigator<"u"?navigator.userAgent:""),n=e.split("[FBAN");if(typeof n[1]<"u"){var a=n,c=ce(a,1);e=c[0]}if(n=e.split("Twitter"),typeof n[1]<"u"){var b=n,m=ce(b,1);e=m[0]}var i={apple:{phone:r(oe,e)&&!r(k,e),ipod:r(fe,e),tablet:!r(oe,e)&&r(ge,e)&&!r(k,e),device:(r(oe,e)||r(fe,e)||r(ge,e))&&!r(k,e)},amazon:{phone:r(Z,e),tablet:!r(Z,e)&&r(K,e),device:r(Z,e)||r(K,e)},android:{phone:!r(k,e)&&r(Z,e)||!r(k,e)&&r(le,e),tablet:!r(k,e)&&!r(Z,e)&&!r(le,e)&&(r(K,e)||r(me,e)),device:!r(k,e)&&(r(Z,e)||r(K,e)||r(le,e)||r(me,e))||r(/\bokhttp\b/i,e)},windows:{phone:r(k,e),tablet:r(be,e),device:r(k,e)||r(be,e)},other:{blackberry:r(pe,e),blackberry10:r(he,e),opera:r(xe,e),firefox:r(Ce,e),chrome:r(ye,e),device:r(pe,e)||r(he,e)||r(xe,e)||r(Ce,e)||r(ye,e)},any:null,phone:null,tablet:null};return i.any=i.apple.device||i.android.device||i.windows.device||i.other.device,i.phone=i.apple.phone||i.android.phone||i.windows.phone,i.tablet=i.apple.tablet||i.android.tablet||i.windows.tablet,i}var Ke=f(f({},ze()),{},{isMobile:ze});const Je=Ke;var et=["disabled","loading","addonAfter","suffix"];const tt=Q({compatConfig:{MODE:3},name:"AInputSearch",inheritAttrs:!1,props:f(f({},Pe()),{},{inputPrefixCls:String,enterButton:Ne.any,onSearch:{type:Function}}),setup:function(e,n){var a=n.slots,c=n.attrs,b=n.expose,m=n.emit,i=F(),l=function(){var u;(u=i.value)===null||u===void 0||u.focus()},d=function(){var u;(u=i.value)===null||u===void 0||u.blur()};b({focus:l,blur:d});var y=function(u){m("update:value",u.target.value),u&&u.target&&u.type==="click"&&m("search",u.target.value,u),m("change",u)},p=function(u){var C;document.activeElement===((C=i.value)===null||C===void 0?void 0:C.input)&&u.preventDefault()},A=function(u){var C;m("search",(C=i.value)===null||C===void 0?void 0:C.stateValue,u),Je.tablet||i.value.focus()},I=te("input-search",e),E=I.prefixCls,j=I.getPrefixCls,N=I.direction,w=I.size,s=q(function(){return j("input",e.inputPrefixCls)});return function(){var g,u,C,M,R,B=e.disabled,$=e.loading,G=e.addonAfter,V=G===void 0?(g=a.addonAfter)===null||g===void 0?void 0:g.call(a):G,W=e.suffix,X=W===void 0?(u=a.suffix)===null||u===void 0?void 0:u.call(a):W,re=Ee(e,et),h=e.enterButton,t=h===void 0?(C=(M=a.enterButton)===null||M===void 0?void 0:M.call(a))!==null&&C!==void 0?C:!1:h;t=t||t==="";var v=typeof t=="boolean"?_($e,null,null):null,x="".concat(E.value,"-button"),z=Array.isArray(t)?t[0]:t,T,U=z.type&&Qe(z.type)&&z.type.__ANT_BUTTON;if(U||z.tagName==="button")T=Te(z,f({onMousedown:p,onClick:A,key:"enterButton"},U?{class:x,size:w.value}:{}),!1);else{var D=v&&!t;T=_(We,{class:x,type:t?"primary":void 0,size:w.value,disabled:B,key:"enterButton",onMousedown:p,onClick:A,loading:$,icon:D?v:null},{default:function(){return[D?null:v||t]}})}V&&(T=[T,V]);var L=ne(E.value,(R={},S(R,"".concat(E.value,"-rtl"),N.value==="rtl"),S(R,"".concat(E.value,"-").concat(w.value),!!w.value),S(R,"".concat(E.value,"-with-button"),!!t),R),c.class);return _(P,f(f(f({ref:i},ae(re,["onUpdate:value","onSearch","enterButton"])),c),{},{onPressEnter:A,size:w.value,prefixCls:s.value,addonAfter:T,suffix:X,onChange:y,class:L,disabled:B}),a)}}});var nt=`
import{i as Pe,I as P,t as Ie,f as Be,C as Oe,a as Fe,r as ie}from"./index-75757489.js";import{d as Q,u as te,U as q,h as S,c as _,a as f,a4 as ce,P as Ne,r as F,_ as Ee,b8 as $e,a8 as Te,a1 as ne,a7 as ae,$ as je,a3 as H,w as Ve,x as Re,ad as J,ac as ke,b9 as De,ba as Le,bb as Ge,bc as _e,j as Ue,aA as He,i as ee,b as de,R as Ze,an as Ye}from"./index-703b9a2d.js";import{E as qe}from"./db-c7244e20.js";import{i as Qe}from"./index-017a2b46.js";import{B as We}from"./button-ae2b29f9.js";const Xe=Q({compatConfig:{MODE:3},name:"AInputGroup",props:{prefixCls:String,size:{type:String},compact:{type:Boolean,default:void 0},onMouseenter:{type:Function},onMouseleave:{type:Function},onFocus:{type:Function},onBlur:{type:Function}},setup:function(e,n){var a=n.slots,c=te("input-group",e),b=c.prefixCls,m=c.direction,i=q(function(){var l,d=b.value;return l={},S(l,"".concat(d),!0),S(l,"".concat(d,"-lg"),e.size==="large"),S(l,"".concat(d,"-sm"),e.size==="small"),S(l,"".concat(d,"-compact"),e.compact),S(l,"".concat(d,"-rtl"),m.value==="rtl"),l});return function(){var l;return _("span",{class:i.value,onMouseenter:e.onMouseenter,onMouseleave:e.onMouseleave,onFocus:e.onFocus,onBlur:e.onBlur},[(l=a.default)===null||l===void 0?void 0:l.call(a)])}}});var oe=/iPhone/i,fe=/iPod/i,ge=/iPad/i,le=/\bAndroid(?:.+)Mobile\b/i,me=/Android/i,Z=/\bAndroid(?:.+)SD4930UR\b/i,K=/\bAndroid(?:.+)(?:KF[A-Z]{2,4})\b/i,k=/Windows Phone/i,be=/\bWindows(?:.+)ARM\b/i,pe=/BlackBerry/i,he=/BB10/i,xe=/Opera Mini/i,ye=/\b(CriOS|Chrome)(?:.+)Mobile/i,Ce=/Mobile(?:.+)Firefox\b/i;function r(o,e){return o.test(e)}function ze(o){var e=o||(typeof navigator<"u"?navigator.userAgent:""),n=e.split("[FBAN");if(typeof n[1]<"u"){var a=n,c=ce(a,1);e=c[0]}if(n=e.split("Twitter"),typeof n[1]<"u"){var b=n,m=ce(b,1);e=m[0]}var i={apple:{phone:r(oe,e)&&!r(k,e),ipod:r(fe,e),tablet:!r(oe,e)&&r(ge,e)&&!r(k,e),device:(r(oe,e)||r(fe,e)||r(ge,e))&&!r(k,e)},amazon:{phone:r(Z,e),tablet:!r(Z,e)&&r(K,e),device:r(Z,e)||r(K,e)},android:{phone:!r(k,e)&&r(Z,e)||!r(k,e)&&r(le,e),tablet:!r(k,e)&&!r(Z,e)&&!r(le,e)&&(r(K,e)||r(me,e)),device:!r(k,e)&&(r(Z,e)||r(K,e)||r(le,e)||r(me,e))||r(/\bokhttp\b/i,e)},windows:{phone:r(k,e),tablet:r(be,e),device:r(k,e)||r(be,e)},other:{blackberry:r(pe,e),blackberry10:r(he,e),opera:r(xe,e),firefox:r(Ce,e),chrome:r(ye,e),device:r(pe,e)||r(he,e)||r(xe,e)||r(Ce,e)||r(ye,e)},any:null,phone:null,tablet:null};return i.any=i.apple.device||i.android.device||i.windows.device||i.other.device,i.phone=i.apple.phone||i.android.phone||i.windows.phone,i.tablet=i.apple.tablet||i.android.tablet||i.windows.tablet,i}var Ke=f(f({},ze()),{},{isMobile:ze});const Je=Ke;var et=["disabled","loading","addonAfter","suffix"];const tt=Q({compatConfig:{MODE:3},name:"AInputSearch",inheritAttrs:!1,props:f(f({},Pe()),{},{inputPrefixCls:String,enterButton:Ne.any,onSearch:{type:Function}}),setup:function(e,n){var a=n.slots,c=n.attrs,b=n.expose,m=n.emit,i=F(),l=function(){var u;(u=i.value)===null||u===void 0||u.focus()},d=function(){var u;(u=i.value)===null||u===void 0||u.blur()};b({focus:l,blur:d});var y=function(u){m("update:value",u.target.value),u&&u.target&&u.type==="click"&&m("search",u.target.value,u),m("change",u)},p=function(u){var C;document.activeElement===((C=i.value)===null||C===void 0?void 0:C.input)&&u.preventDefault()},A=function(u){var C;m("search",(C=i.value)===null||C===void 0?void 0:C.stateValue,u),Je.tablet||i.value.focus()},I=te("input-search",e),E=I.prefixCls,j=I.getPrefixCls,N=I.direction,w=I.size,s=q(function(){return j("input",e.inputPrefixCls)});return function(){var g,u,C,M,R,B=e.disabled,$=e.loading,G=e.addonAfter,V=G===void 0?(g=a.addonAfter)===null||g===void 0?void 0:g.call(a):G,W=e.suffix,X=W===void 0?(u=a.suffix)===null||u===void 0?void 0:u.call(a):W,re=Ee(e,et),h=e.enterButton,t=h===void 0?(C=(M=a.enterButton)===null||M===void 0?void 0:M.call(a))!==null&&C!==void 0?C:!1:h;t=t||t==="";var v=typeof t=="boolean"?_($e,null,null):null,x="".concat(E.value,"-button"),z=Array.isArray(t)?t[0]:t,T,U=z.type&&Qe(z.type)&&z.type.__ANT_BUTTON;if(U||z.tagName==="button")T=Te(z,f({onMousedown:p,onClick:A,key:"enterButton"},U?{class:x,size:w.value}:{}),!1);else{var D=v&&!t;T=_(We,{class:x,type:t?"primary":void 0,size:w.value,disabled:B,key:"enterButton",onMousedown:p,onClick:A,loading:$,icon:D?v:null},{default:function(){return[D?null:v||t]}})}V&&(T=[T,V]);var L=ne(E.value,(R={},S(R,"".concat(E.value,"-rtl"),N.value==="rtl"),S(R,"".concat(E.value,"-").concat(w.value),!!w.value),S(R,"".concat(E.value,"-with-button"),!!t),R),c.class);return _(P,f(f(f({ref:i},ae(re,["onUpdate:value","onSearch","enterButton"])),c),{},{onPressEnter:A,size:w.value,prefixCls:s.value,addonAfter:T,suffix:X,onChange:y,class:L,disabled:B}),a)}}});var nt=`
min-height:0 !important;
max-height:none !important;
height:0 !important;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
vue/dist/index.html vendored
View File

@ -7,7 +7,7 @@
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-4a2169ff.js"></script>
<script type="module" crossorigin src="/infinite_image_browsing/fe-static/assets/index-703b9a2d.js"></script>
<link rel="stylesheet" href="/infinite_image_browsing/fe-static/assets/index-050489b7.css">
</head>

View File

@ -10,21 +10,20 @@ export interface FileNodeInfo {
fullpath: string
}
export const getTargetFolderFiles = async (target: 'local' , folder_path: string) => {
const resp = await axiosInst.get(`/files/${target}`, { params: { folder_path } })
export const getTargetFolderFiles = async (folder_path: string) => {
const resp = await axiosInst.get(`/files`, { params: { folder_path } })
return resp.data as { files: FileNodeInfo[] }
}
export const deleteFiles = async (target: 'local' , file_paths: string[]) => {
const resp = await axiosInst.post(`/delete_files/${target}`, { file_paths })
export const deleteFiles = async (file_paths: string[]) => {
const resp = await axiosInst.post(`/delete_files`, { file_paths })
return resp.data as { files: FileNodeInfo[] }
}
export const moveFiles = async (
target: 'local' ,
file_paths: string[],
dest: string
) => {
const resp = await axiosInst.post(`/move_files/${target}`, { file_paths, dest })
const resp = await axiosInst.post(`/move_files`, { file_paths, dest })
return resp.data as { files: FileNodeInfo[] }
}

View File

@ -30,11 +30,12 @@ export const stackCache = new Map<string, Page[]>()
const global = useGlobalStore()
const imgTransferBus = new BroadcastChannel('iib-image-transfer-bus')
const encode = encodeURIComponent
export const toRawFileUrl = (file: FileNodeInfo, download = false) =>
`/infinite_image_browsing/file?filename=${encodeURIComponent(file.fullpath)}${download ? `&disposition=${encodeURIComponent(file.name)}` : ''
`/infinite_image_browsing/file?filename=${encode(file.fullpath)}&created_time=${encode(file.created_time)}${download ? `&disposition=${encode(file.name)}` : ''
}`
export const toImageThumbnailUrl = (file: FileNodeInfo, size: string) =>
`/infinite_image_browsing/image-thumbnail?path=${encodeURIComponent(file.fullpath)}&size=${size}`
`/infinite_image_browsing/image-thumbnail?path=${encode(file.fullpath)}&size=${size}&created_time=${encode(file.created_time)}`
const { eventEmitter: events, useEventListen } = typedEventEmitter<{
removeFiles(_:{ paths: string[]; loc: string }): void
@ -275,7 +276,7 @@ export function useLocation (props: Props) {
onMounted(async () => {
if (!stack.value.length) {
// 有传入stack时直接使用传入的
const resp = await getTargetFolderFiles('local', '/')
const resp = await getTargetFolderFiles('/')
stack.value.push({
files: resp.files,
curr: '/'
@ -325,7 +326,7 @@ export function useLocation (props: Props) {
}
try {
np.value?.start()
const { files } = await getTargetFolderFiles('local', file.fullpath)
const { files } = await getTargetFolderFiles(file.fullpath)
stack.value.push({
files,
curr: file.name
@ -396,10 +397,7 @@ export function useLocation (props: Props) {
back(0)
await handleWalkModeTo(walkModePath.value)
} else {
const { files } = await getTargetFolderFiles(
'local',
stack.value.length === 1 ? '/' : currLocation.value
)
const { files } = await getTargetFolderFiles(stack.value.length === 1 ? '/' : currLocation.value)
last(stack.value)!.files = files
}
scroller.value?.scrollToItem(0)
@ -413,10 +411,7 @@ export function useLocation (props: Props) {
if (!props.walkMode) {
try {
np.value?.start()
const { files } = await getTargetFolderFiles(
'local',
stack.value.length === 1 ? '/' : currLocation.value
)
const { files } = await getTargetFolderFiles( stack.value.length === 1 ? '/' : currLocation.value)
const currFiles = last(stack.value)!.files
if (currFiles.map(v => v.date).join() !== files.map(v => v.date).join()) {
last(stack.value)!.files = files
@ -513,7 +508,7 @@ export function useFilesDisplay (props: Props) {
if (currIdx !== -1) {
const next = parFilesSorted[currIdx + 1]
const p = Path.join(currLocation.value, '../', next.name)
const r = await getTargetFolderFiles('local', p)
const r = await getTargetFolderFiles(p)
const page = currPage.value!
page.curr = next.name
if (!page.walkFiles) {
@ -617,7 +612,7 @@ export function useFileTransfer () {
content,
maskClosable: true,
async onOk () {
await moveFiles('local', data.path, toPath)
await moveFiles(data.path, toPath)
events.emit('removeFiles', { paths: data.path, loc: data.loc })
await eventEmitter.value.emit('refresh')
}
@ -761,7 +756,7 @@ export function useFileItemActions (
}
const absolutePath = Path.normalizeRelativePathToAbsolute(dir.dir, global.conf?.sd_cwd!)
const selectedImg = getSelectedImg()
await moveFiles('local', selectedImg.map(v => v.fullpath), absolutePath)
await moveFiles(selectedImg.map(v => v.fullpath), absolutePath)
events.emit('removeFiles', { paths: selectedImg.map(v => v.fullpath), loc: currLocation.value })
events.emit('addFiles', { files: selectedImg, loc: absolutePath })
break
@ -831,7 +826,7 @@ export function useFileItemActions (
),
async onOk () {
const paths = selectedFiles.map((v) => v.fullpath)
await deleteFiles('local', paths)
await deleteFiles(paths)
message.success(t('deleteSuccess'))
events.emit('removeFiles', { paths: paths, loc: currLocation.value })
resolve()