Giter Club home page Giter Club logo

sandbox's Introduction

Hey ๐Ÿ‘‹

I'm a 18-year-old developer, studying Software Engineering @ the University of Waterloo. I'm living in San Francisco this summer.

https://www.ishaand.com https://www.linkedin.com/in/ishaan1013 https://www.twitter.com/ishaandey_

sandbox's People

Contributors

ishaan1013 avatar jamesmurdza avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sandbox's Issues

Add KV session logic

Add KV to database worker

On start:

Client

  • Check if userId exists in KV store
    • If yes and running, alert that you can't have multiple sessions
    • If yes and not running, only alert if within 2 minutes of updatedAt
  • Store userId (key), sandboxId, serviceName, running, and updatedAt when starting server

Server

  • If running, calculate time to expiry and set a timeout
    • On timeout, emit message to frontend to disable access, and close the server

On delete:

  • Get running to false, updatedAt to now

Refactor CF workers routes

Currently the route handling in the storage & database workers looks like a big pile of if statements. Fine for quickly prototyping this, but it's not very scalable or pretty. Feel free to convert to switch statements, or use a minimal library.

Change file system source of truth

To-do before this issue: #14

The file system management right now is very awkward, since the source folder in the backend is not the source of truth (it should be).

Operations like creating a file through the UI works properly. But a touch or mkdir in the terminal will not reflect changes.

After initially getting files from Cloudflare, we need to use the local file system as the source of truth.

How does the preview work?

It's less a issue, more a question. How does your preview work? I already understand, that all files are saved in the storage from cloudflare, but how do you proceed? I the preview/index.tsx file, you create an iframe to the local url "localhost:5173" or smthg. like that, but where is the server for that port?

Debounce file saving

We currently update Cloudflare R2 on every file save.

Implementing debouncing would reduce # of queries when a user frequently saves the same file.

Collaborator modals

  • Restrict - Sandbox is private
  • Restrict - Owner not present (initial and on "ownerDisconnected" event)
  • Onboard - welcome, show what they can/can't do

Add cmd+w keybinding to close tab

There's already a cmd+s keybinding to save. Adding a cmd+w command should be easy, and the closeTab function to use already exists in editor/index.tsx

Selfhosting Guide

Is it possible for you to write a guide on how to self-host this program?
I've filled in the envs the best I could and created tables on the D2 database, but it's still not working, complaining about no such table user.

CleanShot 2024-05-31 at 19 40 56@2x

Fix terminal resizing

I added a socketio communication and resize listeners for xtermjs in the frontend + pty in the backend. Doesn't seem to work, but there's probably an easy fix here.

Current behaviour doesn't change terminal sizing when you resize the container.

Final cleanup

  • Rate limiting:

    • AI generations
    • File size
    • Total project size
    • Number of projects
    • Live collaborators
    • Terminal instances
    • Files open
    • File save frequency
  • Check localhost links

  • Refresh API keys & check for secrets

  • READMEs and contributing guide

  • Change clerk to production

  • Add CORS to CF workers

Add start button

Similar to replit's start button.

Note: there's already a start button for this in the sidebar/index.tsx file which is commented out, we should probably just uncomment this and implement the logic

  • should be configured by default to the project type (react: npm i && npm run dev)
  • should be configurable (modal to change default terminal commands)
  • the button will create a new terminal and run the configured commands

License

Hi, thanks for releasing this repo! I see many components are licensed under ISC but some do not have a license specified. Is there any chance you could add a license file to the base repo to clarify licensing?
Thanks!!

Terminal processes are left hanging

When the page is closed, refreshed, or changed, any processes in the terminal will keep running.

To reproduce:

  • Open a project
  • Run npm start
  • Close the project
  • Run ps -a | grep npm on the system

Working live collaboration

  • Update live Y Doc based on file
  • Avoid overriding server-side file content
  • Improve avatars & cursor colours
  • Limit non-owner permissions

Cache file content

  • Save to localstorage after getFile callback
  • Check localstorage before getting from WS in selectFile
  • Save to localstorage onchange

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.