mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-01-26 17:26:22 +00:00
removed rpc fetching (broke)
This commit is contained in:
parent
446fdc1009
commit
13f909bc9a
1 changed files with 28 additions and 48 deletions
|
@ -25,23 +25,6 @@ interface RpcApp {
|
|||
flags: number;
|
||||
}
|
||||
|
||||
const RPCUtils = findByPropsLazy("fetchApplicationsRPC", "getRemoteIconURL");
|
||||
|
||||
const cachedApps: any = {};
|
||||
async function lookupApp(appId: string): Promise<RpcApp | null> {
|
||||
if (cachedApps[appId]) return cachedApps[appId];
|
||||
const socket: any = {};
|
||||
try {
|
||||
await RPCUtils.fetchApplicationsRPC(socket, appId);
|
||||
console.log(`Lookup finished for ${socket.application.name}`);
|
||||
cachedApps[appId] = socket.application;
|
||||
return socket.application;
|
||||
} catch {
|
||||
console.log(`Lookup failed for ${appId}`);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function isValidSnowflake(v: string) {
|
||||
const regex = /^\d{17,20}$/;
|
||||
return regex.test(v) && !Number.isNaN(SnowflakeUtils.extractTimestamp(v));
|
||||
|
@ -49,7 +32,6 @@ function isValidSnowflake(v: string) {
|
|||
|
||||
export function ReplaceTutorial() {
|
||||
const activities: Activity[] = PresenceStore.getActivities(UserStore.getCurrentUser().id);
|
||||
console.log(activities);
|
||||
return (
|
||||
<>
|
||||
<Forms.FormTitle tag="h3">IDs of currently running activities</Forms.FormTitle>
|
||||
|
@ -77,8 +59,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) {
|
|||
appIds[index][key] = val;
|
||||
|
||||
if (val && key === "appId") {
|
||||
const tempApp = await lookupApp(val.toString());
|
||||
appIds[index].appName = tempApp?.name || "Unknown";
|
||||
appIds[index].appName = "Unknown";
|
||||
}
|
||||
|
||||
if (appIds[index].appId === "" && index !== appIds.length - 1)
|
||||
|
@ -92,9 +73,9 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) {
|
|||
<>
|
||||
{
|
||||
appIds.map((setting, i) =>
|
||||
<Card style={{ padding: "1em 1em 0" }}>
|
||||
<Card style={{ padding: "1em" }}>
|
||||
{
|
||||
setting.appName !== "Unknown" ?
|
||||
setting.appId ?
|
||||
<Switch
|
||||
value={setting.enabled}
|
||||
onChange={value => {
|
||||
|
@ -103,10 +84,10 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) {
|
|||
className={Margins.bottom8}
|
||||
hideBorder={true}
|
||||
>
|
||||
Edit the {setting.appName} app
|
||||
</Switch> : <Forms.FormTitle tag="h3" className={Margins.bottom8}>Add new application</Forms.FormTitle>
|
||||
Edit the app
|
||||
</Switch> : <Forms.FormTitle tag="h3">Add new application</Forms.FormTitle>
|
||||
}
|
||||
<Forms.FormTitle>Application ID</Forms.FormTitle>
|
||||
<Forms.FormTitle className={Margins.top8}>Application ID</Forms.FormTitle>
|
||||
<CheckedTextInput
|
||||
value={setting.appId}
|
||||
onChange={async v => {
|
||||
|
@ -117,8 +98,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) {
|
|||
}
|
||||
/>
|
||||
{
|
||||
setting.appName !== "Unknown" ?
|
||||
<>
|
||||
setting.appId && <>
|
||||
<Forms.FormTitle className={Margins.top8}>New activity type</Forms.FormTitle>
|
||||
<Select
|
||||
options={[
|
||||
|
@ -135,7 +115,7 @@ export function ReplaceSettings({ appIds, update, save }: SettingsProps) {
|
|||
isSelected={value => setting.newActivityType === value}
|
||||
serialize={identity}
|
||||
/>
|
||||
</> : null
|
||||
</>
|
||||
}
|
||||
</Card>
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue