File tree Expand file tree Collapse file tree 5 files changed +29
-16
lines changed Expand file tree Collapse file tree 5 files changed +29
-16
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,14 @@ const CHROME_PORT = process.env.CHROME_PORT || 6767;
3333const WISP_PORT = process . env . WISP_PORT || 6768 ;
3434const ISOLATION_PORT = process . env . ISOLATION_PORT || 5233 ;
3535
36- process . env . VITE_WISP_URL =
37- process . env . VITE_WISP_URL || `ws://localhost:${ WISP_PORT } /` ;
38- process . env . VITE_ISOLATION_ORIGIN =
39- process . env . VITE_ISOLATION_ORIGIN || `http://localhost:${ ISOLATION_PORT } ` ;
36+ const puterBranding = Boolean ( process . env . VITE_PUTER_BRANDING ) ;
37+
38+ if ( puterBranding ) {
39+ process . env . VITE_ISOLATION_ORIGIN ||= `https://puter.zone` ;
40+ } else {
41+ process . env . VITE_WISP_URL ||= `ws://localhost:${ WISP_PORT } /` ;
42+ process . env . VITE_ISOLATION_ORIGIN ||= `http://localhost:${ ISOLATION_PORT } ` ;
43+ }
4044
4145const sandboxRoot = path . resolve ( "./packages/sandbox" ) ;
4246
@@ -77,7 +81,7 @@ const lines = [
7781 ) ,
7882 black ( ) (
7983 `${ accent ( "wisp" ) } ${ connector } ${ urlColor (
80- process . env . VITE_WISP_URL ?? ""
84+ process . env . VITE_WISP_URL ?? "(puter) "
8185 ) } `
8286 ) ,
8387 black ( ) (
Original file line number Diff line number Diff line change 66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
77 < title > Browser</ title >
88
9- < script src ="https://js.puter.com/v2/ "> </ script >
10-
119 <!--ssr-head-->
1210 </ head >
1311
Original file line number Diff line number Diff line change @@ -292,10 +292,10 @@ export async function saveBrowserState() {
292292
293293 let ser = browser . serialize ( ) ;
294294
295- if ( import . meta. env . VITE_LOCAL ) {
296- localStorage [ "browserstate" ] = JSON . stringify ( ser ) ;
297- } else {
295+ if ( import . meta. env . VITE_PUTER_BRANDING ) {
298296 await puter . kv . set ( "browserstate" , JSON . stringify ( ser ) ) ;
297+ } else {
298+ localStorage [ "browserstate" ] = JSON . stringify ( ser ) ;
299299 }
300300
301301 // if (!import.meta.env.VITE_LOCAL) {
@@ -319,10 +319,10 @@ export async function initBrowser() {
319319 // }
320320
321321 let de ;
322- if ( import . meta. env . VITE_LOCAL ) {
323- de = localStorage [ "browserstate" ] ;
324- } else {
322+ if ( import . meta. env . VITE_PUTER_BRANDING ) {
325323 de = await puter . kv . get ( "browserstate" ) ;
324+ } else {
325+ de = localStorage [ "browserstate" ] ;
326326 }
327327 if ( de ) {
328328 try {
Original file line number Diff line number Diff line change @@ -11,7 +11,18 @@ import { App } from "./App";
1111import { css } from "dreamland/core" ;
1212import { setWispUrl } from "./IsolatedFrame" ;
1313
14- export const isPuter = ! import . meta. env . VITE_LOCAL && puter . env == "app" ;
14+ // load puter sdk
15+ if ( import . meta. env . VITE_PUTER_BRANDING ) {
16+ let script = < script src = "https://js.puter.com/v2/" > </ script > ;
17+ document . head . appendChild ( script ) ;
18+
19+ await new Promise ( ( resolve ) => {
20+ script . onload = ( ) => resolve ( null ) ;
21+ } ) ;
22+ }
23+
24+ export const isPuter =
25+ import . meta. env . VITE_PUTER_BRANDING && puter . env == "app" ;
1526
1627export function LoadInterstitial ( s : { status : string } ) {
1728 return (
@@ -60,7 +71,7 @@ export async function mount(): Promise<HTMLElement> {
6071 e . preventDefault ( ) ;
6172 } ) ;
6273
63- if ( ! import . meta. env . VITE_LOCAL ) {
74+ if ( import . meta. env . VITE_PUTER_BRANDING ) {
6475 if ( ! puter . auth . isSignedIn ( ) ) {
6576 await puter . auth . signIn ( ) ;
6677 return ;
Original file line number Diff line number Diff line change 22/// <reference types="@mercuryworkshop/scramjet" />
33
44interface ImportMetaEnv {
5- readonly VITE_LOCAL : boolean ;
5+ readonly VITE_PUTER_BRANDING : boolean ;
66 readonly VITE_ISOLATION_ORIGIN : string ;
77 readonly VITE_WISP_URL : string ;
88}
You can’t perform that action at this time.
0 commit comments