Enter-tainer / typst-preview

[DEPRECATED] Use tinymist instead

Home Page:https://Enter-tainer.github.io/typst-preview/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An option to enable preview via remote server

Wsine opened this issue · comments

Describe the bug

I enabled the preview on host 0.0.0.0. However, the client only reads from ws://127.0.0.1:23625/

To Reproduce

./typst-preview --host 0.0.0.0:23627 ./resume.typ

Expected behavior
The host and port logic are compatible between server and client

Package/Software version:

typst-preview extension version: v0.7.5

Logs:

typst-preview server log(Output Panel -> typst-preview):

[2023-09-15T06:49:55Z INFO  typst_preview] Arguments: CliArguments {
        font_paths: [],
        root: None,
        data_plane_host: "127.0.0.1:23625",
        control_plane_host: "127.0.0.1:23626",
        static_file_host: "0.0.0.0:23627",
        dont_open_in_browser: false,
        enable_partial_rendering: false,
        input: "./resume.typ",
    }
[2023-09-15T06:49:56Z INFO  typst_preview] Data plane server listening on: 127.0.0.1:23625
[2023-09-15T06:49:56Z INFO  typst_preview] Control plane server listening on: 127.0.0.1:23626
[2023-09-15T06:49:56Z INFO  typst_ts_compiler::service::diag] /resume.typ: compiling ...
[2023-09-15T06:49:56Z INFO  typst_preview] Static file server listening on: 0.0.0.0:23627
[2023-09-15T06:49:56Z INFO  typst_ts_compiler::service::diag] /resume.typ: Compilation succeeded in 42.533155ms
[2023-09-15T06:49:56Z DEBUG typst_preview::actor::typst] TypstActor: waiting for message

typst-preview client log(Help -> Toggle Developer Tools -> Console):

(index):4938 WebSocket Error:  Event {isTrusted: true, type: 'error', target: WebSocket, currentTarget: WebSocket, eventPhase: 2, …}
(anonymous) @ (index):4938
error (async)
setupSocket @ (index):4937
(anonymous) @ (index):4899
setTimeout (async)
(anonymous) @ (index):4899
(index):4935 WebSocket connection closed

Additional context
Add any other context about the problem here.

are you using the vscode extension or the binary itself? VSCode remote should work without extra config. (If it doesnt, it's a bug)

are you using the vscode extension or the binary itself? VSCode remote should work without extra config. (If it doesnt, it's a bug)

I am using the binary itself on the remote server over ssh, and I want to access the result in the browser.

Could you try the following command? It might be unnecessary to expose preview service to the public network interface (0.0.0.0).

./typst-preview --host 127.0.0.1:23627 ./resume.typ
ssh -CNL 127.0.0.1:23625:127.0.0.1:23625 your-host # for ws service
ssh -CNL 127.0.0.1:23627:127.0.0.1:23627 your-host # for static file server

looks like typst-preview is not ready to customize service's host to this time. It use 127.0.0.1 everywhere.

We may add even more cli args to specify the port and host the client should connect to 😇 . But that sounds strange to me.

Similar issue when using typst-preview via coda-server, my local browser tried to access ws://127.0.0.1:{port} (of course it failed) and the preview panel is blank.

i encourage anyone interested to this to fix it. i also wonder why use typst and this extension in remote: both typst and typst-preview provides builds for all common platforms.

I think it's very useful and can be used to remotely access the slide