Frontend linter changes.
This commit is contained in:
+1
-3
@@ -1293,9 +1293,7 @@ def _token_belongs_to_user(token, username, sso_user_id):
|
|||||||
|
|
||||||
def _is_anonymous_share_token(token: config.Token) -> bool:
|
def _is_anonymous_share_token(token: config.Token) -> bool:
|
||||||
return (
|
return (
|
||||||
sharefs.is_share_token(token)
|
sharefs.is_share_token(token) and not token.username and not token.sso_user_id
|
||||||
and not token.username
|
|
||||||
and not token.sso_user_id
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+8
-14
@@ -58,13 +58,13 @@ import Router from '@/router/index'
|
|||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import AboutModal from './components/AboutModal.vue'
|
import AboutModal from './components/AboutModal.vue'
|
||||||
import AccessDeniedModal from './components/AccessDeniedModal.vue'
|
import AccessDeniedModal from './components/AccessDeniedModal.vue'
|
||||||
import ExplorerView from './views/ExplorerView.vue'
|
|
||||||
import SelectionToolbar from './components/SelectionToolbar.vue'
|
import SelectionToolbar from './components/SelectionToolbar.vue'
|
||||||
import TextEditorView from './views/TextEditorView.vue'
|
|
||||||
import type SettingsModalVue from './components/SettingsModal.vue'
|
import type SettingsModalVue from './components/SettingsModal.vue'
|
||||||
import UserManagementModal from './components/UserManagementModal.vue'
|
import UserManagementModal from './components/UserManagementModal.vue'
|
||||||
import UserTokensModal from './components/UserTokensModal.vue'
|
import UserTokensModal from './components/UserTokensModal.vue'
|
||||||
import type { SortOrder } from './utils/docsort'
|
import type { SortOrder } from './utils/docsort'
|
||||||
|
import ExplorerView from './views/ExplorerView.vue'
|
||||||
|
import TextEditorView from './views/TextEditorView.vue'
|
||||||
|
|
||||||
interface Path {
|
interface Path {
|
||||||
path: string
|
path: string
|
||||||
@@ -78,7 +78,9 @@ interface Path {
|
|||||||
const store = useMainStore()
|
const store = useMainStore()
|
||||||
|
|
||||||
const getDocByPath = (fullPath: string) =>
|
const getDocByPath = (fullPath: string) =>
|
||||||
getDocuments().find(doc => (doc.loc ? `${doc.loc}/${doc.name}` : doc.name) === fullPath)
|
getDocuments().find(
|
||||||
|
doc => (doc.loc ? `${doc.loc}/${doc.name}` : doc.name) === fullPath
|
||||||
|
)
|
||||||
|
|
||||||
const path: ComputedRef<Path> = computed(() => {
|
const path: ComputedRef<Path> = computed(() => {
|
||||||
const p = decodeURIComponent(Router.currentRoute.value.path).split('//')
|
const p = decodeURIComponent(Router.currentRoute.value.path).split('//')
|
||||||
@@ -90,11 +92,7 @@ const path: ComputedRef<Path> = computed(() => {
|
|||||||
void store.docVersion
|
void store.docVersion
|
||||||
const doc = fullPath ? getDocByPath(fullPath) : null
|
const doc = fullPath ? getDocByPath(fullPath) : null
|
||||||
const isEditorPath = !!(doc && !doc.dir && doc.text)
|
const isEditorPath = !!(doc && !doc.dir && doc.text)
|
||||||
const canonicalBase = !fullPath
|
const canonicalBase = !fullPath ? '/' : doc?.dir ? `/${fullPath}/` : `/${fullPath}`
|
||||||
? '/'
|
|
||||||
: doc?.dir
|
|
||||||
? `/${fullPath}/`
|
|
||||||
: `/${fullPath}`
|
|
||||||
const canonicalPath = query
|
const canonicalPath = query
|
||||||
? rawPath // keep search URL shape untouched
|
? rawPath // keep search URL shape untouched
|
||||||
: canonicalBase
|
: canonicalBase
|
||||||
@@ -128,14 +126,10 @@ const routeViewComponent = computed(() =>
|
|||||||
path.value.isEditorPath ? TextEditorView : ExplorerView
|
path.value.isEditorPath ? TextEditorView : ExplorerView
|
||||||
)
|
)
|
||||||
const routeViewKey = computed(() => {
|
const routeViewKey = computed(() => {
|
||||||
return path.value.isEditorPath
|
return path.value.isEditorPath ? `editor:${path.value.path}` : 'explorer'
|
||||||
? `editor:${path.value.path}`
|
|
||||||
: 'explorer'
|
|
||||||
})
|
})
|
||||||
const routeViewProps = computed(() =>
|
const routeViewProps = computed(() =>
|
||||||
path.value.isEditorPath
|
path.value.isEditorPath ? {} : { path: path.value.pathList, query: path.value.query }
|
||||||
? {}
|
|
||||||
: { path: path.value.pathList, query: path.value.query }
|
|
||||||
)
|
)
|
||||||
watch(
|
watch(
|
||||||
() => path.value.canonicalPath,
|
() => path.value.canonicalPath,
|
||||||
|
|||||||
@@ -122,8 +122,7 @@ watchEffect(() => {
|
|||||||
if (!same) {
|
if (!same) {
|
||||||
longest.value = props.path
|
longest.value = props.path
|
||||||
longestLinks.value = currentLinks
|
longestLinks.value = currentLinks
|
||||||
}
|
} else if (props.path.length > longcut.length) {
|
||||||
else if (props.path.length > longcut.length) {
|
|
||||||
longest.value = longcut.concat(props.path.slice(longcut.length))
|
longest.value = longcut.concat(props.path.slice(longcut.length))
|
||||||
longestLinks.value.splice(0, currentLinks.length, ...currentLinks)
|
longestLinks.value.splice(0, currentLinks.length, ...currentLinks)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -104,7 +104,9 @@ const showOtherCategory = computed(() => {
|
|||||||
return !!s.disk && otherBytes.value / s.disk >= 0.01
|
return !!s.disk && otherBytes.value / s.disk >= 0.01
|
||||||
})
|
})
|
||||||
const freeSliceBytes = computed(() =>
|
const freeSliceBytes = computed(() =>
|
||||||
showOtherCategory.value ? store.space.free : Math.max(0, store.space.disk - store.space.allocated)
|
showOtherCategory.value
|
||||||
|
? store.space.free
|
||||||
|
: Math.max(0, store.space.disk - store.space.allocated)
|
||||||
)
|
)
|
||||||
|
|
||||||
// Calculate max label length based on angular gap to neighbor labels
|
// Calculate max label length based on angular gap to neighbor labels
|
||||||
@@ -295,7 +297,11 @@ const freeLabelPath = computed(() =>
|
|||||||
createArcPath(adjustedLabelAngles.value.free!, 'free', 4)
|
createArcPath(adjustedLabelAngles.value.free!, 'free', 4)
|
||||||
)
|
)
|
||||||
const otherLabelPath = computed(() =>
|
const otherLabelPath = computed(() =>
|
||||||
createArcPath(adjustedLabelAngles.value.other ?? sectorInfo.value.other.angle, 'other', 5)
|
createArcPath(
|
||||||
|
adjustedLabelAngles.value.other ?? sectorInfo.value.other.angle,
|
||||||
|
'other',
|
||||||
|
5
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleClick = () => (isExpanded.value ? collapse() : expand())
|
const handleClick = () => (isExpanded.value ? collapse() : expand())
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { apiFetch } from '@/repositories/Client'
|
||||||
|
import { useMainStore } from '@/stores/main'
|
||||||
import { indentWithTab } from '@codemirror/commands'
|
import { indentWithTab } from '@codemirror/commands'
|
||||||
import { LanguageDescription } from '@codemirror/language'
|
import { LanguageDescription } from '@codemirror/language'
|
||||||
import { languages } from '@codemirror/language-data'
|
import { languages } from '@codemirror/language-data'
|
||||||
@@ -16,8 +18,6 @@ import { Compartment, EditorState } from '@codemirror/state'
|
|||||||
import { oneDark } from '@codemirror/theme-one-dark'
|
import { oneDark } from '@codemirror/theme-one-dark'
|
||||||
import { EditorView, keymap } from '@codemirror/view'
|
import { EditorView, keymap } from '@codemirror/view'
|
||||||
import { basicSetup } from 'codemirror'
|
import { basicSetup } from 'codemirror'
|
||||||
import { apiFetch } from '@/repositories/Client'
|
|
||||||
import { useMainStore } from '@/stores/main'
|
|
||||||
import {
|
import {
|
||||||
computed,
|
computed,
|
||||||
nextTick,
|
nextTick,
|
||||||
@@ -173,8 +173,7 @@ onMounted(async () => {
|
|||||||
await initEditor(text)
|
await initEditor(text)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
error.value = err instanceof Error ? err.message : 'Failed to load file'
|
error.value = err instanceof Error ? err.message : 'Failed to load file'
|
||||||
}
|
} finally {
|
||||||
finally {
|
|
||||||
if (loading.value) loading.value = false
|
if (loading.value) loading.value = false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user