mirror of
https://github.com/VueTubeApp/VueTube
synced 2024-12-22 16:30:20 +00:00
fix: 🐛 Fix plugin loader wooooooooooooooooooooooooooooooooooo
This commit is contained in:
parent
cec8620e23
commit
b6ea6fc77f
3 changed files with 17 additions and 6 deletions
|
@ -5,7 +5,7 @@
|
|||
><v-icon style="margin-right: 0.5em">mdi-sd</v-icon> Install from
|
||||
storage</v-btn
|
||||
>
|
||||
<input type="file" id="filePicker" accept="js" />
|
||||
<input type="file" id="filePicker" accept="js,.js" />
|
||||
</div>
|
||||
|
||||
<center v-if="plugins.length == 0" style="margin-top: 2em">
|
||||
|
@ -30,6 +30,8 @@
|
|||
}"
|
||||
>
|
||||
<div>
|
||||
{{ plugin }}
|
||||
<!--
|
||||
<v-card-title class="pa-0">
|
||||
{{ plugin.manifest.name }}
|
||||
{{ plugin.manifest.version }}
|
||||
|
@ -44,6 +46,7 @@
|
|||
<v-card-text class="pa-0">
|
||||
{{ plugin.manifest.description }}
|
||||
</v-card-text>
|
||||
-->
|
||||
</div>
|
||||
<v-switch
|
||||
disabled
|
||||
|
@ -80,6 +83,9 @@ export default {
|
|||
const contents = await vm.readFileContent(file);
|
||||
await vm.$tppl.addPlugin(contents);
|
||||
};
|
||||
|
||||
this.plugins = this.$tppl.list;
|
||||
console.log(this.plugins)
|
||||
},
|
||||
methods: {
|
||||
readFileContent(file) {
|
||||
|
|
|
@ -18,7 +18,7 @@ const ytApiVal = {
|
|||
};
|
||||
|
||||
const filesystem = {
|
||||
plugins: "plugins",
|
||||
plugins: "plugins/",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -25,13 +25,18 @@ const module = {
|
|||
list: new Promise(async (resolve, reject) => {
|
||||
await ensureStructure;
|
||||
|
||||
const plugins = await Filesystem.readdir({
|
||||
Filesystem.readdir({
|
||||
path: fs.plugins,
|
||||
directory: APP_DIRECTORY,
|
||||
}).catch((err) => {
|
||||
})
|
||||
.then(res => {
|
||||
resolve(res);
|
||||
})
|
||||
.catch(err => {
|
||||
reject(err);
|
||||
});
|
||||
resolve(plugins);
|
||||
|
||||
|
||||
}),
|
||||
|
||||
async addPlugin(content) {
|
||||
|
@ -40,7 +45,7 @@ const module = {
|
|||
const fileName = require("./utils").getCpn(); // Im not sure what this is actually meant for but im using it as a random string generator
|
||||
console.log("Saving Plugin As" + fileName);
|
||||
await Filesystem.writeFile({
|
||||
path: fs.plugins + "/" + fileName + ".js",
|
||||
path: fs.plugins + fileName + ".js",
|
||||
directory: APP_DIRECTORY,
|
||||
data: content,
|
||||
encoding: Encoding.UTF8,
|
||||
|
|
Loading…
Reference in a new issue