File tree 3 files changed +23
-4
lines changed 3 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ import { StartWorkspaceModal } from "./workspaces/StartWorkspaceModal";
47
47
import { parseProps } from "./start/StartWorkspace" ;
48
48
import SelectIDEModal from "./settings/SelectIDEModal" ;
49
49
import { StartPage , StartPhase } from "./start/StartPage" ;
50
- import { isGitpodIo } from "./utils" ;
50
+ import { isGitpodIo , isLocalPreview } from "./utils" ;
51
51
import { BlockedRepositorySettings } from "./admin/BlockedRepositorySettings" ;
52
52
53
53
const Setup = React . lazy ( ( ) => import ( /* webpackPrefetch: true */ "./Setup" ) ) ;
@@ -277,6 +277,11 @@ function App() {
277
277
return < div > </ div > ;
278
278
}
279
279
280
+ if ( isLocalPreview ( ) ) {
281
+ window . location . host = "www.gitpod.io" ;
282
+ return < div > </ div > ;
283
+ }
284
+
280
285
if ( isGitpodIo ( ) && window . location . pathname === "/" && window . location . hash === "" && ! loading && ! user ) {
281
286
if ( ! GitpodCookie . isPresent ( document . cookie ) ) {
282
287
window . location . href = `https://www.gitpod.io` ;
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ import FeedbackFormModal from "./feedback-form/FeedbackModal";
28
28
import { inResource , isGitpodIo } from "./utils" ;
29
29
import { FeatureFlagContext } from "./contexts/FeatureFlagContext" ;
30
30
import { getExperimentsClient } from "./experiments/client" ;
31
+ import Alert from "./components/Alert" ;
32
+ import { isLocalPreview } from "./utils" ;
31
33
32
34
interface Entry {
33
35
title : string ;
@@ -112,6 +114,8 @@ export default function Menu() {
112
114
const isWorkspacesUI = inResource ( location . pathname , [ "workspaces" ] ) ;
113
115
const isAdminUI = inResource ( window . location . pathname , [ "admin" ] ) ;
114
116
117
+ const isLP = isLocalPreview ( ) ;
118
+
115
119
const [ teamMembers , setTeamMembers ] = useState < Record < string , TeamMemberInfo [ ] > > ( { } ) ;
116
120
useEffect ( ( ) => {
117
121
if ( ! teams ) {
@@ -489,6 +493,12 @@ export default function Menu() {
489
493
) ) }
490
494
</ nav >
491
495
) }
496
+ { isLP && (
497
+ < Alert type = "warning" className = "mt-4 w-96" >
498
+ Visit https://www.gitpod.io/community-license?utm_source=local-preview for next steps on running
499
+ a Production version of Gitpod
500
+ </ Alert >
501
+ ) }
492
502
</ header >
493
503
< Separator />
494
504
</ >
Original file line number Diff line number Diff line change @@ -58,8 +58,12 @@ export function isGitpodIo() {
58
58
) ;
59
59
}
60
60
61
+ export function isLocalPreview ( ) {
62
+ return window . location . hostname . endsWith ( "nip.io" ) ;
63
+ }
64
+
61
65
function trimResource ( resource : string ) : string {
62
- return resource . split ( '/' ) . filter ( Boolean ) . join ( '/' ) ;
66
+ return resource . split ( "/" ) . filter ( Boolean ) . join ( "/" ) ;
63
67
}
64
68
65
69
// Returns 'true' if a 'pathname' is a part of 'resources' provided.
@@ -69,9 +73,9 @@ function trimResource(resource: string): string {
69
73
// 'pathname' arg can be provided via `location.pathname`.
70
74
export function inResource ( pathname : string , resources : string [ ] ) : boolean {
71
75
// Removes leading and trailing '/'
72
- const trimmedResource = trimResource ( pathname )
76
+ const trimmedResource = trimResource ( pathname ) ;
73
77
74
78
// Checks if a path is part of a resource.
75
79
// E.g. "api/userspace/resource" path is a part of resource "api/userspace"
76
- return resources . map ( res => trimmedResource . startsWith ( trimResource ( res ) ) ) . some ( Boolean )
80
+ return resources . map ( ( res ) => trimmedResource . startsWith ( trimResource ( res ) ) ) . some ( Boolean ) ;
77
81
}
You can’t perform that action at this time.
0 commit comments