checking if theme is already installed
This commit is contained in:
parent
9be41520d2
commit
f655b8f1aa
2 changed files with 19 additions and 4 deletions
|
@ -431,7 +431,7 @@ export class BrowserWindow {
|
||||||
description: themeJson.description || themeDescription,
|
description: themeJson.description || themeDescription,
|
||||||
path: themePath,
|
path: themePath,
|
||||||
file: theme,
|
file: theme,
|
||||||
test: join(themePath, "theme.json")
|
github_repo: themeJson.github_repo || ""
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
themeObjects.push({
|
themeObjects.push({
|
||||||
|
@ -439,7 +439,7 @@ export class BrowserWindow {
|
||||||
description: themeDescription,
|
description: themeDescription,
|
||||||
path: themePath,
|
path: themePath,
|
||||||
file: theme,
|
file: theme,
|
||||||
test: join(themePath, "theme.json")
|
github_repo: ""
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,10 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-auto nopadding flex-center">
|
<div class="col-auto nopadding flex-center">
|
||||||
<button class="md-btn md-btn-primary" @click="installThemeRepo(openRepo)">Install</button>
|
<button class="md-btn md-btn-primary" @click="installThemeRepo(openRepo)">
|
||||||
|
<span v-if="!themesInstalled.includes(openRepo.full_name)">Install</span>
|
||||||
|
<span v-else>Update</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -67,13 +70,25 @@
|
||||||
avatar_url: ''
|
avatar_url: ''
|
||||||
},
|
},
|
||||||
readme: ""
|
readme: ""
|
||||||
}
|
},
|
||||||
|
themesInstalled: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.getRepos();
|
this.getRepos();
|
||||||
|
this.getInstalledThemes();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
getInstalledThemes() {
|
||||||
|
let self = this
|
||||||
|
const themes = ipcRenderer.sendSync("get-themes")
|
||||||
|
// for each theme, get the github_repo property and push it to the themesInstalled array, if not blank
|
||||||
|
themes.forEach(theme => {
|
||||||
|
if (theme.github_repo !== "") {
|
||||||
|
self.themesInstalled.push(theme.github_repo)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
showRepo(repo) {
|
showRepo(repo) {
|
||||||
const self = this
|
const self = this
|
||||||
const readmeUrl = `https://raw.githubusercontent.com/${repo.full_name}/main/README.md`;
|
const readmeUrl = `https://raw.githubusercontent.com/${repo.full_name}/main/README.md`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue