From b13a43b9be28207a2c0db9cfc80c88e07f4e14a2 Mon Sep 17 00:00:00 2001 From: everestmcarthur Date: Sat, 1 Aug 2026 16:13:06 +0000 Subject: [PATCH] deploy: 47a08d2b06e8df57e594ad849ccde7065f79360c --- view-raw/install/index.js | 2 +- view-raw/install/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view-raw/install/index.js b/view-raw/install/index.js index cc598ce..fce7b9e 100644 --- a/view-raw/install/index.js +++ b/view-raw/install/index.js @@ -1,2 +1,2 @@ (function(E,N,R,b,c,e,w,S,P){"use strict";function F(t){const n=JSON.parse(JSON.stringify(t));for(const i in n.author)switch(i){case"email":case"phone":case"mfaEnabled":case"hasBouncedEmail":delete n.author[i]}return n}const{View:L,Text:v}=e.ReactNative,d={key:"#7dd3fc",string:"#86efac",number:"#fbbf24",boolean:"#c4b5fd",null:"#9ca3af",punct:"#d1d5db"},O=/^(\s*)("(?:[^"\\]|\\.)*"\s*:\s*)?(.*)$/;function H(t){return t.startsWith('"')?d.string:/^(true|false)/.test(t)?d.boolean:/^null/.test(t)?d.null:/^-?\d/.test(t)?d.number:d.punct}function M({text:t,query:n}){const i=e.React.useMemo(function(){return t.split(` -`)},[t]),a=(n||"").trim().toLowerCase();return e.React.createElement(L,null,i.map(function(y,I){const l=y.match(O),o=l?.[1]??"",p=l?.[2],s=l?.[3]??y,h=!!a&&y.toLowerCase().includes(a),r=!!a&&!h;return e.React.createElement(v,{key:I,selectable:!0,style:{fontFamily:"monospace",fontSize:12.5,lineHeight:18,opacity:r?.35:1,backgroundColor:h?"rgba(88,101,242,0.25)":"transparent"}},o,p?e.React.createElement(v,{style:{color:d.key}},p):null,e.React.createElement(v,{style:{color:H(s)}},s))}))}const{View:C,ScrollView:_,TextInput:W,Text:A}=e.ReactNative;function J({message:t}){const[n,i]=e.React.useState(""),a=e.React.useMemo(function(){return JSON.stringify(F(t),null,4)},[t.id]);return e.React.createElement(_,{style:{flex:1,marginHorizontal:13,marginVertical:10}},e.React.createElement(C,{style:{flexDirection:"row"}},e.React.createElement(w.Button,{style:{flex:1,marginRight:8,marginBottom:8},text:"Copy Content",color:"brand",size:"small",disabled:!t.content,onPress:function(){e.clipboard.setString(t.content),S.showToast("Copied content to clipboard",R.getAssetIDByName("toast_copy_link"))}}),e.React.createElement(w.Button,{style:{flex:1,marginBottom:8},text:"Copy JSON",color:"brand",size:"small",onPress:function(){e.clipboard.setString(a),S.showToast("Copied JSON to clipboard",R.getAssetIDByName("toast_copy_link"))}})),e.React.createElement(W,{value:n,onChangeText:i,placeholder:"Search keys or values\u2026",placeholderTextColor:"#888",autoCapitalize:"none",autoCorrect:!1,style:{borderWidth:1,borderColor:"rgba(128,128,128,0.35)",borderRadius:8,paddingHorizontal:10,paddingVertical:8,marginBottom:10,color:"#fff"}}),!!t.content&&e.React.createElement(C,{style:{marginBottom:12}},e.React.createElement(A,{style:{fontSize:11,opacity:.6,marginBottom:4,fontWeight:"700"}},"MESSAGE CONTENT"),e.React.createElement(A,{selectable:!0,style:{fontFamily:"monospace",fontSize:13}},t.content)),e.React.createElement(A,{style:{fontSize:11,opacity:.6,marginBottom:4,fontWeight:"700"}},"RAW DATA"),e.React.createElement(_,{horizontal:!0,showsHorizontalScrollIndicator:!0},e.React.createElement(M,{text:a,query:n})))}function f(t,n=""){P.storage.lastDetection={strategy:t,detail:n,timestamp:Date.now()}}function G(){return P.storage.lastDetection}const{ScrollView:q,View:j}=e.ReactNative;function U({children:t}){return e.React.createElement(q,{style:{flex:1}},t,e.React.createElement(j,{style:{height:24}}))}const{View:K,Text:Q}=e.ReactNative;function T({children:t,style:n}){return e.React.createElement(K,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},n]},e.React.createElement(Q,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{TouchableOpacity:X,Text:Y}=e.ReactNative;function Z({label:t,onPress:n,disabled:i,style:a}){return e.React.createElement(X,{disabled:i,onPress:n,style:[{backgroundColor:"#5865F2",borderRadius:8,padding:10,alignItems:"center",opacity:i?.5:1},a]},e.React.createElement(Y,{style:{color:"white",fontWeight:"600"}},t))}const{FormSection:ee,FormRow:te}=w.Forms,ne={buttons:"Strategy 1 (button list) - working normally",actionSheetRow:"Strategy 2 (row group) - working normally",generic:"Strategy 3 (generic fallback) - the primary two shapes didn't match on this Discord build, but a broader fallback found a spot anyway",none:"None matched - the button couldn't be added on this Discord build"};function ae(){const t=G();return e.React.createElement(U,null,e.React.createElement(ee,{title:"Diagnostics"},t?e.React.createElement(te,{label:ne[t.strategy]??t.strategy,subLabel:`Last checked ${new Date(t.timestamp).toLocaleString()}${t.detail?` - ${t.detail}`:""}`}):e.React.createElement(T,null,"No data yet - long-press any message once, then come back here."),e.React.createElement(Z,{style:{marginHorizontal:16,marginTop:8},label:"Copy diagnostics",disabled:!t,onPress:function(){e.clipboard.setString(JSON.stringify(t,null,2)),S.showToast("Copied - paste this if you're reporting an issue",void 0)}})),e.React.createElement(T,null,`"View Raw" is added to the message long-press menu by detecting Discord's internal action-sheet layout, which isn't an official API and can change between app versions. If it stops appearing for you, open this page after long-pressing a message and copy the diagnostics into a bug report - it'll say exactly which detection strategy ran.`))}const k=c.findByProps("openLazy","hideActionSheet"),x=c.findByProps("push","pushLazy","pop"),re=c.findByProps("getRenderCloseButton")?.getRenderCloseButton??c.findByProps("getHeaderCloseButton")?.getHeaderCloseButton,z=c.findByName("Navigator")??c.findByProps("Navigator")?.Navigator,{ActionSheetRow:g}=c.findByProps("ActionSheetRow")??{},{FormRow:ie,FormIcon:oe}=w.Forms;function se(t){return function(){return e.React.createElement(z,{initialRouteName:"RawPage",goBackOnBackPress:!0,screens:{RawPage:{title:"ViewRaw",headerLeft:re?.(function(){return x.pop()}),render:function(){return e.React.createElement(J,{message:t()})}}}})}}function D(t){k.hideActionSheet(),x.push(t)}function V(t){return e.React.createElement(ie,{label:"View Raw",leading:e.React.createElement(oe,{style:{opacity:1},source:R.getAssetIDByName("ic_chat_bubble_16px")}),onPress:function(){return D(t)}})}function ce(t){return e.React.createElement(g,{label:"View Raw",icon:e.React.createElement(g.Icon,{source:R.getAssetIDByName("ic_chat_bubble_16px")}),onPress:function(){return D(t)},key:"view-raw"})}const B=[],le=N.before("openLazy",k,function([t,n,i]){n!=="MessageLongPressActionSheet"||!i?.message||t.then(function(a){if(a.__viewRawActiveMessage=i.message,a.__viewRawPatched)return;a.__viewRawPatched=!0;const y=N.after("default",a,function(I,l){try{if(!z){console.log("[ViewRaw] Error: Navigator not found - can't open RawPage"),f("none","Navigator not found");return}const o=se(function(){return a.__viewRawActiveMessage}),p=b.findInReactTree(l,function(r){return r?.[0]?.type?.name==="ButtonRow"});if(p){p.push(V(o)),f("buttons");return}const s=b.findInReactTree(l,function(r){return Array.isArray(r)&&r[0]?.type?.name==="ActionSheetRowGroup"});if(Array.isArray(s)&&s.length&&g){const r=ce(o);let u=!1;for(const de of s){const m=b.findInReactTree(de,function($){return Array.isArray($)&&$.some(function(fe){return fe?.type?.name==="ActionSheetRow"})});if(Array.isArray(m)){m.push(r),u=!0;break}}if(!u&&typeof s.unshift=="function"&&g.Group&&(s.unshift(e.React.createElement(g.Group,null,r)),u=!0),u){f("actionSheetRow");return}}const h=b.findInReactTree(l,function(r){return Array.isArray(r)&&r.length>0&&r.every(function(u){return typeof u?.props?.label=="string"&&typeof u?.props?.onPress=="function"})});if(Array.isArray(h)){h.push(V(o)),f("generic");return}console.log("[ViewRaw] Error: Could not find ActionSheet"),f("none")}catch(o){console.log("[ViewRaw] Error: Failed to add View Raw button",o),f("none",String(o))}});B.push(y)})});B.push(le);var ue={onUnload:function(){return B.forEach(function(t){return t()})},settings:ae};return E.default=ue,Object.defineProperty(E,"__esModule",{value:!0}),E})({},vendetta.patcher,vendetta.ui.assets,vendetta.utils,vendetta.metro,vendetta.metro.common,vendetta.ui.components,vendetta.ui.toasts,vendetta.plugin); +`)},[t]),a=(n||"").trim().toLowerCase();return e.React.createElement(L,null,i.map(function(y,I){const l=y.match(O),o=l?.[1]??"",p=l?.[2],s=l?.[3]??y,h=!!a&&y.toLowerCase().includes(a),r=!!a&&!h;return e.React.createElement(v,{key:I,selectable:!0,style:{fontFamily:"monospace",fontSize:12.5,lineHeight:18,opacity:r?.35:1,backgroundColor:h?"rgba(88,101,242,0.25)":"transparent"}},o,p?e.React.createElement(v,{style:{color:d.key}},p):null,e.React.createElement(v,{style:{color:H(s)}},s))}))}const{View:C,ScrollView:_,TextInput:W,Text:A}=e.ReactNative;function J({message:t}){const[n,i]=e.React.useState(""),a=e.React.useMemo(function(){return JSON.stringify(F(t),null,4)},[t.id]);return e.React.createElement(_,{style:{flex:1,marginHorizontal:13,marginVertical:10}},e.React.createElement(C,{style:{flexDirection:"row"}},e.React.createElement(w.Button,{style:{flex:1,marginRight:8,marginBottom:8},text:"Copy Content",color:"brand",size:"small",disabled:!t.content,onPress:function(){e.clipboard.setString(t.content),S.showToast("Copied content to clipboard",R.getAssetIDByName("toast_copy_link"))}}),e.React.createElement(w.Button,{style:{flex:1,marginBottom:8},text:"Copy JSON",color:"brand",size:"small",onPress:function(){e.clipboard.setString(a),S.showToast("Copied JSON to clipboard",R.getAssetIDByName("toast_copy_link"))}})),e.React.createElement(W,{value:n,onChangeText:i,placeholder:"Search keys or values\u2026",placeholderTextColor:"#888",autoCapitalize:"none",autoCorrect:!1,style:{borderWidth:1,borderColor:"rgba(128,128,128,0.35)",borderRadius:8,paddingHorizontal:10,paddingVertical:8,marginBottom:10,color:"#fff"}}),!!t.content&&e.React.createElement(C,{style:{marginBottom:12}},e.React.createElement(A,{style:{fontSize:11,opacity:.6,marginBottom:4,fontWeight:"700"}},"MESSAGE CONTENT"),e.React.createElement(A,{selectable:!0,style:{fontFamily:"monospace",fontSize:13}},t.content)),e.React.createElement(A,{style:{fontSize:11,opacity:.6,marginBottom:4,fontWeight:"700"}},"RAW DATA"),e.React.createElement(_,{horizontal:!0,showsHorizontalScrollIndicator:!0},e.React.createElement(M,{text:a,query:n})))}function f(t,n=""){P.storage.lastDetection={strategy:t,detail:n,timestamp:Date.now()}}function G(){return P.storage.lastDetection}const{ScrollView:q,View:j}=e.ReactNative;function U({children:t}){return e.React.createElement(q,{style:{flex:1}},t,e.React.createElement(j,{style:{height:24}}))}const{View:K,Text:Q}=e.ReactNative;function T({children:t,style:n}){return e.React.createElement(K,{style:[{marginHorizontal:16,marginVertical:8,padding:10,borderRadius:8,borderWidth:1,borderColor:"rgba(128,128,128,0.25)"},n]},e.React.createElement(Q,{style:{fontSize:12.5,lineHeight:18,opacity:.75}},t))}const{TouchableOpacity:X,Text:Y}=e.ReactNative;function Z({label:t,onPress:n,disabled:i,style:a}){return e.React.createElement(X,{disabled:i,onPress:n,style:[{backgroundColor:"#5865F2",borderRadius:8,padding:10,alignItems:"center",opacity:i?.5:1},a]},e.React.createElement(Y,{style:{color:"white",fontWeight:"600"}},t))}const{FormSection:ee,FormRow:te}=w.Forms,ne={buttons:"Strategy 1 (button list) - working normally",actionSheetRow:"Strategy 2 (row group) - working normally",generic:"Strategy 3 (generic fallback) - the primary two shapes didn't match on this Discord build, but a broader fallback found a spot anyway",none:"None matched - the button couldn't be added on this Discord build"};function ae(){const t=G();return e.React.createElement(U,null,e.React.createElement(ee,{title:"Diagnostics"},t?e.React.createElement(te,{label:ne[t.strategy]??t.strategy,subLabel:`Last checked ${new Date(t.timestamp).toLocaleString()}${t.detail?` - ${t.detail}`:""}`}):e.React.createElement(T,null,"No data yet - long-press any message once, then come back here."),e.React.createElement(Z,{style:{marginHorizontal:16,marginTop:8},label:"Copy diagnostics",disabled:!t,onPress:function(){e.clipboard.setString(JSON.stringify(t,null,2)),S.showToast("Copied - paste this if you're reporting an issue",void 0)}})),e.React.createElement(T,null,`"View Raw" is added to the message long-press menu by detecting Discord's internal action-sheet layout, which isn't an official API and can change between app versions. If it stops appearing for you, open this page after long-pressing a message and copy the diagnostics into a bug report - it'll say exactly which detection strategy ran.`))}const k=c.findByProps("openLazy","hideActionSheet"),x=c.findByProps("push","pushLazy","pop"),re=c.findByProps("getRenderCloseButton")?.getRenderCloseButton??c.findByProps("getHeaderCloseButton")?.getHeaderCloseButton,z=c.findByName("Navigator")??c.findByProps("Navigator")?.Navigator,{ActionSheetRow:g}=c.findByProps("ActionSheetRow")??{},{FormRow:ie,FormIcon:oe}=w.Forms;function se(t){return function(){return e.React.createElement(z,{initialRouteName:"RawPage",goBackOnBackPress:!0,screens:{RawPage:{title:"ViewRaw",headerLeft:re?.(function(){return x.pop()}),render:function(){return e.React.createElement(J,{message:t()})}}}})}}function D(t){k.hideActionSheet(),x.push(t)}function V(t){return e.React.createElement(ie,{label:"View Raw",leading:e.React.createElement(oe,{style:{opacity:1},source:R.getAssetIDByName("ic_chat_bubble_32px")}),onPress:function(){return D(t)}})}function ce(t){return e.React.createElement(g,{label:"View Raw",icon:e.React.createElement(g.Icon,{source:R.getAssetIDByName("ic_chat_bubble_32px")}),onPress:function(){return D(t)},key:"view-raw"})}const B=[],le=N.before("openLazy",k,function([t,n,i]){n!=="MessageLongPressActionSheet"||!i?.message||t.then(function(a){if(a.__viewRawActiveMessage=i.message,a.__viewRawPatched)return;a.__viewRawPatched=!0;const y=N.after("default",a,function(I,l){try{if(!z){console.log("[ViewRaw] Error: Navigator not found - can't open RawPage"),f("none","Navigator not found");return}const o=se(function(){return a.__viewRawActiveMessage}),p=b.findInReactTree(l,function(r){return r?.[0]?.type?.name==="ButtonRow"});if(p){p.push(V(o)),f("buttons");return}const s=b.findInReactTree(l,function(r){return Array.isArray(r)&&r[0]?.type?.name==="ActionSheetRowGroup"});if(Array.isArray(s)&&s.length&&g){const r=ce(o);let u=!1;for(const de of s){const m=b.findInReactTree(de,function($){return Array.isArray($)&&$.some(function(fe){return fe?.type?.name==="ActionSheetRow"})});if(Array.isArray(m)){m.push(r),u=!0;break}}if(!u&&typeof s.unshift=="function"&&g.Group&&(s.unshift(e.React.createElement(g.Group,null,r)),u=!0),u){f("actionSheetRow");return}}const h=b.findInReactTree(l,function(r){return Array.isArray(r)&&r.length>0&&r.every(function(u){return typeof u?.props?.label=="string"&&typeof u?.props?.onPress=="function"})});if(Array.isArray(h)){h.push(V(o)),f("generic");return}console.log("[ViewRaw] Error: Could not find ActionSheet"),f("none")}catch(o){console.log("[ViewRaw] Error: Failed to add View Raw button",o),f("none",String(o))}});B.push(y)})});B.push(le);var ue={onUnload:function(){return B.forEach(function(t){return t()})},settings:ae};return E.default=ue,Object.defineProperty(E,"__esModule",{value:!0}),E})({},vendetta.patcher,vendetta.ui.assets,vendetta.utils,vendetta.metro,vendetta.metro.common,vendetta.ui.components,vendetta.ui.toasts,vendetta.plugin); diff --git a/view-raw/install/manifest.json b/view-raw/install/manifest.json index 2511367..c4f4d92 100644 --- a/view-raw/install/manifest.json +++ b/view-raw/install/manifest.json @@ -1 +1 @@ -{"name":"ViewRaw","description":"View a message's raw JSON data - searchable, syntax-highlighted, and copyable. Fork of bwlok's ViewRaw with a crash fix and a nicer viewer.","authors":[{"name":"everestmcarthur"},{"name":"sapphire"},{"name":"Vendicated"},{"name":"Bwlok"}],"main":"index.js","hash":"1701eb68434d4a11ccdc4552eb23eb32795982f277d630ca21bda371fd0f4d5e"} \ No newline at end of file +{"name":"ViewRaw","description":"View a message's raw JSON data - searchable, syntax-highlighted, and copyable. Fork of bwlok's ViewRaw with a crash fix and a nicer viewer.","authors":[{"name":"everestmcarthur"},{"name":"sapphire"},{"name":"Vendicated"},{"name":"Bwlok"}],"main":"index.js","hash":"bc6eafa16d5c31495b6f35c20d3b2171d068b3aea47123394a8abc3d8c298b53"} \ No newline at end of file