Files
wordpress-theme-aksrt/assets/admin/build/shared-api.D5_fnN32.js
T
kate522 a3dde3874a feat(admin): strip SPA ops menus; redirect old hashes to native WP (Phase 4)
SPA shop/forum/payment/users sections now keep configuration pages only.
Operational workbenches were removed from the sidebar and loaders; legacy
hash routes open NativeOpsRedirect into the matching WP native admin page.
Admin SPA production build refreshed accordingly.
2026-07-15 02:10:05 +08:00

2 lines
9.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const q={getMailSettings(){return this.request("/settings/mail")},saveMailSettings(e){return this.request("/settings/mail",{method:"POST",body:JSON.stringify(e)})},testMail(e){return this.request("/mail/test",{method:"POST",body:JSON.stringify({to:e})})},getFooterSettings(){return this.request("/settings/footer")},saveFooterSettings(e){return this.request("/settings/footer",{method:"POST",body:JSON.stringify(e)})},getFooterTabbarSettings(){return this.request("/settings/footer-tabbar")},saveFooterTabbarSettings(e){return this.request("/settings/footer-tabbar",{method:"POST",body:JSON.stringify(e)})},reorderFooterTabbar(e){return this.request("/settings/footer-tabbar/reorder",{method:"POST",body:JSON.stringify({ids:e})})},getFloatingButtons(){return this.request("/settings/floating-buttons")},saveFloatingButtons(e){return this.request("/settings/floating-buttons",{method:"POST",body:JSON.stringify(e)})},reorderFloatingButtons(e){return this.request("/settings/floating-buttons/reorder",{method:"POST",body:JSON.stringify({ids:e})})},getFriendLinks(){return this.request("/friend-links")},addFriendLink(e){return this.request("/friend-links",{method:"POST",body:JSON.stringify(e)})},deleteFriendLink(e){return this.request(`/friend-links/${e}`,{method:"DELETE"})},reorderFriendLinks(e){return this.request("/friend-links/reorder",{method:"POST",body:JSON.stringify({ids:e})})},getCmsFeatures(){return this.request("/settings/cms-features")},saveCmsFeatures(e){return this.request("/settings/cms-features",{method:"POST",body:JSON.stringify({cms_features:e})})}},O={getHomepageSettings(){return this.request("/settings/homepage")},saveHomepageSettings(e){return this.request("/settings/homepage",{method:"POST",body:JSON.stringify(e)})},getHomepageCategories(){return this.request("/homepage/categories")},getCategoryRecommendSettings(){return this.request("/settings/category-recommend")},saveCategoryRecommendSettings(e){return this.request("/settings/category-recommend",{method:"POST",body:JSON.stringify(e)})},getCategories(){return this.request("/categories")},updateCategoryMeta(e,t){return this.request(`/categories/${e}/meta`,{method:"POST",body:JSON.stringify(t)})},searchUsers(e="",t=20){return this.request(`/users/search?search=${encodeURIComponent(e)}&number=${t}`)},getBanners(e="hero"){return this.request(`/banners?kind=${encodeURIComponent(e)}`)},createBanner(e){return this.request("/banners",{method:"POST",body:JSON.stringify(e)})},updateBanner(e,t){return this.request(`/banners/${e}`,{method:"PUT",body:JSON.stringify(t)})},deleteBanner(e){return this.request(`/banners/${e}`,{method:"DELETE"})},getHeroes(){return this.getBanners("hero")},createHero(e){return this.createBanner({...e,kind:"hero"})},updateHero(e,t){return this.updateBanner(e,{...t,kind:"hero"})},deleteHero(e){return this.deleteBanner(e)},getHomepageBanners(){return this.getBanners("banner")},createHomepageBanner(e){return this.createBanner({...e,kind:"banner"})},updateHomepageBanner(e,t){return this.updateBanner(e,{...t,kind:"banner"})},deleteHomepageBanner(e){return this.deleteBanner(e)}},P={getPermissionsAttachmentSettings(){return this.getSchemaPage("permissions","attachment")},savePermissionsAttachmentSettings(e){return this.saveSchemaPage("permissions","attachment",e)},getPermissionsLoginSettings(){return this.getSchemaPage("permissions","login")},savePermissionsLoginSettings(e){return this.saveSchemaPage("permissions","login",e)},getPermissionsModerationSettings(){return this.getSchemaPage("permissions","moderation")},savePermissionsModerationSettings(e){return this.saveSchemaPage("permissions","moderation",e)},getCapabilities(){return this.request("/permissions/capabilities")},saveCapabilities(e){return this.request("/permissions/capabilities",{method:"POST",body:JSON.stringify({user_caps:e})})}},T={getAuthSettings(){return this.request("/settings/auth")},saveAuthSettings(e){return this.request("/settings/auth",{method:"POST",body:JSON.stringify(e)})},getOAuthSettings(){return this.request("/settings/oauth")},saveOAuthSettings(e){return this.request("/settings/oauth",{method:"POST",body:JSON.stringify(e)})},getNotificationSettings(){return this.request("/settings/notifications")},saveNotificationSettings(e){return this.request("/settings/notifications",{method:"POST",body:JSON.stringify(e)})},getNotificationOverview(e={}){const t=new URLSearchParams(e).toString();return this.request("/notifications/overview"+(t?`?${t}`:""))},markNotificationRead(e){return this.request("/notifications/mark-read",{method:"POST",body:JSON.stringify({id:e})})},markAllNotificationsRead(){return this.request("/notifications/mark-read",{method:"POST",body:JSON.stringify({mark_all:!0})})},deleteNotification(e){return this.request(`/notifications/${e}`,{method:"DELETE"})},runNotificationCleanup(){return this.request("/notifications/cleanup",{method:"POST",body:JSON.stringify({})})},getCreditSettings(){return this.request("/credits/settings")},saveCreditSettings(e){return this.request("/credits/settings",{method:"POST",body:JSON.stringify(e)})},listCreditUsers(e={}){const t=new URLSearchParams(e).toString();return this.request("/credits/users"+(t?`?${t}`:""))},adjustUserCredits(e,t,n){return this.request(`/credits/users/${e}/adjust`,{method:"POST",body:JSON.stringify({delta:t,reason:n})})},getCreditLog(e={}){const t=new URLSearchParams(e).toString();return this.request("/credits/log"+(t?`?${t}`:""))}},N={getPaymentOverview(){return this.request("/payment/overview")}},k={testIpGeo(e){return this.request("/extensions/ip-test",{method:"POST",data:{ip:e}})},testContentAudit(e){return this.request("/extensions/audit-test",{method:"POST",data:{text:e}})},getAiStatus(){return this.request("/ai/status")},updateAiSettings(e){return this.request("/ai/settings",{method:"POST",data:e})},generateSeo(e){return this.request("/ai/seo-generate",{method:"POST",data:e})},suggestSummary(e){return this.request("/ai/summary-suggest",{method:"POST",data:e})},suggestTags(e){return this.request("/ai/tags-suggest",{method:"POST",data:e})}},v={getHealthEmailVerification(){return this.request("/health/email-verification")},getUpdateInfo(){return this.request("/tools/update-info")},detectUpdate(){return this.request("/tools/update-check",{method:"POST",body:JSON.stringify({})})},dismissUpdate(e){return this.request("/tools/update-dismiss",{method:"POST",body:JSON.stringify({version:e})})},getEmailRollbackUsers(){return this.request("/email-rollback/users")},executeEmailRollback(e){return this.request(`/email-rollback/users/${e}/rollback`,{method:"POST"})},exportSettings(){return this.request("/settings/export")},importSettings(e){return this.request("/settings/import",{method:"POST",body:JSON.stringify(e)})},listSettingBackups(){return this.request("/settings/backups")},createSettingBackup(e={}){return this.request("/settings/backups",{method:"POST",body:JSON.stringify(e)})},restoreSettingBackup(e){return this.request(`/settings/backups/${e}/restore`,{method:"POST"})},deleteSettingBackup(e){return this.request(`/settings/backups/${e}`,{method:"DELETE"})},resetDomain(e){return this.request(`/settings/reset/${e}`,{method:"POST"})},resetAllSettings(){return this.request("/settings/reset-all",{method:"POST"})},getHealthCheck(){return this.request("/settings/health")}},J={getSchema(e){return this.request(`/settings/schema/${e}`)},getSchemaPage(e,t){return this.request(`/settings/schema/${this.normalizeDomainKey(e)}/${encodeURIComponent(t)}`)},saveSchemaPage(e,t,n,r="1.0.0"){return this.request(`/settings/schema/${this.normalizeDomainKey(e)}/${encodeURIComponent(t)}`,{method:"POST",body:JSON.stringify({domain:this.normalizeDomainKey(e),section:t,data:n,version:r})})}},$={...q,...O,...P,...T,...N,...k,...v,...J};var p;const A=((p=window.aksrtAdminData)==null?void 0:p.apiUrl)||"/wp-json/aksrt/v1";var f;const w=((f=window.aksrtAdminData)==null?void 0:f.nonce)||"";function B(e){return String(e||"global").trim().replace(/-/g,"_")}class b{constructor(){this.baseUrl=A}normalizeDomainKey(t){return B(t)}async request(t,n={}){var l;let r,h,d,o,a,i;if(typeof t=="object"&&t!==null){const s=t;r=s.url||s.endpoint||"",h=s.method||"GET",o=s.params,a=s.data,d=s.headers,i={...s},delete i.url,delete i.endpoint,delete i.method,delete i.params,delete i.data,delete i.headers}else r=t,h=n.method||"GET",o=n.params,a=n.body!==void 0?n.body:n.data,d=n.headers,i={...n},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 g=`${this.baseUrl}${r}`;if(o&&typeof o=="object"){const s=new URLSearchParams(o).toString();s&&(g+=(g.includes("?")?"&":"?")+s)}let m=a;a!==void 0&&typeof a=="object"&&!(a instanceof FormData)&&(m=JSON.stringify(a));const S={method:h,headers:{"Content-Type":"application/json","X-WP-Nonce":w,...d},...i};m!==void 0&&h!=="GET"&&(S.body=m);try{const s=await fetch(g,S),c=await s.text();let u={};try{u=c?JSON.parse(c):{}}catch{throw new Error(`REST 返回非 JSON,endpoint=${r},status=${s.status},body=${c.slice(0,160)}`)}if(!s.ok||u.success===!1){const y=u.message||((l=u.data)==null?void 0:l.message)||`HTTP ${s.status}`;throw(s.status===403||s.status===401)&&console.warn(`[API Auth] ${r}: ${y} — 可能需要刷新页面重新登录`),new Error(y)}return u}catch(s){throw console.error(`[API Error] ${r}:`,s),s}}}Object.assign(b.prototype,$);const E=new b;export{E as a};