diff options
| author | Zephyrrus <[email protected]> | 2020-07-08 04:00:12 +0300 |
|---|---|---|
| committer | Zephyrrus <[email protected]> | 2020-07-08 04:00:12 +0300 |
| commit | ad852de51a0d2dd5d29c08838d5a430c58849e74 (patch) | |
| tree | a4ab9a720f66271c9eba10916061a9b06c43656e /src/site/pages | |
| parent | refactor: refactor grid to use vuex for every action (diff) | |
| download | host.fuwn.me-ad852de51a0d2dd5d29c08838d5a430c58849e74.tar.xz host.fuwn.me-ad852de51a0d2dd5d29c08838d5a430c58849e74.zip | |
chore: linter the entire project using the new rules
Diffstat (limited to 'src/site/pages')
| -rw-r--r-- | src/site/pages/dashboard/admin/file/_id.vue | 82 | ||||
| -rw-r--r-- | src/site/pages/dashboard/admin/settings.vue | 85 | ||||
| -rw-r--r-- | src/site/pages/dashboard/tags/index.vue | 43 | ||||
| -rw-r--r-- | src/site/pages/faq.vue | 23 | ||||
| -rw-r--r-- | src/site/pages/index.vue | 1 | ||||
| -rw-r--r-- | src/site/pages/register.vue | 37 |
6 files changed, 174 insertions, 97 deletions
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 -> 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> |