File tree Expand file tree Collapse file tree 2 files changed +26
-16
lines changed Expand file tree Collapse file tree 2 files changed +26
-16
lines changed Original file line number Diff line number Diff line change 77 const signinPath = url .pathname === ' /search' ? url .pathname : undefined ;
88 const u = new URLSearchParams (url .search );
99 const openSignInModal = u .get (' signin' );
10- const pathname = url .pathname ;
10+ const pathname: string = url .pathname ;
1111
1212 const sessionCookiePresent = cookie .get (' session_id' );
13+ const pubPath = pathname .startsWith (' /u/' ) && pathname .split (' /' ).length >= 3 ;
14+ if (pubPath && ! sessionCookiePresent ) {
15+ return {
16+ props: {
17+ signinPath: signinPath ,
18+ pathname: url .pathname ,
19+ openSignInModal: openSignInModal ,
20+ authenticated: false
21+ }
22+ };
23+ }
24+
1325 if (auth .publicPaths .has (pathname ) && ! sessionCookiePresent ) {
1426 return {
1527 props: {
Original file line number Diff line number Diff line change 5252 let timeout: any ;
5353
5454 const handleCopy = (cmd : string ) => {
55+ const u = new URL (import .meta .env .VITE_OPEN_REGISTRY_BACKEND_URL );
5556 switch (cmd ) {
5657 case ' push' :
5758 isCopied = ' push' ;
58- window .navigator .clipboard .writeText (
59- ` docker push ${import .meta .env .VITE_OPEN_REGISTRY_BACKEND_URL }/${ns } `
60- );
59+ window .navigator .clipboard .writeText (` docker push ${u .hostname }/${ns } ` );
6160 break ;
6261 case ' pull' :
6362 isCopied = ' pull' ;
64- window .navigator .clipboard .writeText (
65- ` docker pull ${import .meta .env .VITE_OPEN_REGISTRY_BACKEND_URL }/${ns } `
66- );
63+ window .navigator .clipboard .writeText (` docker pull ${u .hostname }/${ns } ` );
6764 }
6865
6966 timeout = setTimeout (() => {
130127 </div >
131128 <div class =" flex flex-col w-4/12 rounded-md mx-4 bg-gray-50 px-4 py-8" >
132129 <h1 class =" text-xl font-medium mb-4" >Quick Docker Commands</h1 >
130+
131+ <div class =" my-2 text-center px-4 py-2 bg-brown-400 rounded-md" >
132+ <span
133+ on:click ={() => handleCopy (' pull' )}
134+ class =" {isCopied === ' pull' ? ' font-semibold' : ' ' } select-all text-sm text-gray-900 "
135+ >
136+ {isCopied === ' pull' ? ' Copied!!' : ` docker pull openregistry.dev/${ns } ` }
137+ </span >
138+ </div >
139+
133140 <div class =" my-2 px-4 py-2 text-center bg-brown-400 rounded-md" >
134141 <span
135142 on:click ={() => handleCopy (' push' )}
140147 {isCopied === ' push' ? ' Copied!!' : ` docker push openregistry.dev/${ns } ` }
141148 </span >
142149 </div >
143-
144- <div class =" my-2 text-center px-4 py-2 bg-brown-400 rounded-md" >
145- <span
146- on:click ={() => handleCopy (' pull' )}
147- class =" {isCopied === ' pull' ? ' font-semibold' : ' ' } select-all text-sm text-gray-900 "
148- >
149- {isCopied === ' pull' ? ' Copied!!' : ` docker pull openregistry.dev/${ns } ` }
150- </span >
151- </div >
152150 </div >
153151 {/if }
154152 </div >
You can’t perform that action at this time.
0 commit comments