feat: integrate client and server sharing workflows
This commit is contained in:
1 parent
42b93ae2d8
commit
7406e2fe37
101 files changed
+3153
-253
No files matched your search
@@ -39,8 +39,9 @@ export function createMockShareApi(): ShareApi {
|
||||
mine: false,
|
||||
link: `${location.origin}/s/${DEMO_SHARE_ID}#k=${DEMO_KEY}`,
|
||||
createdAt: Date.now() - 2 * 3600_000,
|
||||
expiresAt: Date.now() + 22 * 3600_000,
|
||||
ttlSeconds: 86400,
|
||||
seats: 10,
|
||||
maxVisitors: 10,
|
||||
maxDownloads: 5,
|
||||
};
|
||||
const rt: Runtime = { share, items: new Map(), blobs: new Map() };
|
||||
@@ -59,6 +60,8 @@ export function createMockShareApi(): ShareApi {
|
||||
}
|
||||
|
||||
return {
|
||||
async listSaved() { return []; },
|
||||
async forget() {},
|
||||
async createDraft(settings) {
|
||||
await wait(300);
|
||||
const id = b64url(16);
|
||||
@@ -68,6 +71,7 @@ export function createMockShareApi(): ShareApi {
|
||||
mine: true,
|
||||
link: `${location.origin}/s/${id}#k=${b64url(32)}`,
|
||||
createdAt: Date.now(),
|
||||
expiresAt: Date.now() + 86400_000,
|
||||
...settings,
|
||||
};
|
||||
runtimes.set(id, { share, items: new Map(), blobs: new Map() });
|
||||
@@ -107,8 +111,9 @@ export function createMockShareApi(): ShareApi {
|
||||
mine: false,
|
||||
link: `${location.origin}/s/${link.id}#k=${link.key}`,
|
||||
createdAt: Date.now(),
|
||||
expiresAt: Date.now() + 86400_000,
|
||||
ttlSeconds: 86400,
|
||||
seats: 10,
|
||||
maxVisitors: 10,
|
||||
maxDownloads: null,
|
||||
};
|
||||
runtimes.set(link.id, { share, items: new Map(), blobs: new Map() });
|
||||
@@ -143,6 +148,13 @@ export function createMockShareApi(): ShareApi {
|
||||
put({ id: uid(), kind: 'text', ts: Date.now(), deviceId: PHONE, state: { kind: 'complete' }, text });
|
||||
},
|
||||
|
||||
async editText(id, text) {
|
||||
const rt = draftOnly();
|
||||
const item = rt.items.get(id);
|
||||
if (!item || item.kind !== 'text') throw new Error('not_found');
|
||||
put({ ...item, text, ts: Date.now() });
|
||||
},
|
||||
|
||||
async addFiles(files) {
|
||||
const rt = draftOnly();
|
||||
for (const file of files) {
|
||||
|
||||
Reference in new issue
Block a user