Skip to content

Commit

Permalink
Merge branch 'mickael-kerjean:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zyAmo authored Jul 26, 2024
2 parents 1e69f2c + 2347d16 commit a2d73fa
Show file tree
Hide file tree
Showing 213 changed files with 3,274 additions and 2,537 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ build_init:
go generate -x ./server/...

build_frontend:
make build_frontend_old
cd public && make compress

build_frontend_old:
NODE_ENV=production npm run build
mkdir -p ./server/ctrl/static/www/canary/
cp -R ./public/assets ./server/ctrl/static/www/canary/
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,6 @@ Some outside the box example of this "filesystem as a framework" ideas we've don

# Credits
- [Contributors](https://github.com/mickael-kerjean/filestash/graphs/contributors) and folks developing [awesome libraries](https://github.com/mickael-kerjean/filestash/blob/master/go.mod)
- This project is tested with BrowserStack
- Logo derived from the work of [ssnjrthegr8](https://github.com/ssnjrthegr8), Iconography from [flaticon](https://www.flaticon.com/), [fontawesome](https://fontawesome.com) and [material](https://material.io/icons/)
- [libvips](https://github.com/libvips/libvips) and [libraw](https://github.com/LibRaw/LibRaw). Those libraries are statically compiled in Filestash. Instructions to build Filestash is available [here](https://github.com/mickael-kerjean/filestash/blob/master/.drone.yml) and instructions to create your own static library for libvips and libraw is to be found [here](https://github.com/mickael-kerjean/filestash/tree/master/server/plugin/plg_image_light/deps)
120 changes: 59 additions & 61 deletions client/locales/zh_tw.json
Original file line number Diff line number Diff line change
@@ -1,110 +1,108 @@
{
"A_FILE_NAMED_{{VALUE}}_WAS_CREATED": "已建立名為{{VALUE}}的文件",
"A_FOLDER_NAMED_{{VALUE}}_WAS_CREATED": "已建立名為{{VALUE}}的文件夾",
"A_FILE_NAMED_{{VALUE}}_WAS_CREATED": "已建立名為 {{VALUE}} 的檔案",
"A_FOLDER_NAMED_{{VALUE}}_WAS_CREATED": "已建立名為 {{VALUE}} 的資料夾",
"ABORTED": "已中止",
"ABORT_CURRENT_UPLOADS?": "中止目前上傳?",
"ACTIVITY": "活動",
"ADVANCED": "高級",
"ALL_DONE": "已全部完成",
"ADVANCED": "進階",
"ALL_DONE": "全部完成",
"ALREADY_EXIST": "已經存在",
"BEAUTIFUL_URL": "beautiful_url",
"BEAUTIFUL_URL": "美觀的 URL",
"CAMERA": "相機",
"CAN_RESHARE": "可以轉發",
"CAN_RESHARE": "可再次分享",
"CANCEL": "取消",
"CANNOT_ESTABLISH_A_CONNECTION": "無法建立連線",
"CANT_LOAD_THIS_PICTURE": "無法載入這張圖片",
"CANT_USE_FILESYSTEM": "無法使用文件系統",
"CODE": "",
"CANT_USE_FILESYSTEM": "無法使用檔案系統",
"CODE": "代碼",
"CONFIGURE": "設定",
"CONFIRM_BY_TYPING": "輸入確認",
"CONNECT": "連接",
"COPIED_TO_CLIPBOARD": "複製到剪貼板",
"TRAFFIC_CONGESTION_TRY_AGAIN_LATER": "忙碌中,請稍後再試",
"CONFIRM_BY_TYPING": "輸入以確認",
"CONNECT": "連線",
"COPIED_TO_CLIPBOARD": "已複製到剪貼簿",
"TRAFFIC_CONGESTION_TRY_AGAIN_LATER": "網路壅塞,請稍後再試",
"CREATE_A_NEW_LINK": "建立一個新連結",
"CURRENT": "目前",
"CURRENT_UPLOAD": "目前上傳",
"CUSTOM_LINK_URL": "自定義連結網址",
"CUSTOM_LINK_URL": "自訂連結網址",
"DASHBOARD": "儀表板",
"DATE": "日期",
"DISPLAY_HIDDEN_FILES": "顯示隱藏文件",
"DO_YOU_WANT_TO_SAVE_THE_CHANGES": "您要保存更改嗎",
"DOESNT_MATCH": "不匹配",
"DONE": "做完了",
"DISPLAY_HIDDEN_FILES": "顯示隱藏檔案",
"DO_YOU_WANT_TO_SAVE_THE_CHANGES": "您要儲存變更嗎",
"DOESNT_MATCH": "不符合",
"DONE": "完成",
"DOWNLOAD": "下載",
"DROP_HERE_TO_UPLOAD": "將檔案拖拉到這裡上傳",
"DROP_HERE_TO_UPLOAD": "將檔案拖曳到此處上傳",
"EDITOR": "編輯",
"EXISTING_LINKS": "現有連結",
"EXPIRATION": "過期",
"EXPORT_AS_{{VALUE}}": "導出為{{VALUE}}",
"HIDE_HIDDEN_FILES": "不顯示隱藏文件",
"EXPIRATION": "到期",
"EXPORT_AS_{{VALUE}}": "匯出為 {{VALUE}}",
"HIDE_HIDDEN_FILES": "不顯示隱藏檔案",
"EMPTY": "空的",
"ENDPOINT": "終點",
"ENDPOINT": "端點",
"ENCRYPTION_KEY": "加密金鑰",
"ERROR": "錯誤",
"FREQUENTLY_ACCESS_FOLDERS_WILL_BE_SHOWN_HERE": "經常訪問的文件夾將顯示在這裡",
"HOST_KEY": "主機密鑰",
"HOSTNAME*": "主機名",
"FREQUENTLY_ACCESS_FOLDERS_WILL_BE_SHOWN_HERE": "經常存取的資料夾將顯示在這裡",
"HOST_KEY": "主機金鑰",
"HOSTNAME*": "主機名稱",
"INCORRECT_PASSWORD": "密碼錯誤",
"INFO": "資訊",
"INTERNAL_ERROR": "內部錯誤",
"INTERNAL_ERROR_CANT_CREATE_A_{{VALUE}}": "內部錯誤:無法建立{{VALUE}}",
"INTERNAL_ERROR_CANT_CREATE_A_{{VALUE}}": "內部錯誤:無法建立 {{VALUE}}",
"INVALID_PASSWORD": "無效的密碼",
"INVALID_ACCOUNT": "無效賬戶",
"INVALID_ACCOUNT": "無效帳戶",
"LOCATION": "位置",
"MISSING_DEPENDENCY": "位置",
"NAVIGATE": "導航",
"NEW_FILE": "新文件",
"NEW_FILE::SHORT": "新文件",
"NEW_FOLDER": "新目錄",
"NEW_FOLDER::SHORT": "新目錄",
"NO": "沒有",
"MISSING_DEPENDENCY": "缺少相依性",
"NAVIGATE": "導覽",
"NEW_FILE": "新增檔案",
"NEW_FILE::SHORT": "新增檔案",
"NEW_FOLDER": "新資料夾",
"NEW_FOLDER::SHORT": "新資料夾",
"NO": "",
"NOT_ALLOWED": "不允許",
"NOT_AUTHORISED": "未經授權",
"NOT_FOUND": "未找到",
"NOT_IMPLEMENTED": "未實現",
"NOT_IMPLEMENTED": "未實作",
"NOT_SUPPORTED": "不支援",
"NOT_VALID": "無效",
"NUMBER_OF_CONNECTIONS": "連接數",
"OK": "",
"NUMBER_OF_CONNECTIONS": "連線數",
"OK": "確定",
"OOPS": "哎呀",
"ONLY_FOR_USERS": "僅針對用戶",
"PASSPHRASE": "密碼",
"ONLY_FOR_USERS": "僅供使用者",
"PASSPHRASE": "密碼短語",
"PATH": "路徑",
"PERMISSION_DENIED": "沒有權限",
"PERMISSION_DENIED": "權限不足",
"PROPERTIES": "屬性",
"PORT": "連接埠",
"PASSWORD": "密碼",
"PASSWORD_CANT_BE_EMPTY": "密碼不能為空",
"PICK_A_MASTER_PASSWORD": "選擇一個主密碼",
"POWERED_BY": "POWERED_BY",
"PROTECT_ACCESS_WITH_A_PASSWORD": "用密碼保護訪問",
"POWERED_BY": "Powered by",
"PROTECT_ACCESS_WITH_A_PASSWORD": "用密碼保護存取",
"REGION": "區域",
"REMEMBER_ME": "記住帳號",
"REMEMBER_ME": "記住我",
"REMOVE": "移除",
"RESTRICTIONS": "限制條件",
"RUNNING": "跑步",
"SAVE_CURRENT_FILE": "保存目前文件",
"SEARCH": "搜索",
"SETTINGS": "參數",
"SORT_BY_TYPE": "按類型排序",
"SORT_BY_DATE": "按日期排序",
"SORT_BY_NAME": "按名稱分類",
"RESTRICTIONS": "限制",
"RUNNING": "運作中",
"SAVE_CURRENT_FILE": "儲存目前檔案",
"SEARCH": "搜尋",
"SETTINGS": "設定",
"SORT_BY_TYPE": "依類型排序",
"SORT_BY_DATE": "依日期排序",
"SORT_BY_NAME": "依名稱排序",
"SUPPORT": "支援",
"THERE_IS_NOTHING_HERE": "這裡什麽都沒有",
"THERE_IS_NOTHING_HERE": "這裡什麼都沒有",
"THE_LINK_WAS_COPIED_IN_THE_CLIPBOARD": "連結已複製到剪貼簿",
"THE_LINK_WONT_BE_VALID_AFTER": "連結在之後將無效",
"THE_FILE_{{VALUE}}_WAS_RENAMED": "文件{{VALUE}}已重命名",
"THE_FILE_{{VALUE}}_WAS_DELETED": "文件{{VALUE}}已刪除",
"THE_LINK_WONT_BE_VALID_AFTER": "連結在此後將失效",
"THE_FILE_{{VALUE}}_WAS_RENAMED": "檔案 {{VALUE}} 已重新命名",
"THE_FILE_{{VALUE}}_WAS_DELETED": "檔案 {{VALUE}} 已刪除",
"TIMEOUT": "逾時",
"TODO": "TODO",
"TODO": "待辦事項",
"UPLOADER": "上傳者",
"USERNAME": "使用者名稱",
"VIEWER": "觀看者",
"WAITING": "等候",
"VIEWER": "檢視者",
"WAITING": "等待中",
"YES": "",
"YOU_CANT_DO_THAT": "你不能那樣做",
"YOU_CANT_DO_THAT": "您不能這麼做",
"YOUR_EMAIL_ADDRESS": "您的電子郵件地址",
"YOUR_MASTER_PASSWORD": "您的主密碼"
}


1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59 // indirect
github.com/beevik/etree v1.4.0 // indirect
github.com/bluekeyes/go-gitdiff v0.7.3 // indirect
github.com/calebcase/tmpfile v1.0.3 // indirect
github.com/crewjam/httperr v0.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/beevik/etree v1.4.0 h1:oz1UedHRepuY3p4N5OjE0nK1WLCqtzHf25bxplKOHLs=
github.com/beevik/etree v1.4.0/go.mod h1:cyWiXwGoasx60gHvtnEh5x8+uIjUVnjWqBvEnhnqKDA=
github.com/bluekeyes/go-gitdiff v0.7.3 h1:SElKwtm/IQPOwKs0vdowW5uAlip+P+jatagmUU8E0r4=
github.com/bluekeyes/go-gitdiff v0.7.3/go.mod h1:QpfYYO1E0fTVHVZAZKiRjtSGY9823iCdvGXBcEzHGbM=
github.com/calebcase/tmpfile v1.0.3 h1:BZrOWZ79gJqQ3XbAQlihYZf/YCV0H4KPIdM5K5oMpJo=
github.com/calebcase/tmpfile v1.0.3/go.mod h1:UAUc01aHeC+pudPagY/lWvt2qS9ZO5Zzof6/tIUzqeI=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
4 changes: 3 additions & 1 deletion public/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ compress:
find . -type f -name '*.html' | xargs brotli -f -k
find . -type f -name '*.html' | xargs gzip -f -k
find . -type f -name '*.js' | xargs brotli -f -k
find . -type f -name '*.js' | xargs gzip -f -k --best
find . -type f -name '*.js' | xargs gzip -f -k
find . -type f -name '*.css' | xargs brotli -f -k
find . -type f -name '*.css' | xargs gzip -f -k
find . -type f -name '*.svg' | xargs brotli -f -k
find . -type f -name '*.svg' | xargs gzip -f -k

clean:
find . -name '*.gz' -exec rm {} \;
Expand Down
6 changes: 0 additions & 6 deletions public/assets/boot/ctrl_boot_backoffice.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { init as initCSS } from "../helpers/loader.js";
import { report } from "../helpers/log.js";
import { $error } from "./common.js";

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

async function setup_css() {
return initCSS();
}
74 changes: 41 additions & 33 deletions public/assets/boot/ctrl_boot_frontoffice.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
import rxjs, { ajax } from "../lib/rx.js";
// import { setup_cache } from "../helpers/cache.js";
import { init as setup_loader, loadJS } from "../helpers/loader.js";
import { toHref } from "../lib/skeleton/router.js";
import { loadJS } from "../helpers/loader.js";
import { init as setup_translation } from "../locales/index.js";
import { init as setup_config } from "../model/config.js";
import { init as setup_chromecast } from "../model/chromecast.js";
import { report } from "../helpers/log.js";

export default async function main() {
try {
let config = {};
// await Config.refresh()

await Promise.all([ // procedure with no outside dependencies
setup_config(),
setup_translation(),
setup_xdg_open(),
// setup_cache(), // TODO: dependency on session
setup_device(),
// setup_sw(), // TODO
setup_blue_death_screen(),
setup_loader(),
setup_history(),
setup_polyfill(),
]);

await Promise.all([ // procedure with dependency on config
// setup_chromecast() // TODO
setup_base(config),
setup_chromecast(),
setup_title(),
]);

window.dispatchEvent(new window.Event("pagechange"));
Expand Down Expand Up @@ -56,7 +54,7 @@ function $error(msg) {
/// /////////////////////////////////////////
async function setup_xdg_open() {
window.overrides = {};
return loadJS(import.meta.url, "/overrides/xdg-open.js");
return loadJS(import.meta.url, toHref("/overrides/xdg-open.js"));
}

async function setup_device() {
Expand All @@ -71,34 +69,34 @@ async function setup_device() {
});
}

async function setup_base(config) {
// TODO: base as config in admin
const $meta = document.createElement("base");
$meta.setAttribute("href", location.origin);
document.head.appendChild($meta);
}

// async function setup_sw() {
// if (!("serviceWorker" in window.navigator)) return;
async function setup_sw() { // eslint-disable-line no-unused-vars
if (!("serviceWorker" in window.navigator)) return;

// if (window.navigator.userAgent.indexOf("Mozilla/") !== -1 &&
// window.navigator.userAgent.indexOf("Firefox/") !== -1 &&
// window.navigator.userAgent.indexOf("Gecko/") !== -1) {
// // Firefox was acting weird with service worker so we disabled it
// // see: https://github.com/mickael-kerjean/filestash/issues/255
// return;
// }
// try {
// await window.navigator.serviceWorker.register("/sw_cache.js");
// } catch (err) {
// report("ServiceWorker registration failed", err);
// }
// }
if (window.navigator.userAgent.indexOf("Mozilla/") !== -1 &&
window.navigator.userAgent.indexOf("Firefox/") !== -1 &&
window.navigator.userAgent.indexOf("Gecko/") !== -1) {
// Firefox was acting weird with service worker so we disabled it
// see: https://github.com/mickael-kerjean/filestash/issues/255
return;
}
try {
await window.navigator.serviceWorker.register("/sw_cache.js");
} catch (err) {
report("ServiceWorker registration failed", err);
}
}

async function setup_blue_death_screen() {
window.onerror = function(msg, url, lineNo, colNo, error) {
report(msg, error, url, lineNo, colNo);
$error(msg);
if ("serviceWorker" in navigator) navigator.serviceWorker
.getRegistrations()
.then((registrations) => {
for (const registration of registrations) {
registration.unregister();
}
});
};
}

Expand All @@ -116,3 +114,13 @@ async function setup_blue_death_screen() {
async function setup_history() {
window.history.replaceState({}, "");
}

async function setup_title() {
document.title = window.CONFIG.name || "Filestash";
}

async function setup_polyfill() {
if (!("replaceChildren" in document.body)) {
await loadJS(import.meta.url, "../lib/polyfill.js");
}
}
2 changes: 1 addition & 1 deletion public/assets/boot/router_frontoffice.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const routes = {
"/files/.*": "/pages/ctrl_filespage.js",
"/view/.*": "/pages/ctrl_viewerpage.js",
// /tags/.* -> "pages/ctrl_tags.js",
// /s/.* -> "/pages/ctrl_share.js",
"/s/.*": "/pages/ctrl_sharepage.js",

"": "/pages/ctrl_notfound.js",
};
Expand Down
Loading

0 comments on commit a2d73fa

Please sign in to comment.