mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 08:22:24 +01:00
chore (refactoring): code refactoring
This commit is contained in:
parent
952e882f66
commit
97b8e16bd8
6 changed files with 26 additions and 15 deletions
|
|
@ -180,6 +180,7 @@
|
|||
"pgm": "image/x-portable-greymap",
|
||||
"pkg": "application/x-newton-compatible-pkg",
|
||||
"pl": "application/x-perl",
|
||||
"plantuml": "text/x-plantuml",
|
||||
"pm": "application/x-perl",
|
||||
"pmv": "image/x-pmv",
|
||||
"png": "image/png",
|
||||
|
|
@ -199,6 +200,7 @@
|
|||
"properties": "text/x-ini",
|
||||
"ps": "application/postscript",
|
||||
"psd": "image/vnd.adobe.photoshop",
|
||||
"puml": "text/x-plantuml",
|
||||
"ra": "audio/x-realaudio",
|
||||
"raf": "image/x-fuji-raf",
|
||||
"ram": "audio/x-pn-realaudio",
|
||||
|
|
|
|||
|
|
@ -11,8 +11,7 @@ WORKDIR /home/filestash/
|
|||
COPY --from=builder_prepare /home/filestash .
|
||||
RUN apk add make git gzip brotli && \
|
||||
npm install --legacy-peer-deps && \
|
||||
make build_frontend && \
|
||||
cd public && make compress
|
||||
make build_frontend
|
||||
|
||||
# STEP3: BUILD BACKEND
|
||||
FROM golang:1.23-bookworm AS builder_backend
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ import ctrlToolbar from "./application_3d/toolbar.js";
|
|||
class I3DLoader {
|
||||
load() { throw new Error("NOT_IMPLEMENTED"); }
|
||||
transform() { throw new Error("NOT_IMPLEMENTED"); }
|
||||
background() { return 0xf2f2f4; }
|
||||
is2D() { return false; }
|
||||
}
|
||||
|
||||
|
|
@ -57,7 +58,16 @@ export default async function(render, { mime, acl$, getDownloadUrl = nop, getFil
|
|||
(err) => observer.error(err),
|
||||
)).pipe(
|
||||
removeLoader,
|
||||
rxjs.mergeMap((mesh) => create3DScene({ mime, mesh, is2D: loader.is2D, $draw, $toolbar, $menubar, hasCube })),
|
||||
rxjs.mergeMap((mesh) => create3DScene({
|
||||
mime,
|
||||
mesh,
|
||||
is2D: loader.is2D,
|
||||
background: loader.background(),
|
||||
$draw,
|
||||
$toolbar,
|
||||
$menubar,
|
||||
hasCube,
|
||||
})),
|
||||
)),
|
||||
rxjs.catchError((err) => {
|
||||
let _err = err;
|
||||
|
|
@ -72,7 +82,7 @@ export default async function(render, { mime, acl$, getDownloadUrl = nop, getFil
|
|||
));
|
||||
}
|
||||
|
||||
function create3DScene({ mesh, $draw, $toolbar, $menubar, hasCube, is2D }) {
|
||||
function create3DScene({ mesh, $draw, $toolbar, $menubar, hasCube, is2D, background }) {
|
||||
const refresh = [];
|
||||
const { renderer, camera, scene, controls, box } = setup3D({
|
||||
THREE,
|
||||
|
|
@ -81,6 +91,7 @@ function create3DScene({ mesh, $draw, $toolbar, $menubar, hasCube, is2D }) {
|
|||
refresh,
|
||||
$menubar,
|
||||
is2D,
|
||||
background,
|
||||
});
|
||||
|
||||
withLight({ scene, box, camera });
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { createElement, onDestroy } from "../../../lib/skeleton/index.js";
|
||||
import { OrbitControls } from "../../../lib/vendor/three/OrbitControls.js";
|
||||
|
||||
export default function({ THREE, $page, $menubar, mesh, refresh, is2D }) {
|
||||
export default function({ THREE, $page, $menubar, mesh, refresh, is2D, background }) {
|
||||
// setup the dom
|
||||
const renderer = new THREE.WebGLRenderer({ antialias: true, shadowMapEnabled: true });
|
||||
renderer.shadowMap.enabled = true;
|
||||
|
|
@ -19,7 +19,7 @@ export default function({ THREE, $page, $menubar, mesh, refresh, is2D }) {
|
|||
|
||||
// setup the scene, camera and controls
|
||||
const scene = new THREE.Scene();
|
||||
scene.background = new THREE.Color(0xf2f2f4);
|
||||
scene.background = new THREE.Color(background);
|
||||
const camera = new THREE.PerspectiveCamera(
|
||||
45,
|
||||
$page.clientWidth / $page.clientHeight,
|
||||
|
|
|
|||
|
|
@ -493,12 +493,9 @@ func preload() string {
|
|||
},
|
||||
{
|
||||
"/assets/" + BUILD_REF + "/pages/ctrl_connectpage.js",
|
||||
"/assets/" + BUILD_REF + "/pages/ctrl_connectpage.css",
|
||||
"/assets/" + BUILD_REF + "/pages/connectpage/ctrl_form.js",
|
||||
"/assets/" + BUILD_REF + "/pages/connectpage/ctrl_forkme.js",
|
||||
"/assets/" + BUILD_REF + "/pages/connectpage/ctrl_poweredby.js",
|
||||
"/assets/" + BUILD_REF + "/pages/connectpage/ctrl_form.css",
|
||||
|
||||
"/assets/" + BUILD_REF + "/lib/path.js",
|
||||
"/assets/" + BUILD_REF + "/lib/form.js",
|
||||
"/assets/" + BUILD_REF + "/lib/settings.js",
|
||||
|
|
@ -511,20 +508,20 @@ func preload() string {
|
|||
"/assets/" + BUILD_REF + "/lib/random.js",
|
||||
"/assets/" + BUILD_REF + "/components/icon.js",
|
||||
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_filesystem.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/thing.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_filesystem.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/thing.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/state_newthing.js",
|
||||
"/assets/" + BUILD_REF + "/pages/ctrl_connectpage.css",
|
||||
"/assets/" + BUILD_REF + "/pages/connectpage/ctrl_form.css",
|
||||
},
|
||||
{
|
||||
"/assets/" + BUILD_REF + "/pages/ctrl_filespage.js",
|
||||
"/assets/" + BUILD_REF + "/pages/ctrl_filespage.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_filesystem.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_submenu.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_newitem.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_upload.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/cache.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/state_config.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/thing.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/state_newthing.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/helper.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/model_files.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/model_virtual_layer.js",
|
||||
|
|
@ -535,6 +532,8 @@ func preload() string {
|
|||
"/assets/" + BUILD_REF + "/pages/filespage/state_selection.js",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/model_acl.js",
|
||||
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_filesystem.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/thing.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/modal.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/ctrl_submenu.css",
|
||||
"/assets/" + BUILD_REF + "/pages/filespage/modal_share.css",
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ func Build(r *mux.Router, a App) {
|
|||
r.HandleFunc(WithBase("/api/config"), NewMiddlewareChain(PublicConfigHandler, append(middlewares, PublicCORS), a)).Methods("GET", "OPTIONS")
|
||||
middlewares = []Middleware{StaticHeaders, SecureHeaders, PublicCORS, PluginInjector}
|
||||
r.PathPrefix(WithBase("/assets/bundle")).Handler(http.HandlerFunc(NewMiddlewareChain(ServeBundle, middlewares, a))).Methods("GET", "OPTIONS")
|
||||
r.HandleFunc(WithBase("/assets/"+BUILD_REF+"/plugin/{name}.zip/{path:.+}"), NewMiddlewareChain(PluginStaticHandler, middlewares, a)).Methods("GET", "OPTIONS")
|
||||
r.HandleFunc(WithBase("/assets/"+BUILD_REF+"/plugin/{name}.zip/{path:.+}"), NewMiddlewareChain(PluginStaticHandler, middlewares, a)).Methods("GET", "OPTIONS", "HEAD")
|
||||
r.HandleFunc(WithBase("/assets/"+BUILD_REF+"/plugin/{name}.zip"), NewMiddlewareChain(PluginDownloadHandler, middlewares, a)).Methods("GET")
|
||||
r.PathPrefix(WithBase("/assets/"+BUILD_REF)).Handler(http.HandlerFunc(NewMiddlewareChain(ServeFile("/"), middlewares, a))).Methods("GET", "OPTIONS")
|
||||
r.PathPrefix(WithBase("/assets/")).Handler(http.HandlerFunc(NewMiddlewareChain(ServeFile("/"), middlewares, a))).Methods("GET", "OPTIONS")
|
||||
|
|
|
|||
Loading…
Reference in a new issue