feat(core): open in app for self-hosted (#9231)

<div class='graphite__hidden'>
          <div>🎥 Video uploaded on Graphite:</div>
            <a href="https://app.graphite.dev/media/video/T2klNLEk0wxLh4NRDzhk/545994dd-6f7d-468d-a90c-45cb382fdb9d.mp4">
              <img src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/T2klNLEk0wxLh4NRDzhk/545994dd-6f7d-468d-a90c-45cb382fdb9d.mp4">
            </a>
          </div>
<video src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/T2klNLEk0wxLh4NRDzhk/545994dd-6f7d-468d-a90c-45cb382fdb9d.mp4">20241222-1456-24.5006677.mp4</video>

fix AF-1815
This commit is contained in:
pengx17
2024-12-24 03:04:01 +00:00
parent 884bbd2ada
commit 17c2293986
14 changed files with 140 additions and 43 deletions
@@ -35,6 +35,11 @@ export interface AuthSessionAuthenticated {
session: AuthSessionInfo;
}
export type AuthSessionStatus = (
| AuthSessionUnauthenticated
| AuthSessionAuthenticated
)['status'];
export class AuthSession extends Entity {
session$: LiveData<AuthSessionUnauthenticated | AuthSessionAuthenticated> =
LiveData.from(this.store.watchCachedAuthSession(), null).map(session =>
@@ -20,6 +20,10 @@ export const getOpenUrlInDesktopAppLink = (
if (newTab) {
params.set('new-tab', '1');
}
if (environment.isSelfHosted) {
// assume self-hosted server is the current origin
params.set('server', location.origin);
}
return new URL(
`${scheme}://${urlObject.host}${urlObject.pathname}?${params.toString()}#${urlObject.hash}`
).toString();