Nothing Special   »   [go: up one dir, main page]

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

Launching as a web app? #278

Open
mcintyre321 opened this issue Oct 22, 2024 · 2 comments
Open

Launching as a web app? #278

mcintyre321 opened this issue Oct 22, 2024 · 2 comments

Comments

@mcintyre321
Copy link

Are there instructions on how to launch netpad as a web app? I've tried running locally in Rider but I'm getting issues around SPA/proxy settings. However, that's not exactly what I'm trying to achieve.

I would like to host a web app where team members can execute predefined scripts (e.g. I might create a docker image with a library of scripts) and host that somewhere.

There are some AuthZ/AuthN hurdles also think about, and ideally a readonly mode for scripts, but first step would be to understand if the above is possible.

@SimonNyvall
Copy link
Contributor

Hi @mcintyre321
Yes, there are instructions on running NetPad as a SPA Application in the CONTRIBUTING.md file, under Creating a development environment.

(Assuming you’ve already cloned the repo)

Note

Make sure you have the .NET SDK 6.0 installed to run the .NET backend. Also, please note that SQLite connections currently won’t work in the web-view mode.

Steps to Run NetPad as a Web App

  1. Install Dependencies and Start the Frontend
cd NetPad\src\Apps\NetPad.Apps.App\App
npm install && npm run start-web
  1. Run the .NET Backend
cd NetPad\src\Apps\NetPad.Apps.App && dotnet run
  1. Access NetPad in the Browser Once both parts are running, go to http://localhost:57940/ in your browser.

To access NetPad I believe you need to change the Url in appsettings.Development.json to http://0.0.0.0:57940 and forward that port.

Additional Notes

  • System.Text.Json Warning: There’s a known issue with System.Text.Json. To suppress this warning temporarily, add NU1903 in the OmniSharp.NET.csproj file.

  • Troubleshooting Tauri Shell Builds: If you encounter any build issues with the Tauri shell, try checking out the commit 8bf4fd7 as a workaround.

@tareqimbasher
Copy link
Owner

Thanks @SimonNyvall. I got your PR merged as well. I also fixed the security warning with System.Text.Json and updated the package.

@mcintyre321 did you get it running alright? To answer your question, yes it is possible. The instructions Simon left above is all you need. I plan on releasing a pre-built binary to run as a web app but for now you can easily run it from source.

A readonly mode sounds like a good idea for that use case. Noteworthy is NetPad currently has a single session/state. Different users would not get their own session. This means that if you host NetPad as a web app, every browser that connects to it will have the same tabs open, the same statuses for each script (running or not), the same output in the results pane...etc. If one user clicks to switch a tab, the tab is switched on every browser.

Its definitely on the roadmap to provide multi-user sessions (including auth) and give users the ability to create profiles as well.

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

No branches or pull requests

3 participants