|
1 | 1 | // 使用tampermonkey的备份模式 |
2 | | - |
3 | | -import { ResourceHash } from './resource'; |
4 | 2 | import { Metadata, Script as InstallScript } from './script'; |
5 | 3 | import { SubscribeScript, Subscribe as InstallSubscribe } from './subscribe'; |
6 | 4 |
|
7 | | -export interface File { |
8 | | - created_by: string |
9 | | - version: string |
10 | | - scripts: Script[]; |
11 | | - subscribes: Subscribe[]; |
12 | | - settings: Settings |
13 | | -} |
14 | | - |
15 | | -export interface Settings { |
16 | | - |
17 | | -} |
18 | | - |
19 | | -export interface Script { |
| 5 | +export interface ExportScript { |
20 | 6 | name: string |
21 | | - options: Options |
| 7 | + script: InstallScript |
22 | 8 | storage: Storage |
23 | 9 | enabled: boolean |
24 | 10 | position: number |
25 | | - uuid: string |
26 | | - file_url?: string |
27 | | - source: string |
28 | | - requires: Resource[] |
29 | | - requires_css: Resource[] |
30 | | - resources: Resource[] |
31 | | - self_metadata: Metadata |
32 | | - subscribe_url?: string |
33 | | - modified: number |
34 | | - // 导入用,需要解析source获得 |
35 | | - metadata?: Metadata |
36 | | - script?: InstallScript |
37 | | - old?: InstallScript |
38 | | - error?: string |
39 | | - background?: boolean |
| 11 | + requires: ExportResource[] |
| 12 | + requires_css: ExportResource[] |
| 13 | + resources: ExportResource[] |
40 | 14 | } |
41 | 15 |
|
42 | | -export interface Subscribe { |
43 | | - name: string |
44 | | - url: string |
| 16 | +export interface ImportScript { |
| 17 | + source: string |
45 | 18 | enabled: boolean |
| 19 | + position: number |
| 20 | + storage?: Storage |
| 21 | + requires?: ImportResource[] |
| 22 | + requires_css?: ImportResource[] |
| 23 | + resources?: ImportResource[] |
| 24 | +} |
| 25 | + |
| 26 | +export interface ImportResource { |
| 27 | + meta: { name: string, url: string, ts: number, mimetype: string } |
46 | 28 | source: string |
47 | | - scripts: { [key: string]: SubscribeScript }; |
48 | | - modified: number |
49 | | - // 导入用,解析source获得 |
50 | | - metadata?: Metadata |
51 | | - subscribe?: InstallSubscribe |
52 | | - old?: InstallSubscribe |
53 | | - error?: string |
| 29 | + base64: string |
54 | 30 | } |
55 | 31 |
|
56 | | -export interface Options { |
57 | 32 |
|
| 33 | +export interface ExportSubscribe { |
| 34 | + name: string |
| 35 | + subscribe: InstallSubscribe |
| 36 | + enabled: boolean |
| 37 | +} |
| 38 | + |
| 39 | +export interface ImportSubscribe { |
| 40 | + source: string |
| 41 | + enabled: boolean |
| 42 | + scripts: { [key: string]: SubscribeScript }; |
58 | 43 | } |
59 | 44 |
|
60 | | -export interface Resource { |
| 45 | +export interface ExportResource { |
61 | 46 | meta: { name: string, url: string, ts: number, mimetype: string } |
62 | 47 | source: string |
63 | | - base64?: string |
64 | | - hash: ResourceHash |
| 48 | + base64: string |
65 | 49 | } |
66 | 50 |
|
67 | 51 | export interface Storage { |
|
0 commit comments