Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sltt-app): add proxy server for local team storage #54

Open
wants to merge 150 commits into
base: main
Choose a base branch
from

Conversation

ericpyle
Copy link
Collaborator

@ericpyle ericpyle commented Mar 7, 2025

What issue(s) is this trying to resolve?

How does it all work?

  • add await to readJsonCatchMissing calls to avoid Unexpected end of JSON input errors race-conditions
  • replace storage/index.ts ipcMain handlers with express storage/server.ts app
  • enforce localhost requests for most hostFolder and connection api requests
  • all other requests must include a x-sltt-app-storage-server-id header which must match the host's serverId, otherwise the server will respond with 403 Forbidden.
  • provide hostFolder api to enable allowHosting and to establish a directory for hosting
    • automatically ensure that hostFolder ends with sltt-app/lan and provides diskUsage and error feedback
  • setup a udp client and regularly broadcast host state to peers, and allow peers to respond to each host with their own PeerInfo
  • host should prune peers that have not inherited the latest hostUpdatedAt
  • regularly prune obsolete hosts, if my own peer information in those hosts was updatedAt beyond expiration threshold
  • probeConnections api uses the serverState.hosts in order to provide connection info for those hosts.
    • for now, disable samba support (but keep most of its code)
    • updateWifiConnections() is called to provide wifi networkName information
    • username information is now used to set serverState.myUsername which is used to communicate which user is associated with each host computer
    • instead of urls, the connectionInfo in the response includes serverId for each host.
    • The serverId is required for subsequent CONNECTIONS_API_CONNECT args which is used to establish serverState.proxyServerId and proxyUrl
    • proxyServerId is used to provide hosts with isClient feedback to help determine how many computers are clients of the host server
    • if disk usage falls below MIN_DISK_SPACE_MB, then accessible will be false for that connection.

What particularly has changed?

  • move storage server from js to ts compilation
  • refactor to pass configFilePath into startStorageServer
  • update StoreBlobArgs to take blob (for multer multiUpload api)
  • revise connections api
    • add startUdp route
    • add username to probeConnections, remove urls
    • add connectionInfo to probeConnections response
  • change storeVcr api
    • add batchMaxTime?: number, batchMaxSize?: number arguments to allow client greater control of batch process
  • fix typescript errors
  • enforce localhost requests for the following routes:
    • HOST_FOLDER_API_LOAD_HOST_FOLDER
    • HOST_FOLDER_API_SAVE_HOST_FOLDER
    • HOST_FOLDER_API_CAN_WRITE_TO_FOLDER
    • HOST_FOLDER_API_GET_ALLOW_HOSTING
    • HOST_FOLDER_API_SET_ALLOW_HOSTING
    • CONNECTIONS_API_START_UDP
    • CONNECTIONS_API_PROBE
    • CONNECTIONS_API_CONNECT
  • remove storage rollupOption from electron.vite.config.ts in favor of adding "storage/*" to tsconfig.node.json
  • add axios, body-parser, diskusage, multer, and node-wifi packages

Steps for testing
1.

ticket: #49
commit-convention: https://www.conventionalcommits.org/en/v1.0.0/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant