Merge branch 'develop' of https://github.com/ciderapp/Cider into develop
This commit is contained in:
commit
eb6053ee04
3 changed files with 38 additions and 19 deletions
|
@ -371,21 +371,28 @@ export class BrowserWindow {
|
|||
event.returnValue = process.platform;
|
||||
});
|
||||
|
||||
ipcMain.on("get-github-theme", async (event, url) => {
|
||||
if (!existsSync(utils.getPath("themes"))) {
|
||||
mkdirSync(utils.getPath("themes"));
|
||||
}
|
||||
if (url.endsWith("/")) url = url.slice(0, -1);
|
||||
let response = await fetch(
|
||||
`${url}/archive/refs/heads/main.zip`
|
||||
);
|
||||
let zip = await response.buffer();
|
||||
let zipFile = new AdmZip(zip);
|
||||
zipFile.extractAllTo(utils.getPath("themes"), true);
|
||||
BrowserWindow.win.webContents.send("theme-installed", "");
|
||||
event.returnValue = {
|
||||
ipcMain.handle("get-github-theme", async (event, url) => {
|
||||
const returnVal = {
|
||||
success: true,
|
||||
};
|
||||
theme: null,
|
||||
message: ""
|
||||
}
|
||||
try {
|
||||
if (!existsSync(utils.getPath("themes"))) {
|
||||
mkdirSync(utils.getPath("themes"));
|
||||
}
|
||||
if (url.endsWith("/")) url = url.slice(0, -1);
|
||||
let response = await fetch(
|
||||
`${url}/archive/refs/heads/main.zip`
|
||||
);
|
||||
let zip = await response.buffer();
|
||||
let zipFile = new AdmZip(zip);
|
||||
zipFile.extractAllTo(utils.getPath("themes"), true);
|
||||
|
||||
}catch(e) {
|
||||
returnVal.success = false;
|
||||
}
|
||||
BrowserWindow.win.webContents.send("theme-installed", returnVal);
|
||||
});
|
||||
|
||||
ipcMain.on("get-themes", (event, _key) => {
|
||||
|
|
|
@ -697,11 +697,6 @@ const app = new Vue({
|
|||
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")
|
||||
|
||||
ipcRenderer.on('SoundCheckTag', (event, tag) => {
|
||||
|
|
|
@ -132,6 +132,7 @@
|
|||
<option value="dark.less">{{$root.getLz('settings.option.visual.theme.dark')}}</option>
|
||||
<option v-for="theme in themes" :value="theme">{{ theme.replace(".less", "") }}</option>
|
||||
</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 class="md-option-line">
|
||||
|
@ -771,6 +772,22 @@
|
|||
}
|
||||
},
|
||||
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() {
|
||||
ipcRenderer.send('fetch-log')
|
||||
notyf.success(app.getLz('term.share.success'));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue