aboutsummaryrefslogtreecommitdiff
path: root/src/site
diff options
context:
space:
mode:
Diffstat (limited to 'src/site')
-rw-r--r--src/site/components/album/AlbumDetails.vue62
-rw-r--r--src/site/components/album/AlbumEntry.vue41
-rw-r--r--src/site/components/grid/Grid.vue4
-rw-r--r--src/site/components/loading/CubeShadow.vue17
-rw-r--r--src/site/components/loading/Origami.vue18
-rw-r--r--src/site/components/loading/PingPong.vue26
-rw-r--r--src/site/components/loading/RotateSquare.vue13
-rw-r--r--src/site/components/uploader/Uploader.vue1
-rw-r--r--src/site/layouts/default.vue23
-rw-r--r--src/site/layouts/error.vue2
-rw-r--r--src/site/middleware/admin.js3
-rw-r--r--src/site/middleware/auth.js3
-rw-r--r--src/site/pages/dashboard/admin/file/_id.vue82
-rw-r--r--src/site/pages/dashboard/admin/settings.vue85
-rw-r--r--src/site/pages/dashboard/tags/index.vue43
-rw-r--r--src/site/pages/faq.vue23
-rw-r--r--src/site/pages/index.vue1
-rw-r--r--src/site/pages/register.vue37
-rw-r--r--src/site/plugins/axios.js12
-rw-r--r--src/site/plugins/flexsearch.js5
-rw-r--r--src/site/plugins/nuxt-client-init.js2
-rw-r--r--src/site/plugins/vue-isyourpasswordsafe.js2
-rw-r--r--src/site/plugins/vue-timeago.js2
-rw-r--r--src/site/store/auth.js4
24 files changed, 314 insertions, 197 deletions
diff --git a/src/site/components/album/AlbumDetails.vue b/src/site/components/album/AlbumDetails.vue
index f117f2f..b411f13 100644
--- a/src/site/components/album/AlbumDetails.vue
+++ b/src/site/components/album/AlbumDetails.vue
@@ -6,34 +6,43 @@
:data="details.links || []"
:mobile-cards="true">
<template slot-scope="props">
- <b-table-column field="identifier"
+ <b-table-column
+ field="identifier"
label="Link"
centered>
- <a :href="`${config.URL}/a/${props.row.identifier}`"
+ <a
+ :href="`${config.URL}/a/${props.row.identifier}`"
target="_blank">
{{ props.row.identifier }}
</a>
</b-table-column>
- <b-table-column field="views"
+ <b-table-column
+ field="views"
label="Views"
centered>
{{ props.row.views }}
</b-table-column>
- <b-table-column field="enableDownload"
+ <b-table-column
+ field="enableDownload"
label="Allow download"
centered>
- <b-switch v-model="props.row.enableDownload"
+ <b-switch
+ v-model="props.row.enableDownload"
@input="updateLinkOptions(albumId, props.row)" />
</b-table-column>
- <b-table-column field="enabled"
+ <b-table-column
+ field="enabled"
numeric>
- <button :class="{ 'is-loading': isDeleting(props.row.identifier) }"
+ <button
+ :class="{ 'is-loading': isDeleting(props.row.identifier) }"
class="button is-danger"
:disabled="isDeleting(props.row.identifier)"
- @click="promptDeleteAlbumLink(albumId, props.row.identifier)">Delete link</button>
+ @click="promptDeleteAlbumLink(albumId, props.row.identifier)">
+ Delete link
+ </button>
</b-table-column>
</template>
<template slot="empty">
@@ -49,10 +58,13 @@
<div class="level is-paddingless">
<div class="level-left">
<div class="level-item">
- <button :class="{ 'is-loading': isCreatingLink }"
+ <button
+ :class="{ 'is-loading': isCreatingLink }"
class="button is-primary"
style="float: left"
- @click="createLink(albumId)">Create new link</button>
+ @click="createLink(albumId)">
+ Create new link
+ </button>
</div>
<div class="level-item">
<span class="has-text-default">{{ details.links.length }} / {{ config.maxLinksPerAlbum }} links created</span>
@@ -61,9 +73,12 @@
<div class="level-right">
<div class="level-item">
- <button class="button is-danger"
+ <button
+ class="button is-danger"
style="float: right"
- @click="promptDeleteAlbum(albumId)">Delete album</button>
+ @click="promptDeleteAlbum(albumId)">
+ Delete album
+ </button>
</div>
</div>
</div>
@@ -79,18 +94,18 @@ export default {
props: {
albumId: {
type: Number,
- default: 0
+ default: 0,
},
details: {
type: Object,
- default: () => ({})
+ default: () => ({}),
},
},
data() {
return {
isCreatingLink: false,
isDeletingLinks: [],
- }
+ };
},
computed: mapState(['config']),
methods: {
@@ -99,20 +114,20 @@ export default {
deleteAlbumLinkAction: 'albums/deleteLink',
updateLinkOptionsAction: 'albums/updateLinkOptions',
createLinkAction: 'albums/createLink',
- alert: 'alert/set'
+ alert: 'alert/set',
}),
promptDeleteAlbum(id) {
this.$buefy.dialog.confirm({
type: 'is-danger',
message: 'Are you sure you want to delete this album?',
- onConfirm: () => this.deleteAlbum(id)
+ onConfirm: () => this.deleteAlbum(id),
});
},
promptDeleteAlbumLink(albumId, identifier) {
this.$buefy.dialog.confirm({
type: 'is-danger',
message: 'Are you sure you want to delete this album link?',
- onConfirm: () => this.deleteAlbumLink(albumId, identifier)
+ onConfirm: () => this.deleteAlbumLink(albumId, identifier),
});
},
async deleteAlbum(id) {
@@ -122,7 +137,7 @@ export default {
this.alert({ text: response.message, error: false });
} catch (e) {
this.alert({ text: e.message, error: true });
- }
+ }
},
async deleteAlbumLink(albumId, identifier) {
this.isDeletingLinks.push(identifier);
@@ -133,7 +148,7 @@ export default {
} catch (e) {
this.alert({ text: e.message, error: true });
} finally {
- this.isDeletingLinks = this.isDeletingLinks.filter(e => e !== identifier);
+ this.isDeletingLinks = this.isDeletingLinks.filter((e) => e !== identifier);
}
},
async createLink(albumId) {
@@ -155,12 +170,12 @@ export default {
this.alert({ text: response.message, error: false });
} catch (e) {
this.alert({ text: e.message, error: true });
- }
+ }
},
isDeleting(identifier) {
return this.isDeletingLinks.indexOf(identifier) > -1;
- }
- }
+ },
+ },
};
</script>
@@ -184,7 +199,6 @@ export default {
}
</style>
-
<style lang="scss">
@import '~/assets/styles/_colors.scss';
diff --git a/src/site/components/album/AlbumEntry.vue b/src/site/components/album/AlbumEntry.vue
index 28e434a..2723b49 100644
--- a/src/site/components/album/AlbumEntry.vue
+++ b/src/site/components/album/AlbumEntry.vue
@@ -1,8 +1,10 @@
<template>
<div class="album">
- <div class="arrow-container"
+ <div
+ class="arrow-container"
@click="toggleDetails(album)">
- <i :class="{ active: isExpanded }"
+ <i
+ :class="{ active: isExpanded }"
class="icon-arrow" />
</div>
<div class="thumb">
@@ -12,7 +14,9 @@
</div>
<div class="info">
<h4>
- <router-link :to="`/dashboard/albums/${album.id}`">{{ album.name }}</router-link>
+ <router-link :to="`/dashboard/albums/${album.id}`">
+ {{ album.name }}
+ </router-link>
</h4>
<span>
Created <span class="is-inline has-text-weight-semibold"><timeago :since="album.createdAt" /></span>
@@ -21,19 +25,24 @@
</div>
<div class="latest is-hidden-mobile">
<template v-if="album.fileCount > 0">
- <div v-for="file of album.files"
+ <div
+ v-for="file of album.files"
:key="file.id"
class="thumb">
<figure class="image is-64x64">
- <a :href="file.url"
+ <a
+ :href="file.url"
target="_blank">
<img :src="file.thumbSquare">
</a>
</figure>
</div>
- <div v-if="album.fileCount > 5"
+ <div
+ v-if="album.fileCount > 5"
class="thumb more no-background">
- <router-link :to="`/dashboard/albums/${album.id}`">{{ album.fileCount - 5 }}+ more</router-link>
+ <router-link :to="`/dashboard/albums/${album.id}`">
+ {{ album.fileCount - 5 }}+ more
+ </router-link>
</div>
</template>
<template v-else>
@@ -41,7 +50,8 @@
</template>
</div>
- <AlbumDetails v-if="isExpanded"
+ <AlbumDetails
+ v-if="isExpanded"
:details="getDetails(album.id)"
:albumId="album.id" />
</div>
@@ -53,22 +63,22 @@ import AlbumDetails from '~/components/album/AlbumDetails.vue';
export default {
components: {
- AlbumDetails
+ AlbumDetails,
},
props: {
album: {
type: Object,
- default: () => ({})
- }
+ default: () => ({}),
+ },
},
computed: {
...mapGetters({
isExpandedGetter: 'albums/isExpanded',
- getDetails: 'albums/getDetails'
+ getDetails: 'albums/getDetails',
}),
isExpanded() {
return this.isExpandedGetter(this.album.id);
- }
+ },
},
methods: {
async toggleDetails(album) {
@@ -76,8 +86,8 @@ export default {
await this.$store.dispatch('albums/fetchDetails', album.id);
}
this.$store.commit('albums/toggleExpandedState', album.id);
- }
- }
+ },
+ },
};
</script>
@@ -175,4 +185,3 @@ export default {
div.no-background { background: none !important; }
</style>
-
diff --git a/src/site/components/grid/Grid.vue b/src/site/components/grid/Grid.vue
index 42dcc6b..84c0b11 100644
--- a/src/site/components/grid/Grid.vue
+++ b/src/site/components/grid/Grid.vue
@@ -163,7 +163,7 @@
<hr>
<div class="albums-container">
- <div v-for="(album, index) in albums" :key="album.id" class="album">
+ <div v-for="album in albums" :key="album.id" class="album">
<div class="field">
<b-checkbox
:value="isAlbumSelected(album.id)"
@@ -252,7 +252,7 @@ export default {
methods: {
async search() {
const data = await this.$search.do(this.searchTerm, ['name', 'original', 'type', 'albums:name']);
- console.log('> Search result data', data);
+ console.log('> Search result data', data); // eslint-disable-line no-console
},
deleteFile(file) {
// this.$emit('delete', file);
diff --git a/src/site/components/loading/CubeShadow.vue b/src/site/components/loading/CubeShadow.vue
index af31dac..bbfdb52 100644
--- a/src/site/components/loading/CubeShadow.vue
+++ b/src/site/components/loading/CubeShadow.vue
@@ -1,5 +1,6 @@
<template>
- <div :style="styles"
+ <div
+ :style="styles"
class="spinner spinner--cube-shadow" />
</template>
@@ -8,16 +9,16 @@ export default {
props: {
size: {
type: String,
- default: '60px'
+ default: '60px',
},
background: {
type: String,
- default: '#9C27B0'
+ default: '#9C27B0',
},
duration: {
type: String,
- default: '1.8s'
- }
+ default: '1.8s',
+ },
},
computed: {
styles() {
@@ -25,10 +26,10 @@ export default {
width: this.size,
height: this.size,
backgroundColor: this.background,
- animationDuration: this.duration
+ animationDuration: this.duration,
};
- }
- }
+ },
+ },
};
</script>
diff --git a/src/site/components/loading/Origami.vue b/src/site/components/loading/Origami.vue
index d1b523d..cd1c087 100644
--- a/src/site/components/loading/Origami.vue
+++ b/src/site/components/loading/Origami.vue
@@ -1,7 +1,9 @@
<template>
- <div :style="styles"
+ <div
+ :style="styles"
class="spinner spinner-origami">
- <div :style="innerStyles"
+ <div
+ :style="innerStyles"
class="spinner-inner loading">
<span class="slice" />
<span class="slice" />
@@ -18,21 +20,21 @@ export default {
props: {
size: {
type: String,
- default: '40px'
- }
+ default: '40px',
+ },
},
computed: {
innerStyles() {
- let size = parseInt(this.size);
+ const size = parseInt(this.size, 10);
return { transform: `scale(${(size / 60)})` };
},
styles() {
return {
width: this.size,
- height: this.size
+ height: this.size,
};
- }
- }
+ },
+ },
};
</script>
diff --git a/src/site/components/loading/PingPong.vue b/src/site/components/loading/PingPong.vue
index ac33e28..d562e9f 100644
--- a/src/site/components/loading/PingPong.vue
+++ b/src/site/components/loading/PingPong.vue
@@ -1,12 +1,14 @@
<template>
- <div :style="styles"
+ <div
+ :style="styles"
class="spinner spinner--ping-pong">
- <div :style="innerStyles"
+ <div
+ :style="innerStyles"
class="spinner-inner">
<div class="board">
- <div class="left"/>
- <div class="right"/>
- <div class="ball"/>
+ <div class="left" />
+ <div class="right" />
+ <div class="ball" />
</div>
</div>
</div>
@@ -17,22 +19,22 @@ export default {
props: {
size: {
type: String,
- default: '60px'
- }
+ default: '60px',
+ },
},
computed: {
innerStyles() {
- let size = parseInt(this.size);
+ const size = parseInt(this.size, 10);
return { transform: `scale(${size / 250})` };
},
styles() {
return {
width: this.size,
- height: this.size
+ height: this.size,
};
- }
- }
-}
+ },
+ },
+};
</script>
<style lang="scss" scoped>
diff --git a/src/site/components/loading/RotateSquare.vue b/src/site/components/loading/RotateSquare.vue
index 4da8300..089e01a 100644
--- a/src/site/components/loading/RotateSquare.vue
+++ b/src/site/components/loading/RotateSquare.vue
@@ -1,5 +1,6 @@
<template>
- <div :style="styles"
+ <div
+ :style="styles"
class="spinner spinner--rotate-square-2" />
</template>
@@ -8,18 +9,18 @@ export default {
props: {
size: {
type: String,
- default: '40px'
- }
+ default: '40px',
+ },
},
computed: {
styles() {
return {
width: this.size,
height: this.size,
- display: 'inline-block'
+ display: 'inline-block',
};
- }
- }
+ },
+ },
};
</script>
diff --git a/src/site/components/uploader/Uploader.vue b/src/site/components/uploader/Uploader.vue
index c7be372..7e2d446 100644
--- a/src/site/components/uploader/Uploader.vue
+++ b/src/site/components/uploader/Uploader.vue
@@ -172,6 +172,7 @@ export default {
text: 'There was an error uploading this file. Check the console.',
error: true,
});
+ // eslint-disable-next-line no-console
console.error(file, message, xhr);
},
async dropzoneChunksUploaded(file, done) {
diff --git a/src/site/layouts/default.vue b/src/site/layouts/default.vue
index 579a73e..13a56c0 100644
--- a/src/site/layouts/default.vue
+++ b/src/site/layouts/default.vue
@@ -1,27 +1,29 @@
<template>
- <div v-bar
+ <div
+ v-bar
class="scroll-area">
<div class="default-body">
<Navbar :isWhite="true" />
- <nuxt-child id="app"
+ <nuxt-child
+ id="app"
class="nuxt-app is-height-max-content" />
<Footer />
</div>
</div>
</template>
<script>
-import Navbar from '~/components/navbar/Navbar.vue';
-import Footer from '~/components/footer/Footer';
import { mapState } from 'vuex';
+import Navbar from '~/components/navbar/Navbar.vue';
+import Footer from '~/components/footer/Footer.vue';
export default {
components: {
Navbar,
- Footer
+ Footer,
},
computed: mapState(['config']),
created() {
- this.$store.watch(state => state.alert.text, () => {
+ this.$store.watch((state) => state.alert.text, () => {
const { text, error } = this.$store.state.alert;
if (!text) return;
@@ -30,20 +32,21 @@ export default {
duration: 3500,
message: text,
position: 'is-bottom',
- type: error ? 'is-danger' : 'is-success'
+ type: error ? 'is-danger' : 'is-success',
});
this.$store.dispatch('alert/clear', null);
- })
+ });
},
mounted() {
+ // eslint-disable-next-line no-console
console.log(
`%c lolisafe %c v${this.config.version} %c`,
'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff',
'background:#ff015b; padding: 1px; border-radius: 0 3px 3px 0; color: #fff',
- 'background:transparent'
+ 'background:transparent',
);
- }
+ },
};
</script>
diff --git a/src/site/layouts/error.vue b/src/site/layouts/error.vue
index 77d188f..3f12c46 100644
--- a/src/site/layouts/error.vue
+++ b/src/site/layouts/error.vue
@@ -23,6 +23,6 @@
import Navbar from '~/components/navbar/Navbar.vue';
export default {
- components: { Navbar }
+ components: { Navbar },
};
</script>
diff --git a/src/site/middleware/admin.js b/src/site/middleware/admin.js
index 5c09220..1a94b75 100644
--- a/src/site/middleware/admin.js
+++ b/src/site/middleware/admin.js
@@ -1,5 +1,6 @@
-export default function({ store, redirect }) {
+export default function ({ store, redirect }) {
// If the user is not authenticated
if (!store.state.auth.user) return redirect('/login');
if (!store.state.auth.user.isAdmin) return redirect('/dashboard');
+ return true;
}
diff --git a/src/site/middleware/auth.js b/src/site/middleware/auth.js
index c3f339c..b2ecc68 100644
--- a/src/site/middleware/auth.js
+++ b/src/site/middleware/auth.js
@@ -1,6 +1,7 @@
-export default function({ store, redirect }) {
+export default function ({ store, redirect }) {
// If the user is not authenticated
if (!store.state.auth.loggedIn) {
return redirect('/login');
}
+ return true;
}
diff --git a/src/site/pages/dashboard/admin/file/_id.vue b/src/site/pages/dashboard/admin/file/_id.vue
index 5853770..34fcd01 100644
--- a/src/site/pages/dashboard/admin/file/_id.vue
+++ b/src/site/pages/dashboard/admin/file/_id.vue
@@ -9,74 +9,90 @@
<Sidebar />
</div>
<div class="column">
- <h2 class="subtitle">File details</h2>
+ <h2 class="subtitle">
+ File details
+ </h2>
<hr>
<div class="columns">
<div class="column is-6">
- <b-field label="ID"
+ <b-field
+ label="ID"
horizontal>
<span>{{ file.id }}</span>
</b-field>
- <b-field label="Name"
+ <b-field
+ label="Name"
horizontal>
<span>{{ file.name }}</span>
</b-field>
- <b-field label="Original Name"
+ <b-field
+ label="Original Name"
horizontal>
<span>{{ file.original }}</span>
</b-field>
- <b-field label="IP"
+ <b-field
+ label="IP"
horizontal>
<span class="underline">{{ file.ip }}</span>
</b-field>
- <b-field label="Link"
+ <b-field
+ label="Link"
horizontal>
- <a :href="file.url"
+ <a
+ :href="file.url"
target="_blank">{{ file.url }}</a>
</b-field>
- <b-field label="Size"
+ <b-field
+ label="Size"
horizontal>
<span>{{ formatBytes(file.size) }}</span>
</b-field>
- <b-field label="Hash"
+ <b-field
+ label="Hash"
horizontal>
<span>{{ file.hash }}</span>
</b-field>
- <b-field label="Uploaded"
+ <b-field
+ label="Uploaded"
horizontal>
<span><timeago :since="file.createdAt" /></span>
</b-field>
</div>
<div class="column is-6">
- <b-field label="User Id"
+ <b-field
+ label="User Id"
horizontal>
<span>{{ user.id }}</span>
</b-field>
- <b-field label="Username"
+ <b-field
+ label="Username"
horizontal>
<span>{{ user.username }}</span>
</b-field>
- <b-field label="Enabled"
+ <b-field
+ label="Enabled"
horizontal>
<span>{{ user.enabled }}</span>
</b-field>
- <b-field label="Registered"
+ <b-field
+ label="Registered"
horizontal>
<span><timeago :since="user.createdAt" /></span>
</b-field>
- <b-field label="Files"
+ <b-field
+ label="Files"
horizontal>
<span>
<nuxt-link :to="`/dashboard/admin/user/${user.id}`">{{ user.fileCount }}</nuxt-link>
@@ -86,10 +102,16 @@
</div>
<div class="mb2 mt2 text-center">
- <button class="button is-danger"
- @click="promptBanIP">Ban IP</button>
- <button class="button is-danger"
- @click="promptDisableUser">Disable user</button>
+ <button
+ class="button is-danger"
+ @click="promptBanIP">
+ Ban IP
+ </button>
+ <button
+ class="button is-danger"
+ @click="promptDisableUser">
+ Disable user
+ </button>
</div>
</div>
</div>
@@ -102,14 +124,14 @@ import Sidebar from '~/components/sidebar/Sidebar.vue';
export default {
components: {
- Sidebar
+ Sidebar,
},
middleware: ['auth', 'admin'],
data() {
return {
options: {},
file: null,
- user: null
+ user: null,
};
},
async asyncData({ $axios, route }) {
@@ -117,13 +139,13 @@ export default {
const response = await $axios.$get(`file/${route.params.id}`);
return {
file: response.file ? response.file : null,
- user: response.user ? response.user : null
+ user: response.user ? response.user : null,
};
} catch (error) {
console.error(error);
return {
file: null,
- user: null
+ user: null,
};
}
},
@@ -132,12 +154,12 @@ export default {
this.$buefy.dialog.confirm({
type: 'is-danger',
message: 'Are you sure you want to disable the account of the user that uploaded this file?',
- onConfirm: () => this.disableUser()
+ onConfirm: () => this.disableUser(),
});
},
async disableUser() {
const response = await this.$axios.$post('admin/users/disable', {
- id: this.user.id
+ id: this.user.id,
});
this.$buefy.toast.open(response.message);
},
@@ -145,12 +167,12 @@ export default {
this.$buefy.dialog.confirm({
type: 'is-danger',
message: 'Are you sure you want to ban the IP this file was uploaded from?',
- onConfirm: () => this.banIP()
+ onConfirm: () => this.banIP(),
});
},
async banIP() {
const response = await this.$axios.$post('admin/ban/ip', {
- ip: this.file.ip
+ ip: this.file.ip,
});
this.$buefy.toast.open(response.message);
},
@@ -163,8 +185,8 @@ export default {
const i = Math.floor(Math.log(bytes) / Math.log(k));
- return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
- }
- }
+ return `${parseFloat((bytes / k ** i).toFixed(dm))} ${sizes[i]}`;
+ },
+ },
};
</script>
diff --git a/src/site/pages/dashboard/admin/settings.vue b/src/site/pages/dashboard/admin/settings.vue
index 2d59fff..9e63a7c 100644
--- a/src/site/pages/dashboard/admin/settings.vue
+++ b/src/site/pages/dashboard/admin/settings.vue
@@ -6,87 +6,112 @@
<Sidebar />
</div>
<div class="column">
- <h2 class="subtitle">Service settings</h2>
+ <h2 class="subtitle">
+ Service settings
+ </h2>
<hr>
- <b-field label="Service name"
+ <b-field
+ label="Service name"
message="Please enter the name which this service is gonna be identified as"
horizontal>
- <b-input v-model="options.serviceName"
+ <b-input
+ v-model="options.serviceName"
expanded />
</b-field>
- <b-field label="Upload folder"
+ <b-field
+ label="Upload folder"
message="Where to store the files relative to the working directory"
horizontal>
- <b-input v-model="options.uploadFolder"
+ <b-input
+ v-model="options.uploadFolder"
expanded />
</b-field>
- <b-field label="Links per album"
+ <b-field
+ label="Links per album"
message="Maximum links allowed per album"
horizontal>
- <b-input v-model="options.linksPerAlbum"
+ <b-input
+ v-model="options.linksPerAlbum"
type="number"
expanded />
</b-field>
- <b-field label="Max upload size"
+ <b-field
+ label="Max upload size"
message="Maximum allowed file size in MB"
horizontal>
- <b-input v-model="options.maxUploadSize"
+ <b-input
+ v-model="options.maxUploadSize"
expanded />
</b-field>
- <b-field label="Filename length"
+ <b-field
+ label="Filename length"
message="How many characters long should the generated filenames be"
horizontal>
- <b-input v-model="options.filenameLength"
+ <b-input
+ v-model="options.filenameLength"
expanded />
</b-field>
- <b-field label="Album link length"
+ <b-field
+ label="Album link length"
message="How many characters a link for an album should have"
horizontal>
- <b-input v-model="options.albumLinkLength"
+ <b-input
+ v-model="options.albumLinkLength"
expanded />
</b-field>
- <b-field label="Generate thumbnails"
+ <b-field
+ label="Generate thumbnails"
message="Generate thumbnails when uploading a file if possible"
horizontal>
- <b-switch v-model="options.generateThumbnails"
+ <b-switch
+ v-model="options.generateThumbnails"
:true-value="true"
:false-value="false" />
</b-field>
- <b-field label="Generate zips"
+ <b-field
+ label="Generate zips"
message="Allow generating zips to download entire albums"
horizontal>
- <b-switch v-model="options.generateZips"
+ <b-switch
+ v-model="options.generateZips"
:true-value="true"
:false-value="false" />
</b-field>
- <b-field label="Public mode"
+ <b-field
+ label="Public mode"
message="Enable anonymous uploades"
horizontal>
- <b-switch v-model="options.publicMode"
+ <b-switch
+ v-model="options.publicMode"
:true-value="true"
:false-value="false" />
</b-field>
- <b-field label="Enable creating account"
+ <b-field
+ label="Enable creating account"
message="Enable creating new accounts in the platform"
horizontal>
- <b-switch v-model="options.enableAccounts"
+ <b-switch
+ v-model="options.enableAccounts"
:true-value="true"
:false-value="false" />
</b-field>
<div class="mb2 mt2 text-center">
- <button class="button is-primary"
- @click="promptRestartService">Save and restart service</button>
+ <button
+ class="button is-primary"
+ @click="promptRestartService">
+ Save and restart service
+ </button>
</div>
</div>
</div>
@@ -99,12 +124,12 @@ import Sidebar from '~/components/sidebar/Sidebar.vue';
export default {
components: {
- Sidebar
+ Sidebar,
},
middleware: ['auth', 'admin'],
data() {
return {
- options: {}
+ options: {},
};
},
metaInfo() {
@@ -115,19 +140,19 @@ export default {
},
methods: {
async getSettings() {
- const response = await this.$axios.$get(`service/config`);
+ const response = await this.$axios.$get('service/config');
this.options = response.config;
},
promptRestartService() {
this.$buefy.dialog.confirm({
message: 'Keep in mind that restarting only works if you have PM2 or something similar set up. Continue?',
- onConfirm: () => this.restartService()
+ onConfirm: () => this.restartService(),
});
},
async restartService() {
- const response = await this.$axios.$post(`service/restart`);
+ const response = await this.$axios.$post('service/restart');
this.$buefy.toast.open(response.message);
- }
- }
+ },
+ },
};
</script>
diff --git a/src/site/pages/dashboard/tags/index.vue b/src/site/pages/dashboard/tags/index.vue
index a9476da..10193a8 100644
--- a/src/site/pages/dashboard/tags/index.vue
+++ b/src/site/pages/dashboard/tags/index.vue
@@ -123,7 +123,6 @@
}
</style>
-
<template>
<section class="section is-fullheight dashboard">
<div class="container">
@@ -132,27 +131,35 @@
<Sidebar />
</div>
<div class="column">
- <h2 class="subtitle">Manage your tags</h2>
+ <h2 class="subtitle">
+ Manage your tags
+ </h2>
<hr>
<div class="search-container">
<b-field>
- <b-input v-model="newTagName"
+ <b-input
+ v-model="newTagName"
placeholder="Tag name..."
type="text"
@keyup.enter.native="createTag" />
<p class="control">
- <button class="button is-primary"
- @click="createTag">Create tags</button>
+ <button
+ class="button is-primary"
+ @click="createTag">
+ Create tags
+ </button>
</p>
</b-field>
</div>
<div class="view-container">
- <div v-for="tag in tags"
+ <div
+ v-for="tag in tags"
:key="tag.id"
class="album">
- <div class="arrow-container"
+ <div
+ class="arrow-container"
@click="promptDeleteTag">
<i class="icon-arrow" />
</div>
@@ -165,7 +172,9 @@
-->
<div class="info">
<h4>
- <router-link :to="`/dashboard/tags/${tag.id}`">{{ tag.name }}</router-link>
+ <router-link :to="`/dashboard/tags/${tag.id}`">
+ {{ tag.name }}
+ </router-link>
</h4>
<span>{{ tag.count || 0 }} files</span>
</div>
@@ -205,19 +214,19 @@ import Sidebar from '~/components/sidebar/Sidebar.vue';
export default {
components: {
- Sidebar
+ Sidebar,
},
middleware: 'auth',
data() {
return {
tags: [],
- newTagName: null
+ newTagName: null,
};
},
computed: {
config() {
return this.$store.state.config;
- }
+ },
},
metaInfo() {
return { title: 'Tags' };
@@ -230,7 +239,7 @@ export default {
this.$buefy.dialog.confirm({
type: 'is-danger',
message: 'Are you sure you want to delete this tag?',
- onConfirm: () => this.promptPurgeTag(id)
+ onConfirm: () => this.promptPurgeTag(id),
});
},
promptPurgeTag(id) {
@@ -240,7 +249,7 @@ export default {
cancelText: 'No',
confirmText: 'Yes',
onConfirm: () => this.deleteTag(id, true),
- onCancel: () => this.deleteTag(id, false)
+ onCancel: () => this.deleteTag(id, false),
});
},
async deleteTag(id, purge) {
@@ -250,19 +259,19 @@ export default {
},
async createTag() {
if (!this.newTagName || this.newTagName === '') return;
- const response = await this.$axios.$post(`tag/new`,
+ const response = await this.$axios.$post('tag/new',
{ name: this.newTagName });
this.newTagName = null;
this.$buefy.toast.open(response.message);
this.getTags();
},
async getTags() {
- const response = await this.$axios.$get(`tags`);
+ const response = await this.$axios.$get('tags');
for (const tag of response.tags) {
tag.isDetailsOpen = false;
}
this.tags = response.tags;
- }
- }
+ },
+ },
};
</script>
diff --git a/src/site/pages/faq.vue b/src/site/pages/faq.vue
index bb84a7d..85e8744 100644
--- a/src/site/pages/faq.vue
+++ b/src/site/pages/faq.vue
@@ -1,34 +1,45 @@
<template>
+ <!-- eslint-disable max-len -->
<div class="container has-text-left">
- <h2 class="subtitle">What is lolisafe?</h2>
+ <h2 class="subtitle">
+ What is lolisafe?
+ </h2>
<article class="message">
<div class="message-body">
lolisafe is an easy to use, open source and completely free file upload service. We accept your files, photos, documents, anything, and give you back a shareable link for you to send to others.
</div>
</article>
- <h2 class="subtitle">Can I run my own lolisafe?</h2>
+ <h2 class="subtitle">
+ Can I run my own lolisafe?
+ </h2>
<article class="message">
<div class="message-body">
Definitely. Head to <a target="_blank" href="https://github.com/WeebDev/lolisafe">our GitHub repo</a> and follow the instructions to clone, build and deploy it by yourself. It's super easy too!
</div>
</article>
- <h2 class="subtitle">How can I keep track of my uploads?</h2>
+ <h2 class="subtitle">
+ How can I keep track of my uploads?
+ </h2>
<article class="message">
<div class="message-body">
Simply create a user on the site and every upload will be associated with your account, granting you access to your uploaded files through our dashboard.
</div>
</article>
- <h2 class="subtitle">What are albums?</h2>
+ <h2 class="subtitle">
+ What are albums?
+ </h2>
<article class="message">
<div class="message-body">
Albums are a simple way of sorting uploads together. Right now you can create albums through the dashboard and use them only with <a target="_blank" href="https://chrome.google.com/webstore/detail/loli-safe-uploader/enkkmplljfjppcdaancckgilmgoiofnj">our chrome extension</a> which will enable you to <strong>right click -&gt; send to lolisafe</strong> or to a desired album if you have any.
</div>
</article>
- <h2 class="subtitle">Why should I use this?</h2>
+ <h2 class="subtitle">
+ Why should I use this?
+ </h2>
<article class="message">
<div class="message-body">
There are too many file upload services out there, and a lot of them rely on the foundations of pomf which is ancient. In a desperate and unsuccessful attempt of finding a good file uploader that's easily extendable, lolisafe was born. We give you control over your files, we give you a way to sort your uploads into albums for ease of access and we give you an api to use with ShareX or any other thing that let's you make POST requests.
@@ -45,7 +56,7 @@ export default {
},
metaInfo() {
return { title: 'Faq' };
- }
+ },
};
</script>
diff --git a/src/site/pages/index.vue b/src/site/pages/index.vue
index c8fb7b8..a28eea4 100644
--- a/src/site/pages/index.vue
+++ b/src/site/pages/index.vue
@@ -11,6 +11,7 @@
<div class="content-wrapper">
<h4>Blazing fast file uploader. <br>For real.</h4>
<p>
+ <!-- eslint-disable-next-line max-len -->
A <strong>modern</strong> and <strong>self-hosted</strong> file upload service that can handle anything you throw at it. Fast uploads, file manager and sharing capabilities all crafted with a beautiful user experience in mind.
</p>
</div>
diff --git a/src/site/pages/register.vue b/src/site/pages/register.vue
index 92eb35a..1216dc1 100644
--- a/src/site/pages/register.vue
+++ b/src/site/pages/register.vue
@@ -10,18 +10,21 @@
<div class="columns">
<div class="column is-4 is-offset-4">
<b-field>
- <b-input v-model="username"
+ <b-input
+ v-model="username"
type="text"
placeholder="Username" />
</b-field>
<b-field>
- <b-input v-model="password"
+ <b-input
+ v-model="password"
type="password"
placeholder="Password"
password-reveal />
</b-field>
<b-field>
- <b-input v-model="rePassword"
+ <b-input
+ v-model="rePassword"
type="password"
placeholder="Re-type Password"
password-reveal
@@ -29,11 +32,17 @@
</b-field>
<p class="control has-addons is-pulled-right">
- <router-link to="/login"
- class="is-text">Already have an account?</router-link>
- <button class="button is-primary big ml1"
+ <router-link
+ to="/login"
+ class="is-text">
+ Already have an account?
+ </router-link>
+ <button
+ class="button is-primary big ml1"
:disabled="isLoading"
- @click="register">Register</button>
+ @click="register">
+ Register
+ </button>
</p>
</div>
</div>
@@ -51,7 +60,7 @@ export default {
username: null,
password: null,
rePassword: null,
- isLoading: false
+ isLoading: false,
};
},
computed: mapState(['config', 'auth']),
@@ -64,23 +73,23 @@ export default {
if (!this.username || !this.password || !this.rePassword) {
this.$store.dispatch('alert', {
text: 'Please fill all fields before attempting to register.',
- error: true
+ error: true,
});
return;
}
if (this.password !== this.rePassword) {
this.$store.dispatch('alert', {
text: "Passwords don't match",
- error: true
+ error: true,
});
return;
}
this.isLoading = true;
try {
- const response = await this.$axios.$post(`auth/register`, {
+ const response = await this.$axios.$post('auth/register', {
username: this.username,
- password: this.password
+ password: this.password,
});
this.$store.dispatch('alert', { text: response.message });
@@ -90,7 +99,7 @@ export default {
} finally {
this.isLoading = false;
}
- }
- }
+ },
+ },
};
</script>
diff --git a/src/site/plugins/axios.js b/src/site/plugins/axios.js
index 2f4a169..378f922 100644
--- a/src/site/plugins/axios.js
+++ b/src/site/plugins/axios.js
@@ -1,25 +1,25 @@
-export default function({ $axios, store }) {
+export default function ({ $axios, store }) {
$axios.setHeader('accept', 'application/vnd.lolisafe.json');
- $axios.onRequest(config => {
+ $axios.onRequest((config) => {
if (store.state.auth.token) {
- config.headers.common['Authorization'] = `bearer ${store.state.auth.token}`;
+ config.headers.common.Authorization = `bearer ${store.state.auth.token}`;
}
});
- $axios.onError(error => {
+ $axios.onError((error) => {
if (process.env.NODE_ENV !== 'production') console.error('[AXIOS Error]', error);
if (process.browser) {
if (process.env.NODE_ENV !== 'production') {
if (error.response?.data?.message) {
store.dispatch('alert/set', {
text: error.response.data.message,
- error: true
+ error: true,
});
} else {
store.dispatch('alert/set', {
text: `[AXIOS]: ${error.message}`,
- error: true
+ error: true,
});
}
}
diff --git a/src/site/plugins/flexsearch.js b/src/site/plugins/flexsearch.js
index 595b180..8640232 100644
--- a/src/site/plugins/flexsearch.js
+++ b/src/site/plugins/flexsearch.js
@@ -1,16 +1,17 @@
import Vue from 'vue';
import FlexSearch from 'flexsearch';
+
const search = new FlexSearch('speed');
// https://github.com/nextapps-de/flexsearch
Vue.prototype.$search = {
- items: async items => {
+ items: async (items) => {
await search.clear();
await search.add(items);
},
do: async (term, field) => {
const results = await search.search(term, { field });
return results;
- }
+ },
};
diff --git a/src/site/plugins/nuxt-client-init.js b/src/site/plugins/nuxt-client-init.js
index 4b10dcd..01f33ff 100644
--- a/src/site/plugins/nuxt-client-init.js
+++ b/src/site/plugins/nuxt-client-init.js
@@ -1,3 +1,3 @@
-export default async ctx => {
+export default async (ctx) => {
await ctx.store.dispatch('nuxtClientInit', ctx);
};
diff --git a/src/site/plugins/vue-isyourpasswordsafe.js b/src/site/plugins/vue-isyourpasswordsafe.js
index 6172ca0..68f313a 100644
--- a/src/site/plugins/vue-isyourpasswordsafe.js
+++ b/src/site/plugins/vue-isyourpasswordsafe.js
@@ -3,5 +3,5 @@ import VueIsYourPasswordSafe from 'vue-isyourpasswordsafe';
Vue.use(VueIsYourPasswordSafe, {
minLength: 6,
- maxLength: 64
+ maxLength: 64,
});
diff --git a/src/site/plugins/vue-timeago.js b/src/site/plugins/vue-timeago.js
index 28f3c6d..81e6e75 100644
--- a/src/site/plugins/vue-timeago.js
+++ b/src/site/plugins/vue-timeago.js
@@ -4,5 +4,5 @@ import VueTimeago from 'vue-timeago';
Vue.use(VueTimeago, {
name: 'timeago',
locale: 'en-US',
- locales: { 'en-US': require('vue-timeago/locales/en-US.json') }
+ locales: { 'en-US': require('vue-timeago/locales/en-US.json') },
});
diff --git a/src/site/store/auth.js b/src/site/store/auth.js
index 286d321..fcc051b 100644
--- a/src/site/store/auth.js
+++ b/src/site/store/auth.js
@@ -49,6 +49,8 @@ export const actions = {
} catch (e) {
dispatch('alert/set', { text: e.message, error: true }, { root: true });
}
+
+ return null;
},
async requestAPIKey({ commit, dispatch }) {
try {
@@ -59,6 +61,8 @@ export const actions = {
} catch (e) {
dispatch('alert/set', { text: e.message, error: true }, { root: true });
}
+
+ return null;
},
logout({ commit }) {
commit('logout');