Files
server/opt/psa/admin/cp/public/javascript/components/pages/HotlinkProtectionPage.js
2026-01-07 20:52:11 +01:00

2 lines
5.3 KiB
JavaScript

(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/HotlinkProtectionPage"],{2755:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>t.default});var t=i(2756)},2756:(e,n,i)=>{"use strict";i.r(n),i.d(n,{HotlinkProtectionPage:()=>c,default:()=>u});var t=i(668),o=i.n(t),a=i(297),s=i(90),d=i(2757),r=i(296);const l=s.Locale.getTranslate("components.pages.HotlinkProtection"),c=e=>e.domain.hosting?(0,r.jsx)(d.HotlinkProtectionForm,{domainId:e.params.domainId,hotlinkProtection:e.domain.hosting.hotlinkProtection}):(0,r.jsx)(a.StatusMessage,{intent:"info",children:(0,r.jsx)(l,{content:"virtualHostingRequired"})});c.propTypes={domain:o().shape({hosting:o().shape({hotlinkProtection:o().shape({isEnabled:o().bool.isRequired,extensions:o().string.isRequired,friends:o().arrayOf(o().string).isRequired}).isRequired})}).isRequired,params:o().shape({domainId:o().string.isRequired}).isRequired};const u=c},2757:(e,n,i)=>{"use strict";i.r(n),i.d(n,{HotlinkProtectionForm:()=>v});var t=i(296),o=i(668),a=i.n(o),s=i(696),d=i(599),r=i(297),l=i(1305),c=i(718),u=i(90),m=i(546),k=i(2758),p=i.n(k);const f=u.Locale.getTranslate("components.pages.HotlinkProtection"),v=({domainId:e,hotlinkProtection:n})=>{const i=(0,d.useNavigate)(),o=`/smb/web/overview/id/${e}/type/domain`,[a,u]=(0,t.useState)(n),[k,{loading:v}]=(0,s.useMutation)(p());return(0,t.jsxs)(l.default,{values:a,mutation:k,onFieldChange:(e,n)=>{u(i=>(0,r.setIn)(i,e,n))},onSubmit:({isEnabled:n,extensions:i,friends:t})=>({id:btoa(`Domain:${e}`),isEnabled:n,extensions:i.replace(/(\n|\s)+/g," ").trim(),friends:t.map(e=>e?.trim()||"")}),state:v?"loading":void 0,onSuccess:({updateHotlinkProtection:{domain:e}},n)=>{(0,m.addToast)({intent:"success",message:(0,t.jsx)(f,{content:"success"})}),u({...a,extensions:e.hosting.hotlinkProtection.extensions}),n||i(o)},applyButton:!1,cancelButton:{component:c.default,to:o},children:[(0,t.jsx)(r.FormFieldCheckbox,{label:(0,t.jsx)(f,{content:"enabledLabel"}),name:"isEnabled",checked:a.isEnabled}),(0,t.jsx)(r.FormFieldText,{label:(0,t.jsx)(f,{content:"extensionsLabel"}),multiline:!0,name:"extensions",size:"lg",inputProps:{maxLength:255},disabled:!a.isEnabled||v}),(0,t.jsx)(r.FormFieldText,{label:(0,t.jsx)(f,{content:"friendsLabel"}),multi:!0,name:"friends",size:"lg",disabled:!a.isEnabled||v})]})};v.propTypes={hotlinkProtection:a().shape({isEnabled:a().bool.isRequired,extensions:a().string.isRequired,friends:a().arrayOf(a().string).isRequired}).isRequired,domainId:a().string.isRequired}},2758:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateHotlinkProtection"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateHotlinkProtectionInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateHotlinkProtection"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"domain"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"hosting"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"hotlinkProtection"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"isEnabled"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"extensions"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"friends"},arguments:[],directives:[]}]}}]}}]}}]}}]}}],loc:{start:0,end:348}};n.loc.source={body:"mutation UpdateHotlinkProtection($input: UpdateHotlinkProtectionInput!) {\n updateHotlinkProtection(input: $input) {\n domain {\n id\n hosting {\n hotlinkProtection {\n isEnabled\n extensions\n friends\n }\n }\n }\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var t=e.type;"NamedType"===t.kind&&n.add(t.name.value)}e.selectionSet&&e.selectionSet.selections.forEach(function(e){i(e,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(e){i(e,n)}),e.definitions&&e.definitions.forEach(function(e){i(e,n)})}var t={};function o(e,n){for(var i=0;i<e.definitions.length;i++){var t=e.definitions[i];if(t.name&&t.name.value==n)return t}}n.definitions.forEach(function(e){if(e.name){var n=new Set;i(e,n),t[e.name.value]=n}}),e.exports=n,e.exports.UpdateHotlinkProtection=function(e,n){var i={kind:e.kind,definitions:[o(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var a=t[n]||new Set,s=new Set,d=new Set;for(a.forEach(function(e){d.add(e)});d.size>0;){var r=d;d=new Set,r.forEach(function(e){s.has(e)||(s.add(e),(t[e]||new Set).forEach(function(e){d.add(e)}))})}return s.forEach(function(n){var t=o(e,n);t&&i.definitions.push(t)}),i}(n,"UpdateHotlinkProtection")}}]);
//# sourceMappingURL=HotlinkProtectionPage.js.map?e2037cbbe9e1852b3f1d