Skip to content

Commit

Permalink
Web lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maple3142 committed Nov 12, 2020
1 parent 049c64f commit 386e266
Show file tree
Hide file tree
Showing 28 changed files with 113 additions and 118 deletions.
8 changes: 4 additions & 4 deletions web/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module.exports = {
root: true,
env: {
node: true
node: true,
},
extends: ['plugin:vue/essential', '@vue/prettier'],
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off'
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
},
parserOptions: {
parser: 'babel-eslint'
}
parser: 'babel-eslint',
},
}
2 changes: 1 addition & 1 deletion web/babel.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
presets: ['@vue/app']
presets: ['@vue/app'],
}
12 changes: 8 additions & 4 deletions web/dist/css/app.css

Large diffs are not rendered by default.

Binary file modified web/dist/fonts/materialdesignicons-webfont.eot
Binary file not shown.
Binary file modified web/dist/fonts/materialdesignicons-webfont.ttf
Binary file not shown.
Binary file modified web/dist/fonts/materialdesignicons-webfont.woff
Binary file not shown.
Binary file modified web/dist/fonts/materialdesignicons-webfont.woff2
Binary file not shown.
4 changes: 2 additions & 2 deletions web/dist/index.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><title>GDIndex</title><link href=/css/app.css rel=preload as=style><link href=/js/app.js rel=preload as=script><link href=/css/app.css rel=stylesheet></head><body><script>window.props = {
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>GDIndex</title><link href="/css/app.css" rel="preload" as="style"><link href="/js/app.js" rel="preload" as="script"><link href="/css/app.css" rel="stylesheet"></head><body><script>window.props = {
title: 'GDIndex',
defaultRootId: 'root',
api:
'https://gdindex.maple3142.workers.dev/' ||
location.protocol + '//' + location.host,
upload: true
}</script><div id=app></div><script src=/js/app.js></script></body></html>
}</script><div id="app"></div><script src="/js/app.js"></script></body></html>
28 changes: 11 additions & 17 deletions web/dist/js/app.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion web/dist/js/app.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions web/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
autoprefixer: {},
},
}
18 changes: 9 additions & 9 deletions web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,28 @@ import LoginDialog from './components/LoginDialog.vue'
export default {
props: {
title: String
title: String,
},
data() {
return {
drives: [],
value: {},
showAuthInput: false
showAuthInput: false,
}
},
computed: {
currentDrive() {
const id = this.$route.query.rootId || window.props.default_root_id
return this.drives.find(d => d.value === id)
}
return this.drives.find((d) => d.value === id)
},
},
async created() {
const ok =
new URL(window.props.api).hostname === location.hostname ||
(await api
.get(window.props.api)
.then(() => true)
.catch(err => {
.catch((err) => {
if (err.response.status === 401) {
this.showAuthInput = true
return false
Expand All @@ -86,9 +86,9 @@ export default {
const { drives } = await api.get('/~_~_gdindex/drives').json()
this.drives = [{ text: this.$t('mainDrive'), value: 'root' }].concat(
drives.map(d => ({
drives.map((d) => ({
value: d.id,
text: d.name
text: d.name,
}))
)
},
Expand All @@ -104,8 +104,8 @@ export default {
return // vue-router forbid going to same location
}
this.$router.push({ path: '/', query: { rootId } })
}
},
},
components: { LoginDialog }
components: { LoginDialog },
}
</script>
2 changes: 1 addition & 1 deletion web/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ if (localStorage.token) {
}
export default xf.extend({
baseURI: window.props.api,
headers
headers,
})
4 changes: 2 additions & 2 deletions web/src/components/EpubViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default {
if (localStorage.token) {
win.XMLHttpRequest.prototype._send =
win.XMLHttpRequest.prototype.send
win.XMLHttpRequest.prototype.send = function(...args) {
win.XMLHttpRequest.prototype.send = function (...args) {
this.setRequestHeader(
'Authorization',
'Basic ' + localStorage.token
Expand All @@ -32,7 +32,7 @@ export default {
win.history.pushState = () => {}
iframe.focus()
}
}
},
}
</script>
<style scoped>
Expand Down
16 changes: 8 additions & 8 deletions web/src/components/FileUploadDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</v-dialog>
</template>
<script>
const isUrl = u => {
const isUrl = (u) => {
try {
new URL(u)
return true
Expand All @@ -85,7 +85,7 @@ const isUrl = u => {
export default {
props: {
value: Boolean,
uploadUrl: String
uploadUrl: String,
},
data() {
return {
Expand All @@ -96,7 +96,7 @@ export default {
uploadFromUrl: false,
showError: false,
uploading: false,
progress: 0
progress: 0,
}
},
computed: {
Expand All @@ -105,7 +105,7 @@ export default {
return this.$t('uploading')
}
return this.$t('serverProcessing')
}
},
},
watch: {
innerShow(v) {
Expand All @@ -125,7 +125,7 @@ export default {
},
uploadFromUrl() {
this.updateFileName()
}
},
},
methods: {
updateFileName() {
Expand All @@ -144,7 +144,7 @@ export default {
return
}
const xhr = new XMLHttpRequest()
xhr.upload.onprogress = e => {
xhr.upload.onprogress = (e) => {
if (!e.lengthComputable) return
this.progress = Math.round((e.loaded / e.total) * 100)
}
Expand Down Expand Up @@ -172,8 +172,8 @@ export default {
}
xhr.send(body)
this.uploading = true
}
}
},
},
}
</script>
<style>
Expand Down
43 changes: 20 additions & 23 deletions web/src/components/FileViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ const SUPPORTED_TYPES = {
'image/jpeg': 'image',
'image/gif': 'image',
'image/bmp': 'image',
'application/pdf': 'pdf'
'application/pdf': 'pdf',
}
const ICON_NAME = {
'application/vnd.google-apps.folder': 'mdi-folder',
Expand Down Expand Up @@ -127,7 +127,7 @@ const ICON_NAME = {
'application/vnd.google-apps.document': 'mdi-file-document-box',
'application/vnd.google-apps.spreadsheet': 'mdi-google-spreadsheet',
'application/vnd.google-apps.presentation': 'mdi-file-presentation-box',
'text/plain': 'mdi-file-document'
'text/plain': 'mdi-file-document',
}
export default {
data() {
Expand All @@ -138,24 +138,24 @@ export default {
{
text: this.$t('fileName'),
value: 'fileName',
class: ['fileName']
class: ['fileName'],
},
{
text: this.$t('modifiedTime'),
value: 'modifiedTime',
filterable: false,
class: 'hidden-sm-and-down'
class: 'hidden-sm-and-down',
},
{
text: this.$t('fileSize'),
value: 'fileSize',
filterable: false,
class: 'hidden-sm-and-down'
}
class: 'hidden-sm-and-down',
},
],
renderStart: null,
uploadEnabled: window.props.upload,
showUploadDialog: false
showUploadDialog: false,
}
},
computed: {
Expand All @@ -171,7 +171,7 @@ export default {
for (let i = 0; i < list.length; i++) {
ar.push({
name: list[i],
path: '/' + nodePath.join(...list.slice(0, i + 1)) + '/'
path: '/' + nodePath.join(...list.slice(0, i + 1)) + '/',
})
}
return ar
Expand All @@ -183,12 +183,12 @@ export default {
this.$route.query.rootId || window.props.default_root_id
)
return u.href
}
},
},
methods: {
goPath(path, opener) {
const query = {
rootId: this.$route.query.rootId
rootId: this.$route.query.rootId,
}
if (opener) {
query.opener = opener
Expand All @@ -199,17 +199,14 @@ export default {
.map(decodeURIComponent)
.map(encodeURIComponent)
.join('/'),
query
query,
})
},
getFileUrl(path) {
const { rootId } = this.$route.query
let u = nodeUrl.resolve(
window.props.api,
path
.split('/')
.map(encodeURIComponent)
.join('/')
path.split('/').map(encodeURIComponent).join('/')
)
if (rootId) {
u += '?rootId=' + rootId
Expand All @@ -227,15 +224,15 @@ export default {
.post(path, {
method: 'POST',
qs: {
rootId
}
rootId,
},
})
.json()
if (renderStart !== this.renderStart) {
// User had initiated other folder navigation request
return
}
this.list = files.map(f => {
this.list = files.map((f) => {
f.mimeType = f.mimeType.replace('; charset=utf-8', '')
const isFolder =
f.mimeType === 'application/vnd.google-apps.folder'
Expand All @@ -253,7 +250,7 @@ export default {
mimeType: f.mimeType,
fileSize: f.size ? prettyBytes(parseInt(f.size)) : '',
resourcePath,
icon: ICON_NAME[f.mimeType] || 'mdi-file'
icon: ICON_NAME[f.mimeType] || 'mdi-file',
}
if (f.mimeType in SUPPORTED_TYPES) {
o.opener = SUPPORTED_TYPES[f.mimeType]
Expand Down Expand Up @@ -294,7 +291,7 @@ export default {
}
this.$router.push({
path: '/~viewer/' + query.opener,
query: { urlBase64: btoa(u) }
query: { urlBase64: btoa(u) },
})
} else {
location.href = u
Expand All @@ -304,7 +301,7 @@ export default {
uploadComplete() {
this.showUploadDialog = false
this.renderPath(this.path, this.$route.query.rootId)
}
},
},
created() {
this.handlePath(this.path, this.$route.query)
Expand All @@ -320,8 +317,8 @@ export default {
}
},
components: {
FileUploadDialog
}
FileUploadDialog,
},
}
</script>
<style scoped>
Expand Down
16 changes: 8 additions & 8 deletions web/src/components/LoginDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
export default {
props: {
cond: Boolean
cond: Boolean,
},
data() {
return {
user: '',
pass: '',
wrong: false
wrong: false,
}
},
methods: {
Expand All @@ -56,20 +56,20 @@ export default {
const tok = btoa(user + ':' + pass)
fetch(window.props.api, {
headers: {
Authorization: 'Basic ' + tok
Authorization: 'Basic ' + tok,
},
credentials: 'omit'
credentials: 'omit',
})
.then(r => {
.then((r) => {
if (r.status === 200) {
localStorage.token = tok
// eslint-disable-next-line
location.href = location.href
}
this.wrong = true
})
.catch(err => console.log(err))
}
}
.catch((err) => console.log(err))
},
},
}
</script>
4 changes: 2 additions & 2 deletions web/src/components/PdfViewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ export default {
computed: {
url() {
return atob(this.$route.query.urlBase64)
}
}
},
},
}
</script>
<style scoped>
Expand Down
Loading

0 comments on commit 386e266

Please sign in to comment.