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.
OneAuth/oaer/lib/components/fsdom.ts

51 lines
1.2 KiB
TypeScript

3 weeks ago
/*
* 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 () => {
3 weeks ago
let fsdir = logic.token.oa.access?.Find('fs')?.tid || '/'
3 weeks ago
return v({
3 weeks ago
class: 'voa-fs voa-item',
3 weeks ago
children: [
3 weeks ago
v('voa-fs-header voa-item-header',
3 weeks ago
[
v({
class: 'voa-item-title',
children: ['我的文件'],
onclick: () => {
// logic.goto('/')
3 weeks ago
}
}),
3 weeks ago
v('vflex-grow'),
3 weeks ago
v({
class: 'voa-fs-subtxt', children: '获取密钥', onclick: () => {
api.token.Post({
refresh: logic.token.refresh.raw(),
typ: 'ufs'
3 weeks ago
}).then(e => {
console.log(e)
3 weeks ago
navigator.clipboard.writeText(e).then(() => {
alert('文本已复制到剪贴板!');
}).catch(err => {
console.error('无法复制文本:', err);
});
3 weeks ago
})
}
})
]
),
3 weeks ago
v('voa-fs-body voa-item-body', fstree(fsdir))
3 weeks ago
]
})
}