-
Notifications
You must be signed in to change notification settings - Fork 15
allow synnax console to run in the browser #1232
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
base: rc
Are you sure you want to change the base?
allow synnax console to run in the browser #1232
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome PR! I got it to work fine on my mac with one extra line as well (our fault for doing type assertions a long time ago, lol). I have a couple requests, as well as the comments on the PR, before we can merge:
- The code needs to be formatted and linted to our standards (which is why it is failing CI). If you have pnpm installed, you should be able to call
pnpm fix:drift
andpnpm fix:console
to fix linting issues (and callpnpm lint
if they still exist), and format files by callingpnpm prettier -w drift/src
andpnpm prettier -w console/src
. - Optional request and is not needed to merge since most of the app's functionality is already here, but we do have some other uses of tauri - for example, opening the file explorer (see
console/src/import/import.ts
for use cases. If you are up to it, it would be great to replace those Tauri calls with the equivalent browser APIs.
We can work on embedding it into the server later - right now the console can still be run from source code in a browser without Tauri, which is a step in the right direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having this code be in drift/src/tauri/index.ts
, you should make a new file that is drift/src/noop.ts
that implements Runtime<S, A>
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console/src/tauriShim.ts
Outdated
/** | ||
* An object that looks like `Window` from `@tauri-apps/api/window`. | ||
*/ | ||
export interface WindowLike { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just define this as Pick<Window, "label" | ... | "theme">
instead? Seems cleaner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drift/src/tauri/index.ts
Outdated
async setDecorations(value: boolean): Promise<void> { }; | ||
async setTitle(title: string): Promise<void> { }; | ||
async configure(): Promise<void> { | ||
// throw new Error("Method not implemented."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should remove the commented out code and TODOs here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21e6f0b oops 🫣
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i tried it out and fixed import/export for the browser: 064dc77
i implemented it by creating ephemeral <a>
/<input>
elements because Mozilla seems ideologically opposed to the File System Access API (which provides window.showSaveFilePicker
/window.showOpenFilePicker
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
console/src/tauriShim.ts
Outdated
/** | ||
* An object that looks like `Window` from `@tauri-apps/api/window`. | ||
*/ | ||
export interface WindowLike { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drift/src/tauri/index.ts
Outdated
async setDecorations(value: boolean): Promise<void> { }; | ||
async setTitle(title: string): Promise<void> { }; | ||
async configure(): Promise<void> { | ||
// throw new Error("Method not implemented."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
21e6f0b oops 🫣
Issue Pull Request
Key Information
Description
I'm trying to run the Synnax Console on Linux. Unfortunately, the Tauri backend for linux (
libwebkit2gtk
) does not supportwebgl2
insideOffscreenCanvas
, which breaks the renderer. The easiest workaround for me is to run the console inside Chrome. To achieve this, this PR adds web-compatible stubs for the few tauri-dependent bits of the console (kv store and drift runtime).Basic Readiness
Backwards Compatibility
Data Structures
I have ensured that previous versions of stored data structures are properly migrated to new formats in the following projects:
API Changes
The following projects have backwards-compatible APIs:
Breaking Changes