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

8 lines
10 KiB
JavaScript

(function(h,e,t,c,S,s){"use strict";const{ScrollView:T,View:v}=e.ReactNative;function E({children:n}){return e.React.createElement(T,{style:{flex:1}},n,e.React.createElement(v,{style:{height:24}}))}const{View:$,Text:w}=e.ReactNative;function m({children:n,style:i}){return e.React.createElement($,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},i]},e.React.createElement(w,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},n))}const{TouchableOpacity:A,Text:O}=e.ReactNative;function y({label:n,onPress:i,disabled:r,style:u}){return e.React.createElement(A,{disabled:r,onPress:i,style:[{backgroundColor:"#5865F2",borderRadius:8,padding:10,alignItems:"center",opacity:r?.5:1},u]},e.React.createElement(O,{style:{color:"white",fontWeight:"600"}},n))}const k=[{label:'findByProps("computePermissions", "canEveryoneRole")',run:function(){return t.findByProps("computePermissions","canEveryoneRole")}},{label:'findByProps("getBotLabel")',run:function(){return t.findByProps("getBotLabel")}},{label:'findByName("DisplayName", false)',run:function(){return t.findByName("DisplayName",!1)}},{label:'findByName("HeaderName", false)',run:function(){return t.findByName("HeaderName",!1)}},{label:'findByName("getTagProperties", false)',run:function(){return t.findByName("getTagProperties",!1)}},{label:'findByTypeNameAll("UserRow")',run:function(){return t.findByTypeNameAll("UserRow")}},{label:'findByStoreName("ThemeStore")',run:function(){return t.findByStoreName("ThemeStore")}},{label:'findByStoreName("GuildMemberStore")',run:function(){return t.findByStoreName("GuildMemberStore")}},{label:'findByStoreName("GuildStore")',run:function(){return t.findByStoreName("GuildStore")}},{label:'findByStoreName("ChannelStore")',run:function(){return t.findByStoreName("ChannelStore")}},{label:'findByStoreName("UserStore")',run:function(){return t.findByStoreName("UserStore")}},{label:'findByStoreName("RelationshipStore")',run:function(){return t.findByStoreName("RelationshipStore")}},{label:'findByName("RowManager", false)',run:function(){return t.findByName("RowManager",!1)}},{label:'findByProps("TYPING_WRAPPER_HEIGHT")',run:function(){return t.findByProps("TYPING_WRAPPER_HEIGHT")}},{label:'findByName("VoiceUserConnected", false)',run:function(){return t.findByName("VoiceUserConnected",!1)}},{label:"find(resolveSemanticColor via default.internal)",run:function(){return t.find(function(n){return n?.default?.internal?.resolveSemanticColor})}},{label:"find(resolveSemanticColor via meta)",run:function(){return t.find(function(n){return n?.meta?.resolveSemanticColor})}},{label:"find(UserProfile)",run:function(){return t.find(function(n){return n?.type?.name==="UserProfile"})}},{label:'findByName("UserProfileSection", false)',run:function(){return t.findByName("UserProfileSection",!1)}},{label:'findByProps("sendMessage", "sendBotMessage")',run:function(){return t.findByProps("sendMessage","sendBotMessage")}},{label:'findByProps("openLazy", "hideActionSheet")',run:function(){return t.findByProps("openLazy","hideActionSheet")}},{label:'findByProps("push", "pushLazy", "pop")',run:function(){return t.findByProps("push","pushLazy","pop")}},{label:'findByProps("getRenderCloseButton")',run:function(){return t.findByProps("getRenderCloseButton")}},{label:'findByProps("getHeaderCloseButton")',run:function(){return t.findByProps("getHeaderCloseButton")}},{label:'findByName("Navigator")',run:function(){return t.findByName("Navigator")}},{label:'findByName("ThemedRolePill", false)',run:function(){return t.findByName("ThemedRolePill",!1)}},{label:'findByProps("saveProfileChanges")',run:function(){return t.findByProps("saveProfileChanges")}},{label:'findByProps("useAvatarColors")',run:function(){return t.findByProps("useAvatarColors")}},{label:'findByProps("useThemeContext")',run:function(){return t.findByProps("useThemeContext")}},{label:'findByProps("getProfileTheme")',run:function(){return t.findByProps("getProfileTheme")}},{label:'findByProps("ThemeContextProvider")',run:function(){return t.findByProps("ThemeContextProvider")}},{label:"semanticColors.HEADER_SECONDARY",run:function(){return s.semanticColors?.HEADER_SECONDARY}},{label:"semanticColors.BACKGROUND_ACCENT",run:function(){return s.semanticColors?.BACKGROUND_ACCENT}},{label:"semanticColors.BACKGROUND_PRIMARY",run:function(){return s.semanticColors?.BACKGROUND_PRIMARY}},{label:"semanticColors.BACKGROUND_FLOATING",run:function(){return s.semanticColors?.BACKGROUND_FLOATING}},{label:"semanticColors.BUTTON_OUTLINE_BRAND_BORDER_ACTIVE",run:function(){return s.semanticColors?.BUTTON_OUTLINE_BRAND_BORDER_ACTIVE}},{label:"semanticColors.TEXT_NORMAL",run:function(){return s.semanticColors?.TEXT_NORMAL}}];function _(n){if(n==null)return"NOT FOUND";if(typeof n=="object"){const i=Object.keys(n);return`found (${i.length} key${i.length===1?"":"s"})`}return`found (${typeof n})`}function j(){return k.map(function({label:n,run:i}){try{const r=i();return{label:n,found:r!=null,detail:_(r)}}catch(r){return{label:n,found:!1,detail:`threw: ${r}`}}})}function D(n){const i=n.filter(function(r){return!r.found});return[`Key Inspector report - ${new Date().toISOString()}`,`${n.length} checked, ${i.length} missing`,"",...n.map(function(r){return`[${r.found?"OK":"MISSING"}] ${r.label} -> ${r.detail}`}),"",`semanticColors keys (${Object.keys(s.semanticColors??{}).length}):`,...Object.keys(s.semanticColors??{}).sort(),"",`rawColors keys (${Object.keys(s.rawColors??{}).length}):`,...Object.keys(s.rawColors??{}).sort()].join(`
`)}const I=new Set(["vendetta.metro.modules"]);function U(n){return n===null?"null":n===void 0?"undefined":Array.isArray(n)?`array(${n.length})`:typeof n}function G(n=3){const i=new WeakSet,r=[];function u(l,d,o){if(l==null||typeof l!="object"&&typeof l!="function")return;if(I.has(d)){r.push(`${d} -> (skipped - Discord's full module registry, use the search tools for this)`);return}if(typeof l=="object"){if(i.has(l)){r.push(`${d} -> [already listed elsewhere, circular]`);return}i.add(l)}let a;try{a=Object.keys(l).sort()}catch(p){r.push(`${d} -> [couldn't read keys: ${p}]`);return}const f=a.slice(0,60);for(const p of f){const B=`${d}.${p}`;let R;try{R=l[p]}catch(F){r.push(`${B} -> [threw on access: ${F}]`);continue}const C=U(R);r.push(`${B} (${C})`),C==="object"&&o<n&&u(R,B,o+1)}a.length>60&&r.push(`${d} -> (+${a.length-60} more keys not shown at this level)`)}try{u(globalThis.vendetta,"vendetta",0)}catch(l){r.push(`Error walking the vendetta object: ${l}`)}return r.length?r.join(`
`):"vendetta object not found or empty"}const{View:g,Text:N}=e.ReactNative,{FormSection:b,FormInput:P}=S.Forms;function M(){const[n,i]=e.React.useState(null);return e.React.createElement(b,{title:"Full diagnostic scan"},e.React.createElement(g,{style:{paddingHorizontal:16,paddingVertical:8}},e.React.createElement(y,{label:"Run scan & copy full report",onPress:function(){const r=j(),u=r.filter(function(l){return!l.found}).length;e.clipboard.setString(D(r)),i(`${r.length} checked, ${u} missing - full report copied`),c.showToast(`${u} missing out of ${r.length} - report copied`,void 0)}}),n&&e.React.createElement(N,{style:{marginTop:8,fontSize:12.5,opacity:.7}},n)))}function H(){return e.React.createElement(b,{title:"Full Vendetta API tree"},e.React.createElement(g,{style:{paddingHorizontal:16,paddingVertical:8}},e.React.createElement(y,{label:"Copy the entire plugin API tree",onPress:function(){const n=G(3),i=n.split(`
`).length;e.clipboard.setString(n),c.showToast(`Copied ${i} lines - every key path under window.vendetta`,void 0)}}),e.React.createElement(N,{style:{marginTop:8,fontSize:12.5,opacity:.7}},"Every key path under the stable plugin API (window.vendetta), 3 levels deep - this is everything Revenge itself exposes to plugins, not Discord's raw internals (those are searchable individually below, since dumping all of them would be enormous).")))}function V(){const[n,i]=e.React.useState(""),[r,u]=e.React.useState(""),l=function(){const o=n.split(",").map(function(a){return a.trim()}).filter(Boolean);if(o.length)try{const a=t.findByProps(...o);if(!a){e.clipboard.setString(`findByProps(${o.join(", ")}) -> not found`),c.showToast("No module found - copied that result",void 0);return}const f=Object.keys(a).sort();e.clipboard.setString(`findByProps(${o.join(", ")}) -> found, keys:
${f.join(`
`)}`),c.showToast(`Found it - copied ${f.length} key(s)`,void 0)}catch(a){e.clipboard.setString(`Error searching for ${o.join(", ")}: ${a}`),c.showToast("Search failed - copied the error instead",void 0)}},d=function(){const o=r.trim();if(o)try{const a=t.findByName(o,!1);if(!a){e.clipboard.setString(`findByName("${o}") -> not found`),c.showToast("No component found - copied that result",void 0);return}const f=Object.keys(a).sort();e.clipboard.setString(`findByName("${o}") -> found, keys:
${f.join(`
`)}`),c.showToast(`Found it - copied ${f.length} key(s)`,void 0)}catch(a){e.clipboard.setString(`Error searching for "${o}": ${a}`),c.showToast("Search failed - copied the error instead",void 0)}};return e.React.createElement(b,{title:"One-off search"},e.React.createElement(g,{style:{paddingHorizontal:16,paddingVertical:8}},e.React.createElement(P,{title:"findByProps - comma-separated prop names",placeholder:"e.g. sendMessage, sendBotMessage",value:n,onChange:i}),e.React.createElement(y,{label:"Search & copy result",style:{marginTop:8,marginBottom:16},onPress:l}),e.React.createElement(P,{title:"findByName - component name",placeholder:"e.g. ThemedRolePill",value:r,onChange:u}),e.React.createElement(y,{label:"Search & copy result",style:{marginTop:8},onPress:d})))}function L(){return e.React.createElement(E,null,e.React.createElement(M,null),e.React.createElement(H,null),e.React.createElement(V,null),e.React.createElement(m,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 z={settings:L};return h.default=z,Object.defineProperty(h,"__esModule",{value:!0}),h})({},vendetta.metro.common,vendetta.metro,vendetta.ui.toasts,vendetta.ui.components,vendetta.ui);