UI: Unify URL handling, show full URL everywhere
This commit is contained in:
@@ -21,7 +21,6 @@
|
||||
|
||||
import { delete_collection } from "../api/api.js";
|
||||
import { get_auth_header } from "../api/common.js";
|
||||
import { SERVER } from "../constants.js";
|
||||
import { Collection, CollectionType } from "../models/collection.js";
|
||||
import { collectionsCache } from "../utils/collections_cache.js";
|
||||
import { ErrorHandler } from "../utils/error.js";
|
||||
@@ -30,6 +29,7 @@ import { CreateEditCollectionScene } from "./CreateEditCollectionScene.js";
|
||||
import { DeleteConfirmationScene } from "./DeleteConfirmationScene.js";
|
||||
import { IncomingSharingScene } from "./IncomingSharingScene.js";
|
||||
import { Scene, push_scene } from "./scene_manager.js";
|
||||
import { UrlTextHandler } from "../utils/url_text.js";
|
||||
import { ShareCollectionScene, maybe_enable_sharing_options } from "./ShareCollectionScene.js";
|
||||
import { UploadCollectionScene } from "./UploadCollectionScene.js";
|
||||
|
||||
@@ -225,8 +225,8 @@ export class CollectionsScene {
|
||||
}
|
||||
contentcount_form.textContent = contentcount_form_txt;
|
||||
}
|
||||
let href = SERVER + collection.href;
|
||||
url_form.value = href;
|
||||
let href = collection.href;
|
||||
new UrlTextHandler(url_form).setHref(href);
|
||||
download_btn.href = href;
|
||||
download_btn.onclick = (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
@@ -25,6 +25,7 @@ import { ErrorHandler } from "../utils/error.js";
|
||||
import { get_element, get_element_by_id } from "../utils/misc.js";
|
||||
import { displayPermissionsOrConversion } from "../utils/permissions.js";
|
||||
import { Scene, pop_scene } from "./scene_manager.js";
|
||||
import { UrlTextHandler } from "../utils/url_text.js";
|
||||
|
||||
/**
|
||||
* @implements {Scene}
|
||||
@@ -119,12 +120,7 @@ export class IncomingSharingScene {
|
||||
let enabled_cb = /** @type {HTMLInputElement} */ (get_element(node, "[data-name=enabled]"));
|
||||
let shown_cb = /** @type {HTMLInputElement} */ (get_element(node, "[data-name=shown]"));
|
||||
|
||||
let displayPath = share.PathOrToken.substring(prefix.length);
|
||||
if (displayPath.endsWith("/")) {
|
||||
displayPath = displayPath.substring(0, displayPath.length - 1);
|
||||
}
|
||||
|
||||
pathortoken.value = displayPath;
|
||||
new UrlTextHandler(pathortoken).setHref(share.PathOrToken);
|
||||
owner_td.textContent = share.Owner;
|
||||
displayPermissionsOrConversion(share.Conversion, share.Permissions, permissions_td);
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import { displayPermissionsOrConversion } from "../utils/permissions.js";
|
||||
import { CreateEditShareScene } from "./CreateEditShareScene.js";
|
||||
import { DeleteConfirmationScene } from "./DeleteConfirmationScene.js";
|
||||
import { Scene, pop_scene, push_scene } from "./scene_manager.js";
|
||||
import { UrlTextHandler } from "../utils/url_text.js";
|
||||
|
||||
/**
|
||||
* @implements {Scene}
|
||||
@@ -181,7 +182,7 @@ function add_share_row_node(user, password, collection, share, template, delete_
|
||||
|
||||
/** @type {HTMLInputElement} */ let pathortoken_form = /** @type {HTMLInputElement} */ (get_element(node, "[data-name=pathortoken]"));
|
||||
if (pathortoken_form) {
|
||||
pathortoken_form.value = pathortoken;
|
||||
new UrlTextHandler(pathortoken_form).setHref(pathortoken);
|
||||
}
|
||||
|
||||
let permissions = (share["Permissions"] || "").toLowerCase();
|
||||
|
||||
Reference in New Issue
Block a user