Properly encode path links, remove unused password settings

This commit is contained in:
2023-05-30 16:59:11 +02:00
parent 0299b730a5
commit 8377ac1fab
9 changed files with 34 additions and 45 deletions

View File

@@ -32,6 +32,12 @@ const node_click = e => {
state.children[index].fm_selected = !state.children[index].fm_selected
}
}
const node_share_click = e => {
let index = e.detail
creating_dir = false
fs_navigator.navigate(state.children[index].id, true)
}
const node_settings = e => {
edit_window.edit(state.children[e.detail], false)
@@ -198,9 +204,20 @@ onMount(() => {
</div>
{#if directory_view === "list"}
<ListView state={state} show_hidden={show_hidden} on:node_click={node_click} on:node_settings={node_settings}></ListView>
<ListView
state={state}
show_hidden={show_hidden}
on:node_click={node_click}
on:node_share_click={node_share_click}
on:node_settings={node_settings}
/>
{:else if directory_view === "gallery"}
<GalleryView state={state} show_hidden={show_hidden} on:node_click={node_click} on:node_settings={node_settings}></GalleryView>
<GalleryView
state={state}
show_hidden={show_hidden}
on:node_click={node_click}
on:node_settings={node_settings}
/>
{/if}
</div>

View File

@@ -1,6 +1,6 @@
<script>
import { createEventDispatcher } from "svelte"
import { fs_node_icon, fs_node_type } from "../FilesystemUtil";
import { fs_encode_path, fs_node_icon, fs_node_type } from "../FilesystemUtil";
let dispatch = createEventDispatcher()
export let state
@@ -10,7 +10,7 @@ export let show_hidden = false
<div class="gallery">
{#each state.children as child, index (child.path)}
<a class="file"
href={state.path_root+child.path_uri}
href={"/d"+fs_encode_path(child.path)}
on:click|preventDefault={() => {dispatch("node_click", index)}}
class:selected={child.fm_selected}
class:hidden={child.name.startsWith(".") && !show_hidden}

View File

@@ -1,7 +1,7 @@
<script>
import { createEventDispatcher } from "svelte";
import { formatDataVolume } from "../../util/Formatting.svelte";
import { fs_node_icon } from "../FilesystemUtil";
import { fs_encode_path, fs_node_icon } from "../FilesystemUtil";
let dispatch = createEventDispatcher()
@@ -18,7 +18,7 @@ export let show_hidden = false
</tr>
{#each state.children as child, index (child.path)}
<a
href={state.path_root+child.path_uri}
href={"/d"+fs_encode_path(child.path)}
on:click|preventDefault={() => {dispatch("node_click", index)}}
class="node"
class:node_selected={child.fm_selected}
@@ -37,7 +37,11 @@ export let show_hidden = false
</td>
<td class="node_icons">
{#if child.id}
<a href="/d/{child.id}" on:click|stopPropagation class="button small_button">
<a
href="/d/{child.id}"
on:click|preventDefault|stopPropagation={() => {dispatch("node_share_click", index)}}
class="button small_button"
>
<i class="icon" title="This file / directory is shared. Click to open public link">share</i>
</a>
{/if}