Apex-Plugins/nsfwbypass/index.js
2025-07-27 18:50:47 +02:00

1 line
4.7 KiB
JavaScript

(function(d,s,o,S,e,t,P,w,f){"use strict";const{FormSection:E,FormRow:y,FormSwitchRow:p,FormText:v,FormInput:C}=s.findByProps("FormSection"),N=function(a){return String(a*59+3)}(5e3),F=function(){P.useProxy(t.storage);const[a,n]=e.React.useState(""),[c,i]=e.React.useState(!1);t.storage.ageBypass??=!1,t.storage.nsfwBypass??=!0,t.storage.showWarningPopup??=!0;const u=function(l){l&&!t.storage.ageBypass?(i(!0),n("")):l||(t.storage.ageBypass=!1,i(!1),f.showToast("Age bypass disabled",s.findByProps("getAssetByName")?.getAssetByName("ic_info")?.id))},B=function(){a===N.toString()||a===N?(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(""))},g=function(){i(!1),n(""),t.storage.ageBypass=!1};return e.React.createElement(e.ReactNative.ScrollView,{style:{flex:1}},e.React.createElement(E,{title:"NSFW Plugin Settings"},e.React.createElement(v,{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}),c?e.React.createElement(e.React.Fragment,{},e.React.createElement(C,{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:g},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:A}=s.findByProps("Button","Text","View"),h=s.findByProps("isNSFWInvite"),R=s.findByStoreName("UserStore"),{getChannel:b}=s.findByProps("getChannel")||s.findByName("getChannel",!1);let r=[];function W(a){return typeof a=="string"?b(a)?.nsfw===!0:a?.nsfw===!0}function T(){return e.React.createElement(A,{},"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(o.instead("handleNSFWGuildInvite",h,function(){return!1})),r.push(o.instead("isNSFWInvite",h,function(){return!1})),r.push(o.instead("shouldNSFWGateGuild",h,function(){return!1})),r.push(o.after("getCurrentUser",R,function(a,n){return n?.hasOwnProperty("nsfwAllowed")&&(n.nsfwAllowed=!0),n}))),t.storage.ageBypass&&r.push(o.after("getCurrentUser",R,function(a,n){return 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(o.instead(n,a,function(c,i){if(typeof c[0]=="string"){const u=c[0].match(/(\d+)$/);if(u?.[1]){const B=u[1],g=b(B);if(g&&W(g))return S.showConfirmationAlert({title:"WARNING: Entering NSFW channel",content:e.React.createElement(T),confirmText:"Proceed with Caution",cancelText:"Cancel",onConfirm:function(){return i(...c)}}),{}}}return i(...c)}))}},onUnload:function(){for(const a of r)a();r=[]},settings:F};return d.default=I,Object.defineProperty(d,"__esModule",{value:!0}),d})({},vendetta.metro,vendetta.patcher,vendetta.ui.alerts,vendetta.metro.common,vendetta.plugin,vendetta.storage,vendetta.ui,vendetta.ui.toasts);