Initial support for configuring incoming shares

This commit is contained in:
Max Berger
2026-03-12 23:24:29 +01:00
parent 33bfe29a69
commit be7d6d4a61
5 changed files with 315 additions and 3 deletions

View File

@@ -27,6 +27,7 @@ import { Collection, CollectionType } from "../models/collection.js";
import { bytesToHumanReadable } from "../utils/misc.js";
import { CreateEditCollectionScene } from "./CreateEditCollectionScene.js";
import { DeleteCollectionScene } from "./DeleteCollectionScene.js";
import { IncomingSharingScene } from "./IncomingSharingScene.js";
import { LoadingScene } from "./LoadingScene.js";
import { Scene, pop_scene, push_scene, scene_stack } from "./scene_manager.js";
import { ShareCollectionScene, maybe_enable_sharing_options } from "./ShareCollectionScene.js";
@@ -48,6 +49,7 @@ export class CollectionsScene {
/** @type {HTMLElement} */ let template = html_scene.querySelector("[data-name=collectiontemplate]");
/** @type {HTMLElement} */ let new_btn = html_scene.querySelector("[data-name=new]");
/** @type {HTMLElement} */ let upload_btn = html_scene.querySelector("[data-name=upload]");
/** @type {HTMLElement} */ let incomingshares_btn = html_scene.querySelector("[data-name=incomingshares]");
/** @type {?number} */ let scene_index = null;
/** @type {?XMLHttpRequest} */ let collections_req = null;
@@ -74,6 +76,16 @@ export class CollectionsScene {
return false;
}
function onincomingshares() {
try {
let incoming_sharing_scene = new IncomingSharingScene(user, password);
push_scene(incoming_sharing_scene, false);
} catch (err) {
console.error(err);
}
return false;
}
function onedit(collection) {
try {
let edit_collection_scene = new CreateEditCollectionScene(user, password, collection);
@@ -191,6 +203,7 @@ export class CollectionsScene {
html_scene.classList.remove("hidden");
new_btn.onclick = onnew;
upload_btn.onclick = onupload;
incomingshares_btn.onclick = onincomingshares;
if (collections === null) {
update();
discover_server_features(user, password, maybe_enable_sharing_options);
@@ -204,6 +217,7 @@ export class CollectionsScene {
scene_index = scene_stack.length - 1;
new_btn.onclick = null;
upload_btn.onclick = null;
incomingshares_btn.onclick = null;
collections = null;
// remove collection
nodes.forEach(function (node) {