revenge-plugins/key-inspector/install/index.js
2026-08-01 15:40:02 +00:00

6 lines
8.4 KiB
JavaScript

(function(d,e,n,s,g,o){"use strict";const{ScrollView:b,View:N}=e.ReactNative;function R({children:t}){return e.React.createElement(b,{style:{flex:1}},t,e.React.createElement(N,{style:{height:24}}))}const{View:P,Text:C}=e.ReactNative;function S({children:t,style:i}){return e.React.createElement(P,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},i]},e.React.createElement(C,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{TouchableOpacity:T,Text:E}=e.ReactNative;function f({label:t,onPress:i,disabled:r,style:u}){return e.React.createElement(T,{disabled:r,onPress:i,style:[{backgroundColor:"#5865F2",borderRadius:8,padding:10,alignItems:"center",opacity:r?.5:1},u]},e.React.createElement(E,{style:{color:"white",fontWeight:"600"}},t))}const v=[{label:'findByProps("computePermissions", "canEveryoneRole")',run:function(){return n.findByProps("computePermissions","canEveryoneRole")}},{label:'findByProps("getBotLabel")',run:function(){return n.findByProps("getBotLabel")}},{label:'findByName("DisplayName", false)',run:function(){return n.findByName("DisplayName",!1)}},{label:'findByName("HeaderName", false)',run:function(){return n.findByName("HeaderName",!1)}},{label:'findByName("getTagProperties", false)',run:function(){return n.findByName("getTagProperties",!1)}},{label:'findByTypeNameAll("UserRow")',run:function(){return n.findByTypeNameAll("UserRow")}},{label:'findByStoreName("ThemeStore")',run:function(){return n.findByStoreName("ThemeStore")}},{label:'findByStoreName("GuildMemberStore")',run:function(){return n.findByStoreName("GuildMemberStore")}},{label:'findByStoreName("GuildStore")',run:function(){return n.findByStoreName("GuildStore")}},{label:'findByStoreName("ChannelStore")',run:function(){return n.findByStoreName("ChannelStore")}},{label:'findByStoreName("UserStore")',run:function(){return n.findByStoreName("UserStore")}},{label:'findByStoreName("RelationshipStore")',run:function(){return n.findByStoreName("RelationshipStore")}},{label:'findByName("RowManager", false)',run:function(){return n.findByName("RowManager",!1)}},{label:'findByProps("TYPING_WRAPPER_HEIGHT")',run:function(){return n.findByProps("TYPING_WRAPPER_HEIGHT")}},{label:'findByName("VoiceUserConnected", false)',run:function(){return n.findByName("VoiceUserConnected",!1)}},{label:"find(resolveSemanticColor via default.internal)",run:function(){return n.find(function(t){return t?.default?.internal?.resolveSemanticColor})}},{label:"find(resolveSemanticColor via meta)",run:function(){return n.find(function(t){return t?.meta?.resolveSemanticColor})}},{label:"find(UserProfile)",run:function(){return n.find(function(t){return t?.type?.name==="UserProfile"})}},{label:'findByName("UserProfileSection", false)',run:function(){return n.findByName("UserProfileSection",!1)}},{label:'findByProps("sendMessage", "sendBotMessage")',run:function(){return n.findByProps("sendMessage","sendBotMessage")}},{label:'findByProps("openLazy", "hideActionSheet")',run:function(){return n.findByProps("openLazy","hideActionSheet")}},{label:'findByProps("push", "pushLazy", "pop")',run:function(){return n.findByProps("push","pushLazy","pop")}},{label:'findByProps("getRenderCloseButton")',run:function(){return n.findByProps("getRenderCloseButton")}},{label:'findByProps("getHeaderCloseButton")',run:function(){return n.findByProps("getHeaderCloseButton")}},{label:'findByName("Navigator")',run:function(){return n.findByName("Navigator")}},{label:'findByName("ThemedRolePill", false)',run:function(){return n.findByName("ThemedRolePill",!1)}},{label:'findByProps("saveProfileChanges")',run:function(){return n.findByProps("saveProfileChanges")}},{label:'findByProps("useAvatarColors")',run:function(){return n.findByProps("useAvatarColors")}},{label:'findByProps("useThemeContext")',run:function(){return n.findByProps("useThemeContext")}},{label:'findByProps("getProfileTheme")',run:function(){return n.findByProps("getProfileTheme")}},{label:'findByProps("ThemeContextProvider")',run:function(){return n.findByProps("ThemeContextProvider")}},{label:"semanticColors.HEADER_SECONDARY",run:function(){return o.semanticColors?.HEADER_SECONDARY}},{label:"semanticColors.BACKGROUND_ACCENT",run:function(){return o.semanticColors?.BACKGROUND_ACCENT}},{label:"semanticColors.BACKGROUND_PRIMARY",run:function(){return o.semanticColors?.BACKGROUND_PRIMARY}},{label:"semanticColors.BACKGROUND_FLOATING",run:function(){return o.semanticColors?.BACKGROUND_FLOATING}},{label:"semanticColors.BUTTON_OUTLINE_BRAND_BORDER_ACTIVE",run:function(){return o.semanticColors?.BUTTON_OUTLINE_BRAND_BORDER_ACTIVE}},{label:"semanticColors.TEXT_NORMAL",run:function(){return o.semanticColors?.TEXT_NORMAL}}];function m(t){if(t==null)return"NOT FOUND";if(typeof t=="object"){const i=Object.keys(t);return`found (${i.length} key${i.length===1?"":"s"})`}return`found (${typeof t})`}function $(){return v.map(function({label:t,run:i}){try{const r=i();return{label:t,found:r!=null,detail:m(r)}}catch(r){return{label:t,found:!1,detail:`threw: ${r}`}}})}function O(t){const i=t.filter(function(r){return!r.found});return[`Key Inspector report - ${new Date().toISOString()}`,`${t.length} checked, ${i.length} missing`,"",...t.map(function(r){return`[${r.found?"OK":"MISSING"}] ${r.label} -> ${r.detail}`}),"",`semanticColors keys (${Object.keys(o.semanticColors??{}).length}):`,...Object.keys(o.semanticColors??{}).sort(),"",`rawColors keys (${Object.keys(o.rawColors??{}).length}):`,...Object.keys(o.rawColors??{}).sort()].join(`
`)}const{View:p,Text:A}=e.ReactNative,{FormSection:B,FormInput:h}=g.Forms;function w(){const[t,i]=e.React.useState(null);return e.React.createElement(B,{title:"Full diagnostic scan"},e.React.createElement(p,{style:{paddingHorizontal:16,paddingVertical:8}},e.React.createElement(f,{label:"Run scan & copy full report",onPress:function(){const r=$(),u=r.filter(function(y){return!y.found}).length;e.clipboard.setString(O(r)),i(`${r.length} checked, ${u} missing - full report copied`),s.showToast(`${u} missing out of ${r.length} - report copied`,void 0)}}),t&&e.React.createElement(A,{style:{marginTop:8,fontSize:12.5,opacity:.7}},t)))}function _(){const[t,i]=e.React.useState(""),[r,u]=e.React.useState(""),y=function(){const a=t.split(",").map(function(l){return l.trim()}).filter(Boolean);if(a.length)try{const l=n.findByProps(...a);if(!l){e.clipboard.setString(`findByProps(${a.join(", ")}) -> not found`),s.showToast("No module found - copied that result",void 0);return}const c=Object.keys(l).sort();e.clipboard.setString(`findByProps(${a.join(", ")}) -> found, keys:
${c.join(`
`)}`),s.showToast(`Found it - copied ${c.length} key(s)`,void 0)}catch(l){e.clipboard.setString(`Error searching for ${a.join(", ")}: ${l}`),s.showToast("Search failed - copied the error instead",void 0)}},D=function(){const a=r.trim();if(a)try{const l=n.findByName(a,!1);if(!l){e.clipboard.setString(`findByName("${a}") -> not found`),s.showToast("No component found - copied that result",void 0);return}const c=Object.keys(l).sort();e.clipboard.setString(`findByName("${a}") -> found, keys:
${c.join(`
`)}`),s.showToast(`Found it - copied ${c.length} key(s)`,void 0)}catch(l){e.clipboard.setString(`Error searching for "${a}": ${l}`),s.showToast("Search failed - copied the error instead",void 0)}};return e.React.createElement(B,{title:"One-off search"},e.React.createElement(p,{style:{paddingHorizontal:16,paddingVertical:8}},e.React.createElement(h,{title:"findByProps - comma-separated prop names",placeholder:"e.g. sendMessage, sendBotMessage",value:t,onChange:i}),e.React.createElement(f,{label:"Search & copy result",style:{marginTop:8,marginBottom:16},onPress:y}),e.React.createElement(h,{title:"findByName - component name",placeholder:"e.g. ThemedRolePill",value:r,onChange:u}),e.React.createElement(f,{label:"Search & copy result",style:{marginTop:8},onPress:D})))}function k(){return e.React.createElement(R,null,e.React.createElement(w,null),e.React.createElement(_,null),e.React.createElement(S,null,"The full scan checks every internal lookup this repo's plugins depend on (plus a few for plugins currently being fixed) in one pass, and includes the complete list of semanticColors/rawColors keys at the end. Paste the report back into chat when reporting a bug - it tells us exactly what's missing on your Discord version."))}var U={settings:k};return d.default=U,Object.defineProperty(d,"__esModule",{value:!0}),d})({},vendetta.metro.common,vendetta.metro,vendetta.ui.toasts,vendetta.ui.components,vendetta.ui);