Skip to content

Latest commit

 

History

History
251 lines (162 loc) · 7.42 KB

README.md

File metadata and controls

251 lines (162 loc) · 7.42 KB

Galaxy Browser

Introduction

Galaxy Browser offers an alternative way to organize and share knowledge — think Obsidian meets Chrome on a shared three-dimensional canvas with spreadsheet-inspired powerful macros. Article

Features v2

Galaxy Browser v2 currently in development, join whitelist now.

Collaborate with AI and Execute Code

image

Render HTML pages from text

telegram-cloud-photo-size-2-5370764356796665175-y

Import GitHub Repositories, write local files and commit changes

telegram-cloud-photo-size-2-5368355593108181345-y

Scene Example v1

scene-example-v1

Try it out

After installing the Galaxy Browser desktop app, you can easily replicate the above scene:

  1. Create and select a new frame.
  2. Click "Open Macro".
  3. Paste this link: galaxy://5ERMmhn6tWtbSX6HspQcztkHbpaYKiZHfiouDBDXgSnMhxU6/oct6-second

Macros Explained

  • The "input" variable magically references one element the arrow is pointing from.
  • Any remote modules are resolved and built on the fly.
  • The "input" element's value acts as the prompt.
  • The result of the completion is displayed in the "output" element that the arrow points to.

Development Prerequisites

Node.js

Deno

  • Version: v1.36 or later
  • Install Deno
  • Check version with: deno --version

pnpm (Recommended)

  • Install with: npm install -g pnpm
  • Check version with: pnpm --version

Docker (Optional)

cargo-contract (Optional)

  • Install with: cargo install --force --locked cargo-contract
  • Check version with: cargo contract --version

Setup

These instructions will help you set up the project on your local machine for development and testing purposes.

git clone https://github.com/7flash/galaxy-polkadot.git
cd galaxy-polkadot
git checkout milestone2
git submodule update --init --recursive
pnpm install

Frontend

To run the unit tests for the project, follow these steps:

  1. Start the frontend development server:
pnpm dev-frontend
  1. In a new terminal tab, run the tests:
pnpm test-frontend

Upon executing, you should observe an output resembling:

PASS  tests/Galaxy.test.js (28.307 s)
Galaxy Macros Engine
    ✓ JS Macros (4340 ms)
    ✓ Deno macros (4270 ms)
    ✓ Python macros (5137 ms)
    ✓ Open Macro (4846 ms)
    ✓ Publish Macro (4805 ms)
    ✓ Save Macro (3877 ms)

Test Suites: 1 passed, 1 total
Tests:       6 passed, 6 total
Snapshots:   0 total
Time:        28.367 s

Backend

When focusing on the backend aspect of the project (specifically the main.ts), follow these steps:

  1. Update submodules:

Since git submodules are always pointing to specific commit, its' important to ensure you have all of them synchronized to the recent main branch, before running backend:

pnpm pull-submodules
  1. Start the backend development server:
pnpm dev-deno

If you made modifications in the frontend while working on the backend, you'll need to rebuild both together to reflect the frontend changes:

  1. Rebuild both frontend and backend together:
pnpm dev-desktop

excalidraw-assets

In production mode, backend will load recent frontend build from public repository, and then spawn a browser window.

In development mode, instead it will read frontend build locally from ./dist submodule folder.

In case, after running dev-desktop, it does not produce excalidraw-assets in ./dist folder as expected, run the following command to copy it manually from recent release:

cp ./node_modules/@galaxydo/excalidraw/dist/excalidraw-assets ./dist

Accordingly, if you made changes in excalidraw submodule, make sure to rebuild it.

cd excalidraw/src/packages/excalidraw && yarn build:umd

Then publish a new release to registry, and update dependency in package.json to your version.

webui

In production mode, deno-webui package loads static library webui from public a repository, resolving to the file corresponding to the target platform.

In development mode, local library path must be specified in main.ts

In case, the path of webui compiled library on your platform differs from default path, you must compile it manually (make sure to have cpp installed) and then update libPath parameter above.

cd desktop/webui && make

Release

To release the project, execute the following commands in sequence:

  1. Build for release:
pnpm release-first
  1. Compile for macOS:
pnpm release-second
  1. Run the build script:
pnpm release-third

Executing these commands in order ensures that the project is built, compiled, and prepared for release appropriately.

Docker (Frontend)

Docker Limitations:

Docker image only suitable for running and testing frontend app. It also allows to define and execute frontend-side JS macros, including "publish" macro which invokes wallet transaction to publish layer.

But since backend is designed to launch a default user browser installed on local machine, docker is not suitable for running backend app.

In case of testing backend-side Deno macros, such as "save" macro to save layers in persistent local database, please either follow instructions above to run full app locally, or simply install recent release build, which already includes deno engine (but does not include chromium and still depends on user default browser and its default profile with installed wallet extension)

Build Image:

docker build -t galaxy:latest .

Run Application:

docker run -d -p 8080:80 galaxy:latest

Open http://localhost:8080 in your browser.

Contract

Compile locally

Ensure the latest version:

cd contract
git pull && git checkout main

Compile source to galaxy.wasm

cargo contract build

Rococo Deployment

The Galaxy Contract has been deployed on the Rococo testnet.

  • Contract Address:
    5E1zfVZmokEX29W9xVzMYJAzvwnXWE7AVcP3d1rXzWhC4sxi
    

After new deployment, ensure to update the address in GalaxyAPI.ts.

Additional notes

Layers padding When loading a scene into a new frame, notice that all elements coordinates are adjusted to fit into the frame, adjusting the frame size as well if needed, also clipping an empty space surronding elements in the original frame. In case if its' crucial to maintain the padding, make sure to draw an additional rectangle container around the elements inside of the frame with needed padding when publishing.

License

This project is licensed under the MIT License.