mirror of
https://github.com/Lightcord/Lightcord.git
synced 2025-04-12 00:55:40 +02:00
Settings Fix
This commit is contained in:
parent
b86df9a17e
commit
55208fd4d3
220
BetterDiscordApp/dist/index.js
vendored
220
BetterDiscordApp/dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
BetterDiscordApp/dist/index.min.js
vendored
2
BetterDiscordApp/dist/index.min.js
vendored
File diff suppressed because one or more lines are too long
2
BetterDiscordApp/dist/index.min.js.map
vendored
2
BetterDiscordApp/dist/index.min.js.map
vendored
File diff suppressed because one or more lines are too long
@ -119,7 +119,7 @@ class LightcordError extends Error {
|
||||
}
|
||||
|
||||
export const Constants = {
|
||||
SERVER_URL: "https://lightcord.deroku.xyz",
|
||||
SERVER_URL: "https://lightcord.org",
|
||||
badges: [ // TODO: Add more badges + server side svg
|
||||
{
|
||||
name: "Lightcord Bug Hunter",
|
||||
|
@ -3,5 +3,9 @@ const {useState} = BDV2.react
|
||||
|
||||
|
||||
export function useForceUpdate(){
|
||||
return useState()[1];
|
||||
const [,setValue] = useState(0)
|
||||
|
||||
return function forceUpdate(){
|
||||
setValue(e => e+1)
|
||||
}
|
||||
}
|
@ -32,6 +32,7 @@ import History from "../ui/icons/history";
|
||||
import core from "./core";
|
||||
import popoutWindow from "./popoutWindow";
|
||||
import TextInputSetting from "../ui/TextInputSetting";
|
||||
import { useForceUpdate } from "./hooks";
|
||||
|
||||
class BDSidebarHeader extends React.PureComponent {
|
||||
render(){
|
||||
@ -327,90 +328,94 @@ export default new class V2_SettingsPanel {
|
||||
(i === 0 ? null : BDV2.react.createElement(MarginTop)),
|
||||
BDV2.react.createElement("h2", {className: "ui-form-title h2 margin-reset margin-bottom-20"}, section.title),
|
||||
section.settings.map(setting => {
|
||||
let isChecked = settingsCookie[setting.id]
|
||||
let value = appSettings.get("BD_"+setting.id, setting.default || "")
|
||||
if(setting.id === "lightcord-8")isChecked = appSettings.get("isTabs", false);
|
||||
if(setting.id === "no_window_bound")isChecked = appSettings.get("NO_WINDOWS_BOUND", false)
|
||||
if(setting.id === "enable_glasstron")isChecked = appSettings.get("GLASSTRON", true)
|
||||
if(setting.id === "lightcord-10")isChecked = !appSettings.get("DEFAULT_NOTIFICATIONS", true)
|
||||
let returnValue
|
||||
if(["lightcord-11"].includes(setting.id)){
|
||||
returnValue = BDV2.react.createElement(TextInputSetting, {id: setting.id, key: setting.id, data: setting, value, placeholder: setting.default || null, onChange: (id, value) => {
|
||||
this.onChange(id, value, sidebar);
|
||||
}})
|
||||
}else{
|
||||
returnValue = BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: isChecked, onChange: (id, checked) => {
|
||||
this.onChange(id, checked, sidebar);
|
||||
}})
|
||||
}
|
||||
if(setting.id == "lightcord-8" && isChecked){
|
||||
return [
|
||||
returnValue,
|
||||
React.createElement(Lightcord.Api.Components.inputs.Button, {
|
||||
color: "green",
|
||||
look: "outlined",
|
||||
size: "small",
|
||||
hoverColor: "brand",
|
||||
onClick: () => {
|
||||
DiscordNative.ipc.send("NEW_TAB")
|
||||
},
|
||||
wrapper: false,
|
||||
disabled: false
|
||||
}, "Open a new Tab")
|
||||
]
|
||||
}
|
||||
if(setting.id === "enable_glasstron" && isChecked){
|
||||
if(process.platform !== "linux"){
|
||||
let choices = []
|
||||
let actual = null
|
||||
if(process.platform === "win32"){
|
||||
choices.push("blurbehind", "acrylic", "transparent")
|
||||
actual = appSettings.get("GLASSTRON_BLUR", "blurbehind")
|
||||
}else if(process.platform === "darwin"){
|
||||
choices.push("titlebar",
|
||||
"selection",
|
||||
"menu",
|
||||
"popover",
|
||||
"sidebar",
|
||||
"header",
|
||||
"sheet",
|
||||
"window",
|
||||
"hud",
|
||||
"fullscreen-ui",
|
||||
"tooltip",
|
||||
"content",
|
||||
"under-window",
|
||||
"under-page",
|
||||
"none"
|
||||
)
|
||||
actual = appSettings.get("GLASSTRON_VIBRANCY", "fullscreen-ui")
|
||||
}
|
||||
return React.createElement(() => {
|
||||
const forceUpdate = useForceUpdate()
|
||||
let isChecked = settingsCookie[setting.id]
|
||||
if(setting.id === "lightcord-8")isChecked = appSettings.get("isTabs", false);
|
||||
if(setting.id === "no_window_bound")isChecked = appSettings.get("NO_WINDOWS_BOUND", false)
|
||||
if(setting.id === "enable_glasstron")isChecked = appSettings.get("GLASSTRON", true)
|
||||
if(setting.id === "lightcord-10")isChecked = !appSettings.get("DEFAULT_NOTIFICATIONS", true)
|
||||
let returnValue
|
||||
if(["lightcord-11"].includes(setting.id)){
|
||||
let value = appSettings.get("BD_"+setting.id, setting.default || "")
|
||||
returnValue = BDV2.react.createElement(TextInputSetting, {id: setting.id, key: setting.id, data: setting, value, placeholder: setting.default || null, onChange: (id, value) => {
|
||||
this.onChange(id, value, sidebar);
|
||||
}})
|
||||
}else{
|
||||
returnValue = BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: isChecked, onChange: (id, checked) => {
|
||||
this.onChange(id, checked, sidebar);
|
||||
forceUpdate()
|
||||
}})
|
||||
}
|
||||
if(setting.id == "lightcord-8" && isChecked){
|
||||
return [
|
||||
returnValue,
|
||||
React.createElement(Lightcord.Api.Components.general.SettingSubTitle, {}, "Glasstron Blur"),
|
||||
React.createElement(Lightcord.Api.Components.inputs.Dropdown, {
|
||||
options: choices.map(e => {
|
||||
return {
|
||||
value: e,
|
||||
label: e
|
||||
}
|
||||
}),
|
||||
value: actual,
|
||||
disabled: false,
|
||||
searchable: true,
|
||||
clearable: false,
|
||||
onChange: (value) => {
|
||||
if(process.platform === "win32"){
|
||||
ipcRenderer.invoke("LIGHTCORD_SET_BLUR_TYPE", value)
|
||||
}else{
|
||||
ipcRenderer.invoke("LIGHTCORD_SET_VIBRANCY", value)
|
||||
}
|
||||
}
|
||||
}, null)
|
||||
React.createElement(Lightcord.Api.Components.inputs.Button, {
|
||||
color: "green",
|
||||
look: "outlined",
|
||||
size: "small",
|
||||
hoverColor: "brand",
|
||||
onClick: () => {
|
||||
DiscordNative.ipc.send("NEW_TAB")
|
||||
},
|
||||
wrapper: false,
|
||||
disabled: false
|
||||
}, "Open a new Tab")
|
||||
]
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
if(setting.id === "enable_glasstron" && isChecked){
|
||||
if(process.platform !== "linux"){
|
||||
let choices = []
|
||||
let actual = null
|
||||
if(process.platform === "win32"){
|
||||
choices.push("blurbehind", "acrylic", "transparent")
|
||||
actual = appSettings.get("GLASSTRON_BLUR", "blurbehind")
|
||||
}else if(process.platform === "darwin"){
|
||||
choices.push("titlebar",
|
||||
"selection",
|
||||
"menu",
|
||||
"popover",
|
||||
"sidebar",
|
||||
"header",
|
||||
"sheet",
|
||||
"window",
|
||||
"hud",
|
||||
"fullscreen-ui",
|
||||
"tooltip",
|
||||
"content",
|
||||
"under-window",
|
||||
"under-page",
|
||||
"none"
|
||||
)
|
||||
actual = appSettings.get("GLASSTRON_VIBRANCY", "fullscreen-ui")
|
||||
}
|
||||
return [
|
||||
returnValue,
|
||||
React.createElement(Lightcord.Api.Components.general.SettingSubTitle, {}, "Glasstron Blur"),
|
||||
React.createElement(Lightcord.Api.Components.inputs.Dropdown, {
|
||||
options: choices.map(e => {
|
||||
return {
|
||||
value: e,
|
||||
label: e
|
||||
}
|
||||
}),
|
||||
value: actual,
|
||||
disabled: false,
|
||||
searchable: true,
|
||||
clearable: false,
|
||||
onChange: (value) => {
|
||||
if(process.platform === "win32"){
|
||||
ipcRenderer.invoke("LIGHTCORD_SET_BLUR_TYPE", value)
|
||||
}else{
|
||||
ipcRenderer.invoke("LIGHTCORD_SET_VIBRANCY", value)
|
||||
}
|
||||
}
|
||||
}, null)
|
||||
]
|
||||
}
|
||||
}
|
||||
return returnValue
|
||||
})
|
||||
})
|
||||
]
|
||||
}),
|
||||
|
@ -33,7 +33,7 @@ export default class ApiPreview extends React.PureComponent {
|
||||
</formModule.FormText>
|
||||
<MarginTop></MarginTop>
|
||||
<Lightcord.Api.Components.inputs.Button color="brand" look="outlined" size="medium" hoverColor="green" onClick={() => {
|
||||
remote.shell.openExternal("https://lightcord.deroku.xyz/LightcordApi/")
|
||||
remote.shell.openExternal("https://lightcord.org/LightcordApi/")
|
||||
}} wrapper={false}>
|
||||
Documentation
|
||||
</Lightcord.Api.Components.inputs.Button>
|
||||
|
@ -7,7 +7,6 @@ export default class Switch extends React.Component {
|
||||
super(props);
|
||||
this.state = {checked: this.props.checked};
|
||||
this.onChange = this.onChange.bind(this);
|
||||
this.switch = <Lightcord.Api.Components.inputs.Switch onChange={this.onChange} value={this.state.checked} />
|
||||
}
|
||||
|
||||
onChange(value) {
|
||||
@ -17,6 +16,6 @@ export default class Switch extends React.Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.switch
|
||||
return <Lightcord.Api.Components.inputs.Switch onChange={this.onChange} value={this.state.checked} />
|
||||
}
|
||||
}
|
@ -155,7 +155,7 @@ export default class V2C_PresenceSettings extends React.Component {
|
||||
DiscordNative.clipboard.copy(Date.now()+"")
|
||||
}} />)
|
||||
}*/
|
||||
return array
|
||||
return array[0]
|
||||
}else if(e.type === "choice"){
|
||||
if(["assets.small", "assets.large"].includes(e.id)){
|
||||
return <InputChoice setting={e} manager={this} id={e.id} choices={[{value: "none", label: "No assets"}].concat(this.state.assets.map(e => {
|
||||
|
@ -4,6 +4,7 @@ import BDV2 from "../modules/v2";
|
||||
import SettingsTitle from "./settingsTitle";
|
||||
import Switch from "./switch";
|
||||
import MarginTop from "./margintop";
|
||||
import { useForceUpdate } from "../modules/hooks";
|
||||
|
||||
let formModule
|
||||
let switchItem
|
||||
@ -26,6 +27,7 @@ export default class V2C_SettingsGroup extends BDV2.reactComponent {
|
||||
settings.map(setting => {
|
||||
return BDV2.react.createElement(Switch, {id: setting.id, key: setting.id, data: setting, checked: settingsCookie[setting.id], onChange: (id, checked) => {
|
||||
this.props.onChange(id, checked);
|
||||
this.forceUpdate()
|
||||
}});
|
||||
})];
|
||||
}
|
||||
@ -64,15 +66,18 @@ export default class V2C_SettingsGroup extends BDV2.reactComponent {
|
||||
if(setting.experimental){
|
||||
info.push(<sup className={betaClassNames.beta}>(EXPERIMENTAL)</sup>)
|
||||
}
|
||||
return <switchItem.default onChange={(ev) => {
|
||||
this.props.onChange(setting.id, ev.target.checked);
|
||||
this.forceUpdate()
|
||||
}} key={setting.id} value={settingsCookie[setting.id]} className={__SECRET_EMOTION__.css({
|
||||
marginBottom: "20px"
|
||||
})} disabled={false} hideBorder={false}
|
||||
size={switchItem.default.Sizes.DEFAULT} theme={switchItem.default.Themes.DEFAULT} note={setting.info}>
|
||||
{info}
|
||||
</switchItem.default>
|
||||
return React.createElement(() => {
|
||||
const forceUpdate = useForceUpdate()
|
||||
return <switchItem.default onChange={(val) => {
|
||||
this.props.onChange(setting.id, val);
|
||||
forceUpdate()
|
||||
}} key={setting.id} value={settingsCookie[setting.id]} className={__SECRET_EMOTION__.css({
|
||||
marginBottom: "20px"
|
||||
})} disabled={false} hideBorder={false}
|
||||
note={setting.info} tooltipNote={null}>
|
||||
{info}
|
||||
</switchItem.default>
|
||||
})
|
||||
}))
|
||||
return <formModule.FormSection tag="h2" title={this.props.title}>
|
||||
{children}
|
||||
|
@ -4,4 +4,4 @@ Welcome to LightcordApi's Documentation !
|
||||
|
||||
The api is mainly written here.
|
||||
|
||||
The main's module documentation can be found [here](https://lightcord.deroku.xyz/LightcordApi/interfaces/_index_.lightcordglobal.html)
|
||||
The main's module documentation can be found [here](https://lightcord.org/LightcordApi/interfaces/_index_.lightcordglobal.html)
|
@ -165,7 +165,7 @@
|
||||
</a>
|
||||
<p>Welcome to LightcordApi's Documentation !</p>
|
||||
<p>The api is mainly written here.</p>
|
||||
<p>The main's module documentation can be found <a href="https://lightcord.deroku.xyz/LightcordApi/interfaces/_index_.lightcordglobal.html">here</a></p>
|
||||
<p>The main's module documentation can be found <a href="https://lightcord.org/LightcordApi/interfaces/_index_.lightcordglobal.html">here</a></p>
|
||||
</div>
|
||||
<footer class="with-border-bottom">
|
||||
<div class="tsd-legend-group">
|
||||
|
File diff suppressed because one or more lines are too long
2
LightcordApi/js/main.min.js
vendored
2
LightcordApi/js/main.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,29 +1,18 @@
|
||||
import WebpackLoader from "../../modules/WebpackLoader"
|
||||
import uuid from "../../modules/uuid"
|
||||
import NOOP from "../../modules/noop"
|
||||
import Utils from "../../modules/Utils"
|
||||
|
||||
type SwitchProps = {
|
||||
id?: string,
|
||||
onChange?: (checked: boolean) => void,
|
||||
value?: boolean,
|
||||
fill?: string,
|
||||
theme?: "default"|"clear",
|
||||
value: boolean,
|
||||
disabled?: boolean,
|
||||
className?: string,
|
||||
size?: "default"|"mini",
|
||||
style?: React.CSSProperties
|
||||
classname?: string,
|
||||
onChange(checked:boolean):void
|
||||
}
|
||||
|
||||
let SwitchModules
|
||||
export default class Switch extends React.Component<SwitchProps, {value: boolean}> {
|
||||
constructor(props:SwitchProps){
|
||||
super(props)
|
||||
|
||||
this.state = {
|
||||
value: props.value || false
|
||||
}
|
||||
this.onChange = this.onChange.bind(this)
|
||||
}
|
||||
|
||||
get modules(){
|
||||
@ -38,32 +27,15 @@ export default class Switch extends React.Component<SwitchProps, {value: boolean
|
||||
] = this.modules
|
||||
|
||||
let props = this.props
|
||||
return (<SwitchComponent id={props.id} onChange={this.onChange} value={this.state.value || false} fill={props.fill}
|
||||
theme={SwitchComponent.Themes[props.theme.toUpperCase()]} disabled={props.disabled} className={props.className}
|
||||
size={SwitchComponent.Sizes[props.size.toUpperCase()]} style={props.style}/>)
|
||||
}
|
||||
|
||||
onChange(value){
|
||||
this.props.onChange(!this.state.value)
|
||||
this.setState({
|
||||
value: !this.state.value
|
||||
})
|
||||
}
|
||||
|
||||
get value(){
|
||||
return this.state.value
|
||||
return (<SwitchComponent id={props.id} checked={props.value} disabled={props.disabled}
|
||||
className={props.disabled} onChange={props.onChange}/>)
|
||||
}
|
||||
|
||||
static defaultProps = {
|
||||
id: null,
|
||||
onChange: NOOP,
|
||||
value: false,
|
||||
fill: null,
|
||||
theme: "default",
|
||||
disabled: false,
|
||||
className: null,
|
||||
size: "default",
|
||||
style: {}
|
||||
className: ""
|
||||
}
|
||||
|
||||
static get AllPreviews(){
|
||||
@ -72,31 +44,13 @@ export default class Switch extends React.Component<SwitchProps, {value: boolean
|
||||
AllPreviews.push([{onChange: (value) => {}}])
|
||||
AllPreviews.push([{
|
||||
value: false
|
||||
}], [{
|
||||
theme: "default"
|
||||
}, {
|
||||
theme: "clear"
|
||||
}], [{
|
||||
disabled: false
|
||||
}, {
|
||||
disabled: true
|
||||
}], [{
|
||||
id: "api-preview-switch"
|
||||
}], [{
|
||||
fill: null
|
||||
}], [{
|
||||
size: "default"
|
||||
}, {
|
||||
size: "mini"
|
||||
}], [{
|
||||
style: {}
|
||||
}])
|
||||
return AllPreviews
|
||||
})()
|
||||
}
|
||||
|
||||
static help = {
|
||||
error: "The `clear` option doesn't work well on light theme."
|
||||
}
|
||||
}
|
||||
let AllPreviews
|
@ -60,7 +60,7 @@ You can also install it via this one-liner command. It will automatically :
|
||||
- Download the Lightcord icon in an .svg format, and will install it in /usr/share/pixmaps.
|
||||
*Require administrator rights to install in /opt/ and for some files in /usr/.*
|
||||
```
|
||||
wget https://lightcord.deroku.xyz/api/v1/gh/releases/Lightcord/Lightcord/dev/lightcord-linux-x64.zip; unzip lightcord-linux-x64.zip -d Lightcord; rm lightcord-linux-x64.zip; cd Lightcord; chmod +x ./lightcord; cd ..; sudo mv Lightcord/ /opt/; rm Lightcord/; wget https://raw.githubusercontent.com/Lightcord/Lightcord/master/Lightcord.desktop; sudo mv Lightcord.desktop /usr/share/applications; chmod +x /usr/share/applications/Lightcord.desktop; wget https://raw.githubusercontent.com/Lightcord/LightcordLogos/master/lightcord/lightcord.svg; sudo mv lightcord.svg /usr/share/pixmaps; /opt/Lightcord/lightcord
|
||||
wget https://lightcord.org/api/v1/gh/releases/Lightcord/Lightcord/dev/lightcord-linux-x64.zip; unzip lightcord-linux-x64.zip -d Lightcord; rm lightcord-linux-x64.zip; cd Lightcord; chmod +x ./lightcord; cd ..; sudo mv Lightcord/ /opt/; rm Lightcord/; wget https://raw.githubusercontent.com/Lightcord/Lightcord/master/Lightcord.desktop; sudo mv Lightcord.desktop /usr/share/applications; chmod +x /usr/share/applications/Lightcord.desktop; wget https://raw.githubusercontent.com/Lightcord/LightcordLogos/master/lightcord/lightcord.svg; sudo mv lightcord.svg /usr/share/pixmaps; /opt/Lightcord/lightcord
|
||||
```
|
||||
|
||||
## Features
|
||||
|
@ -42,7 +42,7 @@ currentWindow.webContents.on("dom-ready", () => {
|
||||
webview.remove()
|
||||
resetAppMount()
|
||||
document.querySelector("body > div.container-after-titlebar > div").innerHTML = '<h2 class="center">Loading...</h2>'
|
||||
fetch("https://lightcord.deroku.xyz/auth/callback?"+query)
|
||||
fetch("https://lightcord.org/auth/callback?"+query)
|
||||
.then(async res => {
|
||||
if(res.status !== 200){ // error
|
||||
currentWindow.close()
|
||||
|
@ -1205,8 +1205,8 @@ const BetterDiscordConfig = window.BetterDiscordConfig = {
|
||||
"branch": "lightcord",
|
||||
dataPath: LightcordBDFolder+"/",
|
||||
os: process.platform,
|
||||
latestVersion: "0.3.4",
|
||||
version: "0.3.4"
|
||||
latestVersion: "0.3.5",
|
||||
version: "0.3.5"
|
||||
}
|
||||
|
||||
function ensureGuildClasses(){
|
||||
|
@ -2,9 +2,6 @@ const fs = require("fs")
|
||||
const { join } = require("path")
|
||||
const { pathToFileURL } = require("url")
|
||||
const ipc = require("../discord_native/renderer/ipc")
|
||||
const { ipcRenderer, remote } = require("electron")
|
||||
|
||||
remote.getCurrentWindow().openDevTools()
|
||||
|
||||
let webviews = new Map()
|
||||
window.webviews = webviews
|
||||
|
@ -16,8 +16,8 @@
|
||||
"build:minify": "node build.js",
|
||||
"clean": "node scripts/clean.js",
|
||||
"clean:all": "node scripts/clean.js --all",
|
||||
"devInstall": "npm i --save-dev --arch=ia32 electron@9.3.1 && node installSubModules.js && echo \"Everything is installed. You should be able to do npm run test to compile everything and launch.\"",
|
||||
"devInstall:64": "npm i --save-dev --arch=x64 electron@9.3.1 && node installSubModules.js && echo \"Everything is installed. You should be able to do npm run test to compile everything and launch.\"",
|
||||
"devInstall": "npm i --save-dev --arch=ia32 electron@9.3.1 && node installSubModules.js && echo \"Everything is installed. You should be able to do npm test to compile everything and launch.\"",
|
||||
"devInstall:64": "npm i --save-dev --arch=x64 electron@9.3.1 && node installSubModules.js && echo \"Everything is installed. You should be able to do npm test to compile everything and launch.\"",
|
||||
"versions": "echo Electron: && electron -v && echo Typescript: && tsc -v",
|
||||
"ci": "node ci-deploy"
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user