Remove the need to provide a bucket ID to each API call
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { createEventDispatcher, onMount } from 'svelte'
|
||||
import { fs_file_url } from "../FilesystemUtil.js";
|
||||
import { fs_path_url } from '../FilesystemUtil';
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
export let state
|
||||
@@ -53,7 +53,7 @@ onMount(() => {
|
||||
<audio
|
||||
bind:this={player}
|
||||
class="player"
|
||||
src={fs_file_url(state.root.id, state.base.path)}
|
||||
src={fs_path_url(state.base.path)}
|
||||
autoplay="autoplay"
|
||||
controls="controls"
|
||||
on:pause={() => playing = false }
|
||||
|
@@ -9,7 +9,7 @@ export let state
|
||||
|
||||
<h1>{state.base.name}</h1>
|
||||
|
||||
<IconBlock icon_href={fs_thumbnail_url(state.root.id, state.base.path, 256, 256)}>
|
||||
<IconBlock icon_href={fs_thumbnail_url(state.base.path, 256, 256)}>
|
||||
Type: {state.base.file_type}<br/>
|
||||
No preview is available for this file type. Download to view it locally.
|
||||
<br/>
|
||||
|
@@ -18,9 +18,15 @@ export let edit_window
|
||||
export let state
|
||||
let viewer
|
||||
let viewer_type = ""
|
||||
let last_path = ""
|
||||
|
||||
$: state_update(state.base)
|
||||
const state_update = async (base) => {
|
||||
if (base.path === last_path) {
|
||||
return
|
||||
}
|
||||
last_path = base.path
|
||||
|
||||
// Update the viewer area with the right viewer type
|
||||
viewer_type = fs_node_type(base)
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
<script>
|
||||
import { fs_file_url } from "../FilesystemUtil.js";
|
||||
import { fs_path_url } from "../FilesystemUtil";
|
||||
|
||||
|
||||
export let state
|
||||
let container
|
||||
@@ -50,7 +51,7 @@ const mouseup = (e) => {
|
||||
on:doubletap={() => {zoom = !zoom}}
|
||||
on:mousedown={mousedown}
|
||||
class="image" class:zoom
|
||||
src={fs_file_url(state.root.id, state.base.path)}
|
||||
src={fs_path_url(state.base.path)}
|
||||
alt="no description available" />
|
||||
</div>
|
||||
|
||||
|
@@ -1,11 +1,12 @@
|
||||
<script>
|
||||
import { fs_file_url } from "../FilesystemUtil.js";
|
||||
import { fs_path_url } from "../FilesystemUtil";
|
||||
|
||||
export let state
|
||||
</script>
|
||||
|
||||
<iframe
|
||||
class="container"
|
||||
src={"/res/misc/pdf-viewer/web/viewer.html?file="+encodeURIComponent(fs_file_url(state.root.id, state.base.path))}
|
||||
src={"/res/misc/pdf-viewer/web/viewer.html?file="+encodeURIComponent(fs_path_url(state.base.path))}
|
||||
title="PDF viewer">
|
||||
</iframe>
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<script>
|
||||
import { fs_file_url } from "../FilesystemUtil";
|
||||
import { fs_path_url } from "../FilesystemUtil";
|
||||
|
||||
export let state
|
||||
let text_pre
|
||||
@@ -14,7 +14,7 @@ export const set_file = file => {
|
||||
return
|
||||
}
|
||||
|
||||
fetch(fs_file_url(state.root.id, file.path)).then(resp => {
|
||||
fetch(fs_path_url(file.path)).then(resp => {
|
||||
if (!resp.ok) { return Promise.reject(resp.status) }
|
||||
return resp.text()
|
||||
}).then(resp => {
|
||||
|
@@ -6,7 +6,7 @@ import { copy_text } from "../../util/Util.svelte";
|
||||
import TorrentItem from "./TorrentItem.svelte"
|
||||
import IconBlock from "../../file_viewer/viewers/IconBlock.svelte";
|
||||
import TextBlock from "../../file_viewer/viewers/TextBlock.svelte";
|
||||
import { fs_file_url, fs_node_icon } from "../FilesystemUtil";
|
||||
import { fs_node_icon, fs_path_url } from "../FilesystemUtil";
|
||||
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
@@ -18,7 +18,7 @@ export const update = async () => {
|
||||
dispatch("loading", true)
|
||||
|
||||
try {
|
||||
let resp = await fetch(fs_file_url(state.root.id, state.base.path)+"?torrent_info")
|
||||
let resp = await fetch(fs_path_url(state.base.path)+"?torrent_info")
|
||||
|
||||
if (resp.status >= 400) {
|
||||
let json = await resp.json()
|
||||
@@ -75,7 +75,7 @@ const copy_magnet = () => {
|
||||
|
||||
<h1>{state.base.name}</h1>
|
||||
|
||||
<IconBlock icon_href={fs_node_icon(state.root.id, state.base, 256, 256)}>
|
||||
<IconBlock icon_href={fs_node_icon(state.base, 256, 256)}>
|
||||
{#if status === "finished"}
|
||||
Created by: {torrent.created_by}<br/>
|
||||
Comment: {torrent.comment}<br/>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<script>
|
||||
import { onMount, createEventDispatcher, tick } from "svelte";
|
||||
import { fs_file_url } from "../FilesystemUtil";
|
||||
import { fs_path_url } from "../FilesystemUtil";
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
export let state
|
||||
@@ -100,7 +100,7 @@ const fullscreen = () => {
|
||||
on:play={() => playing = true }
|
||||
on:ended={() => dispatch("next", {})}
|
||||
>
|
||||
<source src={fs_file_url(state.root.id, state.base.path)} type={state.base.file_type} />
|
||||
<source src={fs_path_url(state.base.path)} type={state.base.file_type} />
|
||||
</video>
|
||||
{/if}
|
||||
</div>
|
||||
|
@@ -4,7 +4,7 @@ import { formatDataVolume, formatDate } from "../../util/Formatting.svelte"
|
||||
import ZipItem from "./ZipItem.svelte";
|
||||
import IconBlock from "../../file_viewer/viewers/IconBlock.svelte";
|
||||
import TextBlock from "../../file_viewer/viewers/TextBlock.svelte";
|
||||
import { fs_file_url, fs_node_icon } from "../FilesystemUtil";
|
||||
import { fs_node_icon, fs_path_url } from "../FilesystemUtil";
|
||||
|
||||
let dispatch = createEventDispatcher()
|
||||
|
||||
@@ -23,7 +23,7 @@ export const update = async () => {
|
||||
dispatch("loading", true)
|
||||
|
||||
try {
|
||||
let resp = await fetch(fs_file_url(state.root.id, state.base.path)+"?zip_info")
|
||||
let resp = await fetch(fs_path_url(state.base.path)+"?zip_info")
|
||||
|
||||
if (resp.status >= 400) {
|
||||
status = "parse_failed"
|
||||
@@ -61,7 +61,7 @@ const recursive_size = (file) => {
|
||||
|
||||
<h1>{state.base.name}</h1>
|
||||
|
||||
<IconBlock icon_href={fs_node_icon(state.root.id, state.base, 256, 256)}>
|
||||
<IconBlock icon_href={fs_node_icon(state.base, 256, 256)}>
|
||||
Compressed size: {formatDataVolume(state.base.file_size, 3)}<br/>
|
||||
Uncompressed size: {formatDataVolume(uncomp_size, 3)} (Ratio: {comp_ratio.toFixed(2)}x)<br/>
|
||||
Uploaded on: {formatDate(state.base.created, true, true, true)}
|
||||
|
Reference in New Issue
Block a user