-
Notifications
You must be signed in to change notification settings - Fork 0
feat: oauth #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
feat: oauth #1
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,17 @@ | ||
| pre-commit: | ||
| jobs: | ||
| - name: format | ||
| run: npm run format | ||
| run: pnpm format | ||
| stage_fixed: true | ||
|
|
||
| - name: lint | ||
| run: pnpm exec oxlint {staged_files} | ||
| glob: "*.{js,ts,mjs,cjs,vue}" | ||
|
|
||
| pre-push: | ||
| jobs: | ||
| - name: typecheck | ||
| run: pnpm typecheck | ||
|
|
||
| - name: test | ||
| run: pnpm vitest run | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { defineBoot } from "#q-app"; | ||
| import { useExperimentSync } from "@/features/sync"; | ||
|
|
||
| /** | ||
| * Start mirroring experiments to the sync server and adopt any live ORCID | ||
| * session left by a login redirect. | ||
| */ | ||
| export default defineBoot(({ store }) => { | ||
| const { restoreSession, watchCurrentExperiment } = useExperimentSync(store); | ||
|
|
||
| watchCurrentExperiment(); | ||
| void restoreSession(); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| /** The ORCID account an experiment belongs to. */ | ||
| export interface ExperimentAuthor { | ||
| /** Author's ORCID iD, e.g. `0000-0001-2345-6789`. */ | ||
| orcid: string; | ||
|
|
||
| /** Author's display name as reported by ORCID. */ | ||
| name: string; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,8 @@ | ||
| /** Which tab the preferences dialog opens on. */ | ||
| export type PreferencesTab = "general" | "scene" | "probe" | "export" | "reset"; | ||
| export type PreferencesTab = | ||
| | "general" | ||
| | "scene" | ||
| | "probe" | ||
| | "export" | ||
| | "sync" | ||
| | "reset"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { | ||
| getExperimentModelIds, | ||
| type Experiment, | ||
| type SceneModelFile, | ||
| unzipExperiment, | ||
| zipExperiment | ||
| } from "@/features/experiment"; | ||
| import { getSceneModel, putSceneModel } from "@/features/scene"; | ||
|
|
||
| /** An experiment recovered from a synced archive. */ | ||
| export interface RestoredArchive { | ||
| experiment: Experiment; | ||
| } | ||
|
|
||
| /** | ||
| * Zip an experiment together with every scene model file it references that is | ||
| * still held locally. | ||
| * @param experiment Experiment to archive. | ||
| */ | ||
| export async function buildExperimentArchive( | ||
| experiment: Experiment | ||
| ): Promise<Uint8Array> { | ||
| const models = new Map<string, SceneModelFile>(); | ||
| for (const id of getExperimentModelIds(experiment)) { | ||
| const modelFile = await getSceneModel(id); | ||
| if (!modelFile) continue; | ||
| models.set(id, { | ||
| fileName: modelFile.name, | ||
| bytes: new Uint8Array(await modelFile.arrayBuffer()) | ||
| }); | ||
| } | ||
|
|
||
| return zipExperiment(experiment, models); | ||
| } | ||
|
|
||
| /** | ||
| * Read an experiment archive back, writing its model files to local storage, | ||
| * or null when the bytes aren't a well-formed archive. | ||
| * @param archiveBytes Zipped experiment archive. | ||
| */ | ||
| export async function restoreExperimentArchive( | ||
| archiveBytes: Uint8Array | ||
| ): Promise<RestoredArchive | null> { | ||
| let archive: ReturnType<typeof unzipExperiment>; | ||
| try { | ||
| archive = unzipExperiment(archiveBytes); | ||
| } catch { | ||
| return null; | ||
| } | ||
| if (!archive) return null; | ||
|
|
||
| for (const [id, { fileName, bytes }] of archive.models) { | ||
| await putSceneModel(id, new File([bytes.slice()], fileName)); | ||
| } | ||
|
|
||
| return { experiment: archive.experiment }; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbirman Testing takes a really long time (tens of seconds on a really strong PC)... are you sure you want to be running that every time you want to push? Typecheck on TS v6 is also really slow (maybe 10 seconds), and TS v7 (which fixes this) support won't come for Vue until v7.1. That's why I stripped out these two functions from lefthook and instead put them in GitHub Actions as required checks before PR merges.