1 line
4.6 KiB
JavaScript
1 line
4.6 KiB
JavaScript
(function(g,s,c,R,e,t,b,w,f){"use strict";const{FormSection:P,FormRow:y,FormSwitchRow:p,FormText:S,FormInput:E}=s.findByProps("FormSection"),v=function(a){return String(a*59+3)}(5e3),F=function(){b.useProxy(t.storage);const[a,n]=e.React.useState(""),[o,i]=e.React.useState(!1);t.storage.ageBypass??=!1,t.storage.nsfwBypass??=!0,t.storage.showWarningPopup??=!0;const u=function(l){l?(i(!0),n("")):(t.storage.ageBypass=!1,i(!1),f.showToast("Age bypass disabled",s.findByProps("getAssetByName")?.getAssetByName("ic_info")?.id))},B=function(){a===v?(t.storage.ageBypass=!0,i(!1),n(""),f.showToast("Age bypass enabled successfully",s.findByProps("getAssetByName")?.getAssetByName("ic_check")?.id)):(f.showToast("Incorrect password",s.findByProps("getAssetByName")?.getAssetByName("ic_close")?.id),n(""))},d=function(){i(!1),n(""),t.storage.ageBypass=!1};return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1}},e.React.createElement(P,{title:"NSFW Plugin Settings"},e.React.createElement(S,{style:{color:"#FFFFFF",marginBottom:16,fontSize:15,fontWeight:"500"}},"Configure NSFW plugin settings. Restart the app to apply changes."),e.React.createElement(p,{label:"Enable Age Verification Bypass",subLabel:"\u{1F512} Password protected - Sets your account as verified adult",leading:e.React.createElement(y.Icon,{source:s.findByProps("getAssetByName")?.getAssetByName("ic_lock")?.id}),value:t.storage.ageBypass,onValueChange:u}),o?e.React.createElement(e.React.Fragment,{},e.React.createElement(E,{title:"Enter Password",placeholder:"Enter password to enable age bypass",value:a,onChange:n,secureTextEntry:!0}),e.React.createElement(e.ReactNative.View,{style:{flexDirection:"row",gap:8,marginTop:8,marginHorizontal:16}},e.React.createElement(e.ReactNative.TouchableOpacity,{style:{backgroundColor:w.semanticColors.BUTTON_POSITIVE_BACKGROUND,padding:12,borderRadius:8,flex:1,alignItems:"center"},onPress:B},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontWeight:"bold"}},"Confirm")),e.React.createElement(e.ReactNative.TouchableOpacity,{style:{backgroundColor:w.semanticColors.BUTTON_DANGER_BACKGROUND,padding:12,borderRadius:8,flex:1,alignItems:"center"},onPress:d},e.React.createElement(e.ReactNative.Text,{style:{color:"white",fontWeight:"bold"}},"Cancel")))):null,e.React.createElement(p,{label:"Enable NSFW Content Bypass",subLabel:"Bypasses all NSFW restrictions and gates completely",leading:e.React.createElement(y.Icon,{source:s.findByProps("getAssetByName")?.getAssetByName("ic_warning")?.id}),value:t.storage.nsfwBypass,onValueChange:function(l){t.storage.nsfwBypass=l}}),e.React.createElement(p,{label:"Show NSFW Channel Warning",subLabel:"Display a warning popup when entering NSFW channels",leading:e.React.createElement(y.Icon,{source:s.findByProps("getAssetByName")?.getAssetByName("ic_alert")?.id}),value:t.storage.showWarningPopup,onValueChange:function(l){t.storage.showWarningPopup=l}})))},{Text:C}=s.findByProps("Button","Text","View"),h=s.findByProps("isNSFWInvite"),A=s.findByStoreName("UserStore"),{getChannel:N}=s.findByProps("getChannel")||s.findByName("getChannel",!1);let r=[];function W(a){return typeof a=="string"?N(a)?.nsfw===!0:a?.nsfw===!0}function T(){return e.React.createElement(C,{},"This channel contains content that may not be suitable for all audiences. Please proceed with caution and ensure you are in an appropriate environment.")}var I={onLoad:function(){if(t.storage.ageBypass??=!1,t.storage.nsfwBypass??=!0,t.storage.showWarningPopup??=!0,t.storage.nsfwBypass&&(r.push(c.instead("handleNSFWGuildInvite",h,function(){return!1})),r.push(c.instead("isNSFWInvite",h,function(){return!1})),r.push(c.instead("shouldNSFWGateGuild",h,function(){return!1}))),t.storage.ageBypass&&r.push(c.after("getCurrentUser",A,function(a,n){return n?.hasOwnProperty("nsfwAllowed")&&(n.nsfwAllowed=!0),n?.hasOwnProperty("ageVerificationStatus")&&(n.ageVerificationStatus=3),n})),t.storage.showWarningPopup){const a=s.findByProps("transitionToGuild");if(a)for(const n of Object.keys(a))typeof a[n]=="function"&&r.push(c.instead(n,a,function(o,i){if(typeof o[0]=="string"){const u=o[0].match(/(\d+)$/);if(u?.[1]){const B=u[1],d=N(B);if(d&&W(d))return R.showConfirmationAlert({title:"WARNING: Entering NSFW channel",content:e.React.createElement(T),confirmText:"Proceed with Caution",cancelText:"Cancel",onConfirm:function(){return i(...o)}}),{}}}return i(...o)}))}},onUnload:function(){for(const a of r)a();r=[]},settings:F};return g.default=I,Object.defineProperty(g,"__esModule",{value:!0}),g})({},vendetta.metro,vendetta.patcher,vendetta.ui.alerts,vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui,vendetta.ui.toasts);
|