Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
teeteeteeteetee committed May 10, 2023
1 parent 7e11847 commit a2a618d
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 121 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

Adobe Discord Rich Presence is an extension that connects Adobe apps with Discord and provides information for your profile. The extension auto-launches on app start up!

[UXP Version of extension](https://github.com/teeteeteeteetee/adobe-discord-rpc-uxp) (in progress)
# Please do not clone the repository, get the extension from "Releases" https://github.com/teeteeteeteetee/adobe-discord-rpc/releases
[UXP Version of extension](https://github.com/lolitee/adobe-discord-rpc-uxp) (in progress)
# Please do not clone the repository, get the extension from "Releases" https://github.com/lolitee/adobe-discord-rpc/releases

![](demo/preview.gif)

Expand Down Expand Up @@ -36,7 +36,7 @@ Adobe Discord Rich Presence is an extension that connects Adobe apps with Discor
- [ ] Koen - 9$
- [ ] Ventriquo - 3$

[Installation guide](https://github.com/teeteeteeteetee/adobe-discord-rpc/blob/master/GUIDE.md)
[Installation guide](https://github.com/lolitee/adobe-discord-rpc/blob/master/GUIDE.md)

[Support server](https://discord.gg/RGtxbuFtzb) - use it if rly needed

Expand Down
Binary file added src/assets/cat.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/client-src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

import React, { useState, useEffect } from 'react';
import Navigator from './components/Navigator';
import Preview from './page/Preview';
Expand Down
28 changes: 6 additions & 22 deletions src/client-src/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
* Github: https://github.com/lolitee
* Discord: Tee#0001
*
* Last Modified: Sunday, 12th February 2023 4:41:29 pm
* Last Modified: Monday, 8th May 2023 11:23:00 am
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
*/


import { rpcConfiguration, extensionConfiguration, hasProp, getConfiguration, setConfiguration } from "./configuration";
// import { rpcConfiguration, extensionConfiguration, hasProp, getConfiguration, setConfiguration } from "./configuration";

const csInterface = new CSInterface();

Expand All @@ -27,31 +27,15 @@ class Controller {
}

init(){
this.logz("Initializing localstorage")
this.logz("Registering log event")
csInterface.addEventListener('com.tee.panel.log', (e) => {
this.logz(e.data)
})

if (!getConfiguration('rpc')){
this.logz("Defining rpc configuration")
setConfiguration('rpc', rpcConfiguration)
}

if(!hasProp(getConfiguration('rpc'), rpcConfiguration)){
this.logz("Mismatched Rich Presence configuration, resetting!")
setConfiguration('rpc', rpcConfiguration)
}

if (!getConfiguration('extension')){
this.logz("Defining extension configuration")
setConfiguration('extension', extensionConfiguration)
}

if(!hasProp(getConfiguration('extension'), extensionConfiguration)){
this.logz("Mismatched Extension configuration, resetting!")
setConfiguration('extension', extensionConfiguration)
}
this.logz("Registering localstorage")
csInterface.addEventListener('com.tee.panel.localstorage', (e) => {
window.localStorage.setItem(e.data.name, e.data.value)
})
}

}
Expand Down
24 changes: 19 additions & 5 deletions src/client-src/page/Config.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,34 @@
* Github: https://github.com/lolitee
* Discord: Tee#0001
*
* Last Modified: Sunday, 12th February 2023 7:43:21 pm
* Last Modified: Wednesday, 10th May 2023 10:21:25 am
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
*/

import React from 'react';
import React, {useEffect, useState} from 'react';
import ConfigItem from '../components/ConfigItem'
import { rpcConfiguration, extensionConfiguration } from '../configuration';
import { dispatchEvent } from '..';
export default function Config() {

const [config, setConfig] = useState({})

useEffect(() => {


dispatchEvent("com.tee.rpc.update", {})
window.parent.csInterface.addEventListener("com.tee.rpc.config", (e) => {
setConfig(e.data)
console.log(e.data)
})

}, [])

return (
<div className='flex flex-col gap-2'>
<ConfigItem title="Rich Presence Configuration" configuration={rpcConfiguration} />
<ConfigItem title="Extension Configuration" configuration={extensionConfiguration} />
{/* <ConfigItem title="Rich Presence Configuration" configuration={rpcConfiguration} /> */}
{/* <ConfigItem title="Extension Configuration" configuration={extensionConfiguration} /> */}

<div className='flex flex-row gap-2 self-center'>
<button className='bg-button p-2 text-xs text-white rounded-sm'>Save Configuration</button>
Expand Down
4 changes: 2 additions & 2 deletions src/client-src/page/Preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Github: https://github.com/lolitee
* Discord: Tee#0001
*
* Last Modified: Sunday, 12th February 2023 2:47:45 pm
* Last Modified: Sunday, 12th February 2023 8:03:13 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
Expand Down Expand Up @@ -38,7 +38,7 @@ export default function Preview() {
}, [])

return (
<div className="w-screen rounded overflow-hidden h-96 pt-4">
<div className="w-screen rounded-sm overflow-hidden h-96 pt-4">
<div className="flex justify-center">
<div className="flex flex-col self-center bg-black rounded-sm">
<div className="flex flex-col -space-y-12">
Expand Down
175 changes: 86 additions & 89 deletions src/client-src/configuration.js → src/rpc_client-src/localstorage.js
Original file line number Diff line number Diff line change
@@ -1,90 +1,87 @@
/*
* File: configuration.js
* Project: discord-rpc
* File Created: Sunday, 12th February 2023 2:13:24 pm
* Author: Tee ([email protected])
* Github: https://github.com/lolitee
* Discord: Tee#0001
*
* Last Modified: Sunday, 12th February 2023 7:12:57 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
*/

export const rpcConfiguration = {
details: {
enabled: true,
description: "",
name: "Details"
},
state: {
enabled: true,
description: "",
name: "State"
},
timestamp: {
enabled: true,
description: "",
name: "Timestamp"
},
largeImage: 'logo',
largeImageKey: {
enabled: true,
description: "",
name: "Large Icon"
},
largeImageText: {
enabled: true,
description: "",
name: "Large Icon Text"
},
customLargeImage: {
enabled: false,
description: "",
name: "Custom Icon"
},
smallImageKey: {
enabled: true,
description: "",
name: "Small Icon"
},
smallImageText: {
enabled: true,
description: "",
name: "Small Icon Text"
},
}

export const extensionConfiguration = {
enabled: {
enabled: true,
description: "",
name: "Rich Presence Enable"
},
updateNotification: {
enabled: true,
description: "",
name: "Update Notification"
},
catMode: {
enabled: false,
description: "",
name: "Cat Mode"
},
}

export function setConfiguration(name, configuration){
window.localStorage.setItem(name, configuration);
}

export function getConfiguration(name, property){
if(!property){
return window.localStorage.getItem(name)
}
return window.localStorage.getItem(name)[property]
}

export function hasProp(obj, prop) {
return Object.keys(obj) === Object.keys(prop) ? true : false;
/*
* File: localstorage.js
* Project: discord-rpc-client
* File Created: Sunday, 12th February 2023 9:36:50 pm
* Author: Tee ([email protected])
* Github: https://github.com/lolitee
* Discord: Tee#0001
*
* Last Modified: Sunday, 12th February 2023 9:41:04 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
*/

const csInterface = new CSInterface();

export const rpcConfiguration = {
enabled: {
enabled: true,
description: "",
name: "Rich Presence Enable"
},
details: {
enabled: true,
description: "",
name: "Details"
},
state: {
enabled: true,
description: "",
name: "State"
},
timestamp: {
enabled: true,
description: "",
name: "Timestamp"
},
largeImageKey: {
enabled: true,
description: "",
name: "Large Icon"
},
largeImageText: {
enabled: true,
description: "",
name: "Large Icon Text"
},
smallImageKey: {
enabled: true,
description: "",
name: "Small Icon"
},
smallImageText: {
enabled: true,
description: "",
name: "Small Icon Text"
},
}

export const extensionConfiguration = {
updateNotification: {
enabled: true,
description: "",
name: "Update Notification"
},
catMode: {
enabled: false,
description: "",
name: "Cat Mode"
},
}

export function setConfiguration(name, configuration){
window.localStorage.setItem(name, configuration);
csInterface.dispatchEvent('com.tee.panel.settings')
}

export function getConfiguration(name, property){
if(!property){
return window.localStorage.getItem(name)
}
return window.localStorage.getItem(name)[property]
}

export function hasProp(obj, prop) {
return Object.keys(obj) === Object.keys(prop) ? true : false;
};

0 comments on commit a2a618d

Please sign in to comment.