Skip to content
This repository was archived by the owner on Jan 9, 2025. It is now read-only.

Multiple Storages and Sharing #48

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ volumes:
| `REVOKE_URL` | URL to poke on logout | `string` | - |
| `LOGOUT_REDIRECT` | URL to redirect to after logout | `string` | - |
| `STORAGE_ENDPOINT` | Endpoint to use for the storage Sync | `string` | `https://auth.fullstacked.cloud/storages` |
| `USE_CLOUD_CONFIG` | Use the cloud config for storage Sync | `boolean` | `false` |
| `CLOUD_CONFIG` | Set a URL to save your Sync config on the cloud | `string` | -<br />(FullStacked Cloud uses `https://auth.fullstacked.cloud/config`) |
| `CONFIG_FILE` | Path to file to save storage Sync configs | `string` | `$HOME/.fullstacked-config` |
| `FORCE_PORT_USAGE` | Force the usage of direct port instead of port subdomain reverse-proxy (only useful in some docker installation edge cases) | `boolean` | `false` |

Expand Down
40 changes: 31 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@
"@fullstacked/build": "^0.10.12",
"@fullstacked/cli": "^0.10.14",
"@fullstacked/share": "^0.10.9",
"@fullstacked/sync": "^0.10.2",
"@fullstacked/sync": "^0.10.6",
"@fullstacked/watch": "^0.10.24",
"@fullstacked/webapp": "^0.10.18",
"@fullstacked/webapp": "^0.10.19-alpha.9",
"@types/adm-zip": "^0.5.5",
"@types/cookie": "^0.5.1",
"@types/http-proxy": "^1.17.11",
"@types/js-cookie": "^3.0.3",
"@types/react": "^18.2.18",
"@types/react-dom": "^18.2.7",
"@types/ws": "^8.5.5",
"adm-zip": "^0.5.10",
"codemirror": "^6.0.1",
"cookie": "^0.5.0",
"decompress": "^4.2.1",
Expand Down
41 changes: 33 additions & 8 deletions src/lite/client/apps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import React, { useState, useEffect } from "react";
import { client } from "../client"
import { SyncWS, centeredPopupFeatures } from "../../../main/client/sync/Indicator";
import { Workspace } from "../../../main/client/workspace";
import install from "../../../main/client/icons/install.svg";
import type { App } from "../../server/apps";

function AppLauncher(props: {app, didSpawn}){
function AppLauncher(props: {app: App, didSpawn: () => void}){
const [failedOpen, setFailedOpen] = useState(false);
const [url, setUrl] = useState(null);

Expand All @@ -15,14 +17,14 @@ function AppLauncher(props: {app, didSpawn}){
}

useEffect(() => {
client.post().runApp(props.app.entrypoint)
client.post().runApp(props.app.main)
.then(url => {
setUrl(url);
openApp(url);
})
}, [])

return <div className={"prepare-fs-remote"}>
return <div className={"basic-window"}>
{url
? failedOpen
? <button onClick={() => openApp(url)}>Open {props.app.title}</button>
Expand All @@ -33,20 +35,43 @@ function AppLauncher(props: {app, didSpawn}){

function loadLocalApps(){
client.get().listApps().then(apps => {
apps.forEach(app => {
Object.values(apps).flat().forEach(app => {
if(Workspace.instance.apps.find(({title}) => title === app.title))
return;

Workspace.addApp({
title: app.title,
icon: app.icon,
element: (wApp) => <AppLauncher didSpawn={Workspace.instance.removeWindow(wApp)} app={app} />
element: (wApp) => <AppLauncher didSpawn={() => Workspace.instance.removeWindow(wApp)} app={app} />
})
})
})
}

SyncWS.subscribers.add(status => {

function AddApp(){
const [url, setUrl] = useState("");

const submit = (e) => {
e.preventDefault();
client.post().addApp(url).then(loadLocalApps);
}

return <form onSubmit={submit} className="basic-window">
<input value={url} onChange={e => setUrl(e.currentTarget.value)} />
<button>Add</button>
</form>
}

Workspace.addApp({
title: "Add App",
icon: install,
element(app) {
return <AddApp />
}
});

SyncWS.subscribers.add((status) => {
if(SyncWS.isSynced(status))
loadLocalApps();
});
client.get().updateApps().then(loadLocalApps);
})
8 changes: 6 additions & 2 deletions src/lite/client/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { init } from "../../main/client/init";
import { Sync } from "../../main/client/sync";
import { client } from "./client";

init();

Sync.init(false, true);
await Sync.init(false);
if (await client.get().directory.check()){
Sync.openSetup(() => Sync.init(false));
}

[import("./apps")];
[import("./apps")];
1 change: 0 additions & 1 deletion src/lite/client/index.tsx

This file was deleted.

Loading