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

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