mirror of https://github.com/VueTubeApp/VueTube
feat: ✨ start new plugin loader (remove storage permissions)
This commit is contained in:
parent
a3eca42539
commit
39cfffef7f
|
@ -1,7 +1,12 @@
|
|||
<template>
|
||||
<div>
|
||||
|
||||
<center v-if="plugins.length == 0">
|
||||
<div style="margin: 1em;">
|
||||
<v-btn style="width: 100%;" class="primary" @click="pickFile()">Load Plugin</v-btn>
|
||||
<input type="file" id="filePicker" accept=".js" />
|
||||
</div>
|
||||
|
||||
<center v-if="plugins.length == 0" style="margin-top: 2em;">
|
||||
<v-icon size="50px">mdi-connection</v-icon>
|
||||
<h2>No plugins installed</h2>
|
||||
</center>
|
||||
|
@ -49,6 +54,13 @@
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
#filePicker {
|
||||
visibility: hidden;
|
||||
display: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
|
@ -58,7 +70,19 @@ export default {
|
|||
};
|
||||
},
|
||||
async mounted() {
|
||||
this.plugins = await this.$tppl.list;
|
||||
//this.plugins = await this.$tppl.list;
|
||||
|
||||
document.getElementById('filePicker').onchange = function() {
|
||||
const file = document.getElementById("filePicker").files[0];
|
||||
|
||||
};
|
||||
|
||||
|
||||
},
|
||||
methods: {
|
||||
pickFile() {
|
||||
document.getElementById("filePicker").click();
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -18,9 +18,7 @@ const ytApiVal = {
|
|||
};
|
||||
|
||||
const filesystem = {
|
||||
plugins: "vuetube/plugins",
|
||||
temp: "vuetube/temp",
|
||||
downloads: "vuetube/downloads",
|
||||
plugins: "vuetube/plugins"
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
|
|
|
@ -3,14 +3,16 @@ import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
|||
import { fs } from './constants';
|
||||
|
||||
//--- Set Up App Directory ---//
|
||||
const APP_DIRECTORY = Directory.Documents;
|
||||
const APP_DIRECTORY = Directory.Data;
|
||||
|
||||
|
||||
const ensureStructure = new Promise(async (resolve, reject) => {
|
||||
/*
|
||||
const perms = await Filesystem.checkPermissions();
|
||||
if (perms.publicStorage !== "granted") {
|
||||
perms = await Filesystem.requestPermissions();
|
||||
}
|
||||
// Legacy shit that isnt supported on android 10+ */
|
||||
|
||||
//--- Ensure Plugins Folder ---//
|
||||
try {
|
||||
|
@ -20,14 +22,6 @@ const ensureStructure = new Promise(async (resolve, reject) => {
|
|||
});
|
||||
} catch (e) { /* Exists */ }
|
||||
|
||||
//--- Ensure Temp Folder ---//
|
||||
try {
|
||||
await Filesystem.mkdir({
|
||||
directory: APP_DIRECTORY, recursive: true,
|
||||
path: fs.temp,
|
||||
});
|
||||
} catch (e) { /* Exists */ }
|
||||
|
||||
perms
|
||||
? resolve(true)
|
||||
: reject(false)
|
||||
|
@ -44,12 +38,24 @@ const module = {
|
|||
if (await !ensureStructure) reject("Invalid Structure");
|
||||
|
||||
const plugins = await Filesystem.readdir({
|
||||
path: "vuetube/plugins/",
|
||||
path: fs.plugins,
|
||||
directory: APP_DIRECTORY
|
||||
});
|
||||
resolve(plugins);
|
||||
|
||||
})
|
||||
}),
|
||||
|
||||
debug(path) { return new Promise(async (resolve, reject) => {
|
||||
|
||||
if (await !ensureStructure) reject("Invalid Structure");
|
||||
|
||||
const plugins = await Filesystem.readdir({
|
||||
path: path,
|
||||
directory: APP_DIRECTORY
|
||||
});
|
||||
resolve(plugins);
|
||||
|
||||
})}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
android:theme="@style/AppTheme">
|
||||
|
||||
<activity
|
||||
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
|
||||
|
@ -75,7 +74,5 @@
|
|||
|
||||
<!-- Permissions -->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
</manifest>
|
||||
|
|
Loading…
Reference in New Issue