mirror of
				https://github.com/mickael-kerjean/filestash.git
				synced 2025-10-31 10:07:15 +08:00 
			
		
		
		
	fix (config): regression on config change
This commit is contained in:
		| @ -23,7 +23,7 @@ export function get(key, defaultValue) { | ||||
| } | ||||
|  | ||||
| export function getVersion() { | ||||
|     return get("version", "na"); | ||||
|     return get("version", ""); | ||||
| } | ||||
|  | ||||
| export function query() { | ||||
|  | ||||
| @ -3,10 +3,11 @@ import { toHref } from "../../lib/skeleton/router.js"; | ||||
| import rxjs, { effect, onClick } from "../../lib/rx.js"; | ||||
| import { forwardURLParams } from "../../lib/path.js"; | ||||
| import { animate, slideYOut } from "../../lib/animate.js"; | ||||
| import { loadCSS } from "../../helpers/loader.js"; | ||||
| import { qs, qsa } from "../../lib/dom.js"; | ||||
| import { AjaxError } from "../../lib/error.js"; | ||||
| import assert from "../../lib/assert.js"; | ||||
| import { get as getConfig } from "../../model/config.js"; | ||||
| import { loadCSS } from "../../helpers/loader.js"; | ||||
| import { currentPath, isNativeFileUpload } from "./helper.js"; | ||||
| import { getPermission, calculatePermission } from "./model_acl.js"; | ||||
| import { mkdir, save } from "./model_virtual_layer.js"; | ||||
| @ -358,7 +359,7 @@ function workerImplFile({ progress, speed }) { | ||||
|         } | ||||
|  | ||||
|         async prepareJob({ file, path, virtual }) { | ||||
|             const chunkSize = (window.CONFIG["upload_chunk_size"] || 0) *1024*1024; | ||||
|             const chunkSize = getConfig("upload_chunk_size", 0) *1024*1024; | ||||
|             const numberOfChunks = Math.ceil(file.size / chunkSize); | ||||
|             const headersNoCache = { | ||||
|                 "Cache-Control": "no-store", | ||||
|  | ||||
| @ -1,6 +1,7 @@ | ||||
| import { createElement } from "../../lib/skeleton/index.js"; | ||||
| import { animate, opacityOut, opacityIn } from "../../lib/animate.js"; | ||||
| import assert from "../../lib/assert.js"; | ||||
| import { get as getConfig } from "../../model/config.js"; | ||||
|  | ||||
| import { extractPath, isDir, isNativeFileUpload } from "./helper.js"; | ||||
| import { files$ } from "./ctrl_filesystem.js"; | ||||
| @ -24,11 +25,12 @@ const IMAGE = { | ||||
| let TYPES = null; | ||||
| export function init() { | ||||
|     TYPES = { | ||||
|         MIME: window.CONFIG.mime, | ||||
|         MIME: getConfig("mime", {}), | ||||
|         THUMBNAILER: (function() { | ||||
|             const set = new Set(); | ||||
|             for (let i=0; i<window.CONFIG.thumbnailer.length; i++) { | ||||
|                 set.add(window.CONFIG.thumbnailer[i]); | ||||
|             const thumbnailers = getConfig("thumbnailer"); | ||||
|             for (let i=0; i<thumbnailers.length; i++) { | ||||
|                 set.add(thumbnailers[i]); | ||||
|             } | ||||
|             return set; | ||||
|         })(), | ||||
|  | ||||
| @ -2,6 +2,7 @@ import { createElement, onDestroy } from "../../lib/skeleton/index.js"; | ||||
| import rxjs, { effect } from "../../lib/rx.js"; | ||||
| import { animate, slideXIn, opacityOut } from "../../lib/animate.js"; | ||||
| import { qs } from "../../lib/dom.js"; | ||||
| import { get as getConfig } from "../../model/config.js"; | ||||
| import { createLoader } from "../../components/loader.js"; | ||||
| import { createModal, MODAL_RIGHT_BUTTON } from "../../components/modal.js"; | ||||
| import { loadCSS, loadJS } from "../../helpers/loader.js"; | ||||
| @ -65,7 +66,7 @@ export default async function(render, { acl$, getFilename, getDownloadUrl }) { | ||||
|                 }), | ||||
|             ); | ||||
|             return rxjs.of(content).pipe( | ||||
|                 rxjs.mergeMap((content) => rxjs.of(window.CONFIG).pipe( | ||||
|                 rxjs.mergeMap((content) => rxjs.of(getConfig()).pipe( | ||||
|                     rxjs.mergeMap((config) => rxjs.from(loadKeybinding(config.editor)).pipe(rxjs.mapTo(config))), | ||||
|                     rxjs.map((config) => [content, config]), | ||||
|                     rxjs.mergeMap((arr) => rxjs.from(loadMode(extname(getFilename()))).pipe( | ||||
|  | ||||
| @ -3,13 +3,14 @@ import { toHref } from "../../lib/skeleton/router.js"; | ||||
| import rxjs, { effect, onLoad, onClick } from "../../lib/rx.js"; | ||||
| import { animate } from "../../lib/animate.js"; | ||||
| import { extname } from "../../lib/path.js"; | ||||
| import { loadCSS } from "../../helpers/loader.js"; | ||||
| import { qs } from "../../lib/dom.js"; | ||||
| import { get as getConfig } from "../../model/config.js"; | ||||
| import { Chromecast } from "../../model/chromecast.js"; | ||||
| import { loadCSS } from "../../helpers/loader.js"; | ||||
| import { createLoader } from "../../components/loader.js"; | ||||
| import notification from "../../components/notification.js"; | ||||
| import t from "../../locales/index.js"; | ||||
| import ctrlError from "../ctrl_error.js"; | ||||
| import { Chromecast } from "../../model/chromecast.js"; | ||||
|  | ||||
| import { transition } from "./common.js"; | ||||
|  | ||||
| @ -129,7 +130,7 @@ function buttonChromecast(filename, downloadURL) { | ||||
|         const link = Chromecast.createLink("/" + toHref(downloadURL)); | ||||
|         const media = new window.chrome.cast.media.MediaInfo( | ||||
|             link, | ||||
|             window.CONFIG.mime[extname(filename)], | ||||
|             getConfig("mime", {})[extname(filename)], | ||||
|         ); | ||||
|         media.metadata = new window.chrome.cast.media.PhotoMediaMetadata(); | ||||
|         media.metadata.title = filename; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 MickaelK
					MickaelK