added install from github url to settings
This commit is contained in:
parent
0aaa40f4e5
commit
e3555b7b01
3 changed files with 38 additions and 19 deletions
|
@ -371,7 +371,13 @@ export class BrowserWindow {
|
||||||
event.returnValue = process.platform;
|
event.returnValue = process.platform;
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on("get-github-theme", async (event, url) => {
|
ipcMain.handle("get-github-theme", async (event, url) => {
|
||||||
|
const returnVal = {
|
||||||
|
success: true,
|
||||||
|
theme: null,
|
||||||
|
message: ""
|
||||||
|
}
|
||||||
|
try {
|
||||||
if (!existsSync(utils.getPath("themes"))) {
|
if (!existsSync(utils.getPath("themes"))) {
|
||||||
mkdirSync(utils.getPath("themes"));
|
mkdirSync(utils.getPath("themes"));
|
||||||
}
|
}
|
||||||
|
@ -382,10 +388,11 @@ export class BrowserWindow {
|
||||||
let zip = await response.buffer();
|
let zip = await response.buffer();
|
||||||
let zipFile = new AdmZip(zip);
|
let zipFile = new AdmZip(zip);
|
||||||
zipFile.extractAllTo(utils.getPath("themes"), true);
|
zipFile.extractAllTo(utils.getPath("themes"), true);
|
||||||
BrowserWindow.win.webContents.send("theme-installed", "");
|
|
||||||
event.returnValue = {
|
}catch(e) {
|
||||||
success: true,
|
returnVal.success = false;
|
||||||
};
|
}
|
||||||
|
BrowserWindow.win.webContents.send("theme-installed", returnVal);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on("get-themes", (event, _key) => {
|
ipcMain.on("get-themes", (event, _key) => {
|
||||||
|
|
|
@ -693,11 +693,6 @@ const app = new Vue({
|
||||||
console.log(e)
|
console.log(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
ipcRenderer.on("theme-installed", (event, arg) => {
|
|
||||||
notyf.success("Theme installed")
|
|
||||||
//app.setTheme(arg)
|
|
||||||
})
|
|
||||||
|
|
||||||
MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player")
|
MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player")
|
||||||
|
|
||||||
ipcRenderer.on('SoundCheckTag', (event, tag) => {
|
ipcRenderer.on('SoundCheckTag', (event, tag) => {
|
||||||
|
|
|
@ -132,6 +132,7 @@
|
||||||
<option value="dark.less">{{$root.getLz('settings.option.visual.theme.dark')}}</option>
|
<option value="dark.less">{{$root.getLz('settings.option.visual.theme.dark')}}</option>
|
||||||
<option v-for="theme in themes" :value="theme">{{ theme.replace(".less", "") }}</option>
|
<option v-for="theme in themes" :value="theme">{{ theme.replace(".less", "") }}</option>
|
||||||
</select>
|
</select>
|
||||||
|
<button class="md-btn md-btn-small md-btn-block" @click="installTheme()" style="margin-top: 8px">Install from GitHub URL</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="md-option-line">
|
<div class="md-option-line">
|
||||||
|
@ -771,6 +772,22 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
installTheme() {
|
||||||
|
let self = this
|
||||||
|
bootbox.prompt("Enter the URL of the theme you want to install", (result) => {
|
||||||
|
if (result) {
|
||||||
|
ipcRenderer.once("theme-installed", (event, arg) => {
|
||||||
|
if (arg.success) {
|
||||||
|
self.themes = ipcRenderer.sendSync("get-themes")
|
||||||
|
notyf.success("Theme installed successfully");
|
||||||
|
} else {
|
||||||
|
notyf.error("Theme installation failed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ipcRenderer.invoke("get-github-theme", result)
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
copyLogs() {
|
copyLogs() {
|
||||||
ipcRenderer.send('fetch-log')
|
ipcRenderer.send('fetch-log')
|
||||||
notyf.success(app.getLz('term.share.success'));
|
notyf.success(app.getLz('term.share.success'));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue