assets/admin/build was gitignored, so servers deployed by git pull kept running a stale admin bundle — the icon picker integration in the tabbar and floating-button settings pages never reached them. Track the build directory (rebuild with: cd assets/admin && npm run build) and commit the current bundle containing the universal icon picker.
2 lines
9.7 KiB
JavaScript
2 lines
9.7 KiB
JavaScript
const N={testMail(t){return this.request("/mail/test",{method:"POST",body:JSON.stringify({to:t})})},getFooterTabbarSettings(){return this.request("/settings/footer-tabbar")},saveFooterTabbarSettings(t){return this.request("/settings/footer-tabbar",{method:"POST",body:JSON.stringify(t)})},reorderFooterTabbar(t){return this.request("/settings/footer-tabbar/reorder",{method:"POST",body:JSON.stringify({ids:t})})},getFloatingButtons(){return this.request("/settings/floating-buttons")},saveFloatingButtons(t){return this.request("/settings/floating-buttons",{method:"POST",body:JSON.stringify(t)})},reorderFloatingButtons(t){return this.request("/settings/floating-buttons/reorder",{method:"POST",body:JSON.stringify({ids:t})})},getFriendLinks(){return this.request("/friend-links")},addFriendLink(t){return this.request("/friend-links",{method:"POST",body:JSON.stringify(t)})},deleteFriendLink(t){return this.request(`/friend-links/${t}`,{method:"DELETE"})},reorderFriendLinks(t){return this.request("/friend-links/reorder",{method:"POST",body:JSON.stringify({ids:t})})},getCmsFeatures(){return this.request("/settings/cms-features")},saveCmsFeatures(t){return this.request("/settings/cms-features",{method:"POST",body:JSON.stringify({cms_features:t})})}},$={getCategoryRecommendSettings(){return this.request("/settings/category-recommend")},saveCategoryRecommendSettings(t){return this.request("/settings/category-recommend",{method:"POST",body:JSON.stringify(t)})},getCategories(t="category"){const e=Array.isArray(t)?t.join(","):t;return this.request(`/categories?taxonomy=${encodeURIComponent(e||"category")}`)},updateCategoryMeta(t,e){return this.request(`/categories/${t}/meta`,{method:"POST",body:JSON.stringify(e)})},searchUsers(t="",e=20){return this.request(`/users/search?search=${encodeURIComponent(t)}&number=${e}`)},searchPageDisplayOptions(t,e="",s=[]){const r=new URLSearchParams({query:e});return s.forEach(a=>r.append("include[]",a)),this.request(`/settings/schema/page_display/search/${encodeURIComponent(t)}?${r}`)}},k={getPermissionsAttachmentSettings(){return this.getSchemaPage("permissions","attachment")},savePermissionsAttachmentSettings(t){return this.saveSchemaPage("permissions","attachment",t)},getPermissionsLoginSettings(){return this.getSchemaPage("permissions","login")},savePermissionsLoginSettings(t){return this.saveSchemaPage("permissions","login",t)},getPermissionsModerationSettings(){return this.getSchemaPage("permissions","moderation")},getCapabilities(){return this.request("/permissions/capabilities")},saveCapabilities(t){return this.request("/permissions/capabilities",{method:"POST",body:JSON.stringify({user_caps:t})})}},w={getAuthSettings(){return this.request("/settings/auth")},saveAuthSettings(t){return this.request("/settings/auth",{method:"POST",body:JSON.stringify(t)})},getNotificationSettings(){return this.request("/settings/notifications")},saveNotificationSettings(t){return this.request("/settings/notifications",{method:"POST",body:JSON.stringify(t)})},getNotificationOverview(t={}){const e=new URLSearchParams(t).toString();return this.request("/notifications/overview"+(e?`?${e}`:""))},markNotificationRead(t){return this.request("/notifications/mark-read",{method:"POST",body:JSON.stringify({id:t})})},markAllNotificationsRead(){return this.request("/notifications/mark-read",{method:"POST",body:JSON.stringify({mark_all:!0})})},deleteNotification(t){return this.request(`/notifications/${t}`,{method:"DELETE"})},runNotificationCleanup(){return this.request("/notifications/cleanup",{method:"POST",body:JSON.stringify({})})},getIdentitySettings(){return this.request("/identity/settings")},saveIdentitySettings(t){return this.request("/identity/settings",{method:"POST",body:JSON.stringify(t)})},testIdentitySettings(t={}){return this.request("/identity/settings/test",{method:"POST",body:JSON.stringify(t)})},getCreditSettings(){return this.request("/assets/settings")},saveCreditSettings(t){return this.request("/assets/settings",{method:"POST",body:JSON.stringify(t)})},listCreditUsers(t={}){const e=new URLSearchParams(t).toString();return this.request("/assets/accounts"+(e?`?${e}`:""))},adjustUserCredits(t,e,s,r){return this.request(`/assets/accounts/${t}/adjust`,{method:"POST",body:JSON.stringify({asset:e,delta:s,remark:r})})},getCreditLog(t={}){const e=new URLSearchParams(t).toString();return this.request("/assets/transactions"+(e?`?${e}`:""))}},v={getPaymentOverview(){return this.request("/payment/overview")}},A={testIpGeo(t){return this.request("/extensions/ip-test",{method:"POST",data:{ip:t}})},testContentAudit(t){return this.request("/extensions/audit-test",{method:"POST",data:{text:t}})},getAiStatus(){return this.request("/ai/status")},updateAiSettings(t){return this.request("/ai/settings",{method:"POST",data:t})},generateSeo(t){return this.request("/ai/seo-generate",{method:"POST",data:t})},suggestSummary(t){return this.request("/ai/summary-suggest",{method:"POST",data:t})},suggestTags(t){return this.request("/ai/tags-suggest",{method:"POST",data:t})}},J={getUpdateInfo(){return this.request("/tools/update-info")},detectUpdate(){return this.request("/tools/update-check",{method:"POST",body:JSON.stringify({})})},dismissUpdate(t){return this.request("/tools/update-dismiss",{method:"POST",body:JSON.stringify({version:t})})},exportSettings(){return this.request("/settings/export")},importSettings(t){return this.request("/settings/import",{method:"POST",body:JSON.stringify(t)})},listSettingBackups(){return this.request("/settings/backups")},createSettingBackup(t={}){return this.request("/settings/backups",{method:"POST",body:JSON.stringify(t)})},restoreSettingBackup(t){return this.request(`/settings/backups/${t}/restore`,{method:"POST"})},deleteSettingBackup(t){return this.request(`/settings/backups/${t}`,{method:"DELETE"})},resetDomain(t){return this.request(`/settings/reset/${t}`,{method:"POST"})},resetAllSettings(){return this.request("/settings/reset-all",{method:"POST"})},getHealthCheck(){return this.request("/settings/health")}},U={getSchema(t){return this.request(`/settings/schema/${t}`)},getSchemaPage(t,e){return this.request(`/settings/schema/${this.normalizeDomainKey(t)}/${encodeURIComponent(e)}`)},testCaptcha(t,e){return this.request("/captcha/test",{method:"POST",body:JSON.stringify({provider:t,token:e})})},saveSchemaPage(t,e,s,r="1.0.0"){return this.request(`/settings/schema/${this.normalizeDomainKey(t)}/${encodeURIComponent(e)}`,{method:"POST",body:JSON.stringify({domain:this.normalizeDomainKey(t),section:e,data:s,version:r})})}},I={getIconCatalog(){return this.request("/icons/catalog")}},C={...N,...$,...k,...w,...v,...A,...J,...U,...I};var b;const R=((b=window.aksrtAdminData)==null?void 0:b.apiUrl)||"/wp-json/aksrt/v1";var P;const E=((P=window.aksrtAdminData)==null?void 0:P.nonce)||"";function x(){if(typeof crypto<"u"&&typeof crypto.randomUUID=="function")return crypto.randomUUID();if(typeof crypto>"u"||typeof crypto.getRandomValues!="function")throw new Error("当前浏览器无法生成安全操作标识");const t=new Uint8Array(16);crypto.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;const e=Array.from(t,s=>s.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function D(t){return String(t||"global").trim().replace(/-/g,"_")}function L(t,e){let s=e==null||e===""?"/":String(e),r="";const a=s.indexOf("?");a!==-1&&(r=s.slice(a+1),s=s.slice(0,a)),s.startsWith("/")||(s="/"+s);const o=String(t||"").trim()||"/wp-json/aksrt/v1";if(o.includes("rest_route=")){let i;try{i=new URL(o,typeof window<"u"?window.location.origin:"https://localhost")}catch{return o.replace(/\/?$/,"")+s+(r?(o.includes("?")?"&":"?")+r:"")}const c=(i.searchParams.get("rest_route")||"/aksrt/v1").replace(/\/$/,"")||"/aksrt/v1";let d;return s==="/"?d=c:s.startsWith("/aksrt/")?d=s:d=c+s,i.searchParams.set("rest_route",d),r&&new URLSearchParams(r).forEach((m,g)=>{i.searchParams.set(g,m)}),i.toString()}let u=o.replace(/\/$/,"")+(s==="/"?"":s);return r&&(u+=(u.includes("?")?"&":"?")+r),u}class T{constructor(){this.baseUrl=R,this.pendingIdempotencyKeys=new Map}normalizeDomainKey(e){return D(e)}async request(e,s={}){var q;let r,a,o,h,u,i;if(typeof e=="object"&&e!==null){const n=e;r=n.url||n.endpoint||"",a=n.method||"GET",h=n.params,u=n.data,o=n.headers,i={...n},delete i.url,delete i.endpoint,delete i.method,delete i.params,delete i.data,delete i.headers}else r=e,a=s.method||"GET",h=s.params,u=s.body!==void 0?s.body:s.data,o=s.headers,i={...s},delete i.method,delete i.params,delete i.body,delete i.data,delete i.headers;r.startsWith("/wp-json/aksrt/v1")?r=r.replace("/wp-json/aksrt/v1","")||"/":r.startsWith("/aksrt/v1")&&(r=r.replace("/aksrt/v1","")||"/");let c=L(this.baseUrl,r);if(h&&typeof h=="object"){const n=new URLSearchParams(h).toString();n&&(c+=(c.includes("?")?"&":"?")+n)}let d=u;u!==void 0&&typeof u=="object"&&!(u instanceof FormData)&&(d=JSON.stringify(u));const l=a!=="GET"&&a!=="HEAD",m=(o==null?void 0:o["Idempotency-Key"])||(o==null?void 0:o["idempotency-key"])||"",g=l?`${a}:${c}:${d??""}`:"",S=l&&!m?this.pendingIdempotencyKeys.get(g)||x():m;l&&!m&&this.pendingIdempotencyKeys.set(g,S);const f={method:a,headers:{"Content-Type":"application/json","X-WP-Nonce":E,...S?{"Idempotency-Key":S}:{},...o},...i};d!==void 0&&a!=="GET"&&(f.body=d);try{const n=await fetch(c,f),p=await n.text();let y={};try{y=p?JSON.parse(p):{}}catch{throw new Error(`REST 返回非 JSON,endpoint=${r},status=${n.status},body=${p.slice(0,160)}`)}if(!n.ok||y.success===!1){const O=y.message||((q=y.data)==null?void 0:q.message)||`HTTP ${n.status}`;throw(n.status===403||n.status===401)&&console.warn(`[API Auth] ${r}: ${O} — 可能需要刷新页面重新登录`),new Error(O)}return g!==""&&this.pendingIdempotencyKeys.delete(g),y}catch(n){throw console.error(`[API Error] ${r}:`,n),n}}}Object.assign(T.prototype,C);const j=new T;export{j as a};
|