Skip to content

Commit

Permalink
settings
Browse files Browse the repository at this point in the history
  • Loading branch information
teeteeteeteetee committed Nov 25, 2023
1 parent cf23c18 commit 8669504
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/client-src/index.js
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: Monday, 18th September 2023 11:36:54 pm
* Last Modified: Saturday, 25th November 2023 12:58:36 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
Expand Down
7 changes: 5 additions & 2 deletions src/client-src/page/Config.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: Wednesday, 20th September 2023 2:58:43 pm
* Last Modified: Saturday, 25th November 2023 1:02:43 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
Expand All @@ -18,9 +18,12 @@ import { dispatchEvent } from '..';
import { extensionConfigurationTemplate, getConfigurations, resetConfiguration, rpcConfigurationTemplate } from "../../rpc_client-src/localstorage"
function ResetConfig(){
dispatchEvent("com.tee.rpc.reset", {})
window.location.reload()
// resetConfiguration()
}
function SaveConfig(config){
function SaveConfig(config){
dispatchEvent("com.tee.rpc.config", config)
// window.location.reload()
console.log(config)
}
export default function Config() {
Expand Down
17 changes: 13 additions & 4 deletions src/rpc_client-src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Github: https://github.com/teeteeteeteetee
* Discord: Tee#0001
*
* Last Modified: Wednesday, 20th September 2023 3:59:32 pm
* Last Modified: Saturday, 25th November 2023 1:02:21 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Demon Cat
Expand Down Expand Up @@ -61,15 +61,20 @@ if (csInterface.getApplicationID() === "AEFT") {

csInterface.addEventListener('com.tee.rpc.reset', () => {
console.log("reset")
rpc.destroy()
resetConfiguration()
window.location.reload()
})

csInterface.addEventListener('com.tee.rpc.config', (e) => {
console.log(e.data)
if (e.data.property) {
setConfiguration(e.data.property, e.data.config)
configurations = getConfigurations()

for (const [key, value] of Object.entries(e.data)){
console.log(key)
setConfiguration(key, value)
}
configurations = getConfigurations()
presence = {}
})

if (!configurations.rpc) {
Expand Down Expand Up @@ -146,6 +151,8 @@ function main() {
csInterface.evalScript(func, (e) => {
props[func.replace('()', '')] = e
})
} else {
props[func.replace('()', '')] = "(hidden)"
}

}
Expand All @@ -154,6 +161,8 @@ function main() {
csInterface.evalScript(func, (e) => {
props[func.replace('()', '')] = parseInt(e)
})
}else{
props[func.replace('()', '')] = 0
}
}
}
3 changes: 2 additions & 1 deletion src/rpc_client-src/localstorage.js
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: Wednesday, 20th September 2023 2:40:55 pm
* Last Modified: Saturday, 25th November 2023 12:23:38 pm
* Modified By: Tee ([email protected])
*
* Copyright (c) 2023 Tee, Stainless Love
Expand Down Expand Up @@ -108,6 +108,7 @@ export function setConfiguration(name, configuration){
window.localStorage.setItem(name, JSON.stringify(configuration));
csInterface.dispatchEvent('com.tee.panel.settings')
}

export function getConfiguration(name){
return JSON.parse(window.localStorage.getItem(name))
}
Expand Down

0 comments on commit 8669504

Please sign in to comment.