Skip to content

Commit

Permalink
release (migration): migration of admin interface
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-kerjean committed Oct 7, 2023
1 parent 8a4bb24 commit d9202c7
Show file tree
Hide file tree
Showing 91 changed files with 3,560 additions and 700 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ package-lock.json
.tern-project.js
*_test.go
cover.*
www
www
*.test.js
__snapshots__
.gitignore
filestash-enterprise
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ build_frontend:
NODE_ENV=production npm run build

build_backend:
CGO_ENABLED=0 go build -ldflags="-extldflags=-static" -mod=vendor --tags "fts5" -o dist/filestash main.go
CGO_ENABLED=0 go build -ldflags="-extldflags=-static" -mod=vendor --tags "fts5" -o dist/filestash cmd/main.go

clean_frontend:
rm -rf server/ctrl/static/www/
1 change: 0 additions & 1 deletion client/pages/adminpage/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ function AuditComponent() {
});
return () => ctrl.abort();
}, [debouncedSearchParams]);

return (
<div className="component_audit">
{
Expand Down
7 changes: 2 additions & 5 deletions main.go → cmd/main.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
package main

import (
_ "embed"
"os"
"sync"

"github.com/gorilla/mux"

"github.com/mickael-kerjean/filestash"
. "github.com/mickael-kerjean/filestash/server"
. "github.com/mickael-kerjean/filestash/server/common"
. "github.com/mickael-kerjean/filestash/server/ctrl"
_ "github.com/mickael-kerjean/filestash/server/plugin"
)

//go:embed server/plugin/index.go
var EmbedPluginList []byte

func main() {
start(Build(App{}))
}
Expand All @@ -39,7 +36,7 @@ func start(routes *mux.Router) {
}()
}
go func() {
InitPluginList(EmbedPluginList)
InitPluginList(embed.EmbedPluginList)
for _, fn := range Hooks.Get.Onload() {
go fn()
}
Expand Down
24 changes: 24 additions & 0 deletions embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package embed

import (
"embed"
"io/fs"
"net/http"
"os"
)

var (
//go:embed public
wwwPublic embed.FS
WWWPublic http.FileSystem = http.FS(os.DirFS("./public/"))
)

//go:embed server/plugin/index.go
var EmbedPluginList []byte

func init() {
if os.Getenv("DEBUG") != "true" {
fsPublic, _ := fs.Sub(wwwPublic, "public")
WWWPublic = http.FS(fsPublic)
}
}
26 changes: 26 additions & 0 deletions public/assets/css/designsystem_alert.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.alert {
background: var(--bg-color);
border-radius: 5px;
padding: 20px;
margin-top: 20px;
margin-bottom: 20px;
border: 1px solid rgba(0,0,0,0.05);
}
.alert ol, .alert ul {
margin: 5px 0;
padding: 0 20px;
}
.alert.success{
background: var(--success);
}
.alert.error{
background: var(--error);
color: var(--bg-color);
}
.alert img{
max-width: 100%;
border-radius: 5px;
border: 10px solid white;
box-sizing: border-box;
margin-top: 5px;
}
4 changes: 0 additions & 4 deletions public/assets/css/designsystem_formbuilder.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@
font-size: 1em;
padding: 0 15px;
}
.formbuilder img {
max-height: 110px;
border: 8px solid rgba(0, 0, 0, 0);
}
.formbuilder .fileupload-image img {
height: 150px;
width: 100%;
Expand Down
1 change: 1 addition & 0 deletions public/assets/css/designsystem_skeleton.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.component_skeleton {
width: 100%;
height: 30px;
background: linear-gradient(110deg, rgba(0,0,0,0.02) 8%, rgba(0,0,0,0.04) 18%, rgba(0,0,0,0.02) 33%);
border-radius: 5px;
Expand Down
17 changes: 9 additions & 8 deletions public/assets/css/reset.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,41 @@
@import url("./designsystem_darkmode.css");
@import url("./designsystem_skeleton.css");
@import url("./designsystem_utils.css");
@import url("./designsystem_alert.css");

/* latin-ext */
@font-face {
font-family: 'Source Code Pro';
font-family: "Source Code Pro";
font-style: normal;
font-weight: 400;
src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(/assets/fonts/SourceCodePro-Regular-400-latin-ext.woff2) format('woff2');
src: local("Source Code Pro"), local("SourceCodePro-Regular"), url(/assets/fonts/SourceCodePro-Regular-400-latin-ext.woff2) format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Source Code Pro';
font-family: "Source Code Pro";
font-style: normal;
font-weight: 400;
src: local('Source Code Pro'), local('SourceCodePro-Regular'), url(/assets/fonts/SourceCodePro-Regular-400-latin.woff2) format('woff2');
src: local("Source Code Pro"), local("SourceCodePro-Regular"), url(/assets/fonts/SourceCodePro-Regular-400-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* latin-ext */
@font-face {
font-family: 'Source Code Pro';
font-family: "Source Code Pro";
font-style: normal;
font-weight: 600;
src: local('Source Code Pro Semibold'), local('SourceCodePro-Semibold'), url(/assets/fonts/SourceCodePro-Semibold-600-latin-ext.woff2) format('woff2');
src: local("Source Code Pro Semibold"), local("SourceCodePro-Semibold"), url(/assets/fonts/SourceCodePro-Semibold-600-latin-ext.woff2) format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* latin */
@font-face {
font-family: 'Source Code Pro';
font-family: "Source Code Pro";
font-style: normal;
font-weight: 600;
src: local('Source Code Pro Semibold'), local('SourceCodePro-Semibold'), url(/assets/fonts/SourceCodePro-Semibold-600-latin.woff2) format('woff2');
src: local("Source Code Pro Semibold"), local("SourceCodePro-Semibold"), url(/assets/fonts/SourceCodePro-Semibold-600-latin.woff2) format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

Expand Down
Binary file added public/assets/logo/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/favicon.ico
Binary file not shown.
Binary file added public/assets/logo/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/logo/og-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions public/assets/logo/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 6 additions & 1 deletion public/boot/ctrl_boot_backoffice.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import rxjs, { ajax } from "../lib/rx.js";
import { loadScript } from "../helpers/loader.js";
import { loadScript, init as initCSS } from "../helpers/loader.js";
import { report } from "../helpers/log.js";
import { $error } from "./common.js";

Expand All @@ -9,6 +9,7 @@ export default async function main() {
setup_device(),
setup_blue_death_screen(),
setup_history(),
setup_css(),
]);
window.dispatchEvent(new window.Event("pagechange"));
} catch (err) {
Expand Down Expand Up @@ -42,3 +43,7 @@ async function setup_blue_death_screen() {
async function setup_history() {
window.history.replaceState({}, "");
}

async function setup_css() {
return initCSS()
}
File renamed without changes.
13 changes: 13 additions & 0 deletions public/boot/router_backoffice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const routes = {
"/admin/backend": "/pages/adminpage/ctrl_backend.js",
"/admin/settings": "/pages/adminpage/ctrl_settings.js",
"/admin/logs": "/pages/adminpage/ctrl_log.js",
"/admin/about": "/pages/adminpage/ctrl_about.js",
"/admin/setup": "/pages/adminpage/ctrl_setup.js",
"/admin/": "/pages/ctrl_adminpage.js",
"/admin": "/pages/ctrl_adminpage.js",
"/logout": "/pages/ctrl_logout.js",
"": "/pages/ctrl_notfound.js",
};

export default routes;
21 changes: 21 additions & 0 deletions public/boot/router_frontoffice.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const routes = {
"/login": "/pages/ctrl_connectpage.js",
"/logout": "/pages/ctrl_logout.js",

"/": "/pages/ctrl_homepage.js",
"/files/.*": "/pages/ctrl_filespage.js",
"/view/.*": "/pages/ctrl_viewerpage.js",
// /tags/.* -> "pages/ctrl_tags.js",
// /s/.* -> "/pages/ctrl_share.js",

"/admin/backend": "/pages/adminpage/ctrl_backend.js",
"/admin/settings": "/pages/adminpage/ctrl_settings.js",
"/admin/logs": "/pages/adminpage/ctrl_logger.js",
"/admin/about": "/pages/adminpage/ctrl_about.js",
"/admin/setup": "/pages/adminpage/ctrl_setup.js",
"/admin/": "/pages/ctrl_adminpage.js",

"": "/pages/ctrl_notfound.js",
};

export default routes;
Loading

0 comments on commit d9202c7

Please sign in to comment.