You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

51 lines
1.2 KiB
TypeScript

/*
* fs.ts
* Copyright (C) 2024 veypi <i@veypi.com>
* 2024-11-04 17:11
* Distributed under terms of the GPL license.
*/
import { v } from "../v2dom";
import logic from '../logic'
import api from "../api";
import fstree from "./fstree";
export default () => {
let fsdir = logic.token.oa.access?.Find('fs')?.tid || '/'
return v({
class: 'voa-fs voa-item',
children: [
v('voa-fs-header voa-item-header',
[
v({
class: 'voa-item-title',
children: ['我的文件'],
onclick: () => {
// logic.goto('/')
}
}),
v('vflex-grow'),
v({
class: 'voa-fs-subtxt', children: '获取密钥', onclick: () => {
api.token.Post({
refresh: logic.token.refresh.raw(),
typ: 'ufs'
}).then(e => {
console.log(e)
navigator.clipboard.writeText(e).then(() => {
alert('文本已复制到剪贴板!');
}).catch(err => {
console.error('无法复制文本:', err);
});
})
}
})
]
),
v('voa-fs-body voa-item-body', fstree(fsdir))
]
})
}