Skip to content
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

Refresh APS Token #982

Merged
merged 16 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion exporter/SynthesisFusionAddin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,5 @@ site-packages
# env files
**/.env

proto/proto_out
proto/proto_out
.aps_auth
17 changes: 10 additions & 7 deletions fission/src/Synthesis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,21 @@ import World from "@/systems/World.ts"
import { AddRobotsModal, AddFieldsModal, SpawningModal } from "@/modals/spawning/SpawningModals.tsx"
import ImportMirabufModal from "@/modals/mirabuf/ImportMirabufModal.tsx"
import ImportLocalMirabufModal from "@/modals/mirabuf/ImportLocalMirabufModal.tsx"
import APS from "./aps/APS.ts"

const DEFAULT_MIRA_PATH = "/api/mira/Robots/Team 2471 (2018)_v7.mira"

function Synthesis() {
const urlParams = new URLSearchParams(document.location.search)
if (urlParams.has("code")) {
const has_code = urlParams.has("code")
if (has_code) {
const code = urlParams.get("code")
window.opener?.setAuthCode(code)
window.close()
if (code) {
APS.convertAuthToken(code).then(() => {
document.location.search = ""
})
}
}

const { openModal, closeModal, getActiveModalElement } = useModalManager(initialModals)
const { openPanel, closePanel, closeAllPanels, getActivePanelElements } = usePanelManager(initialPanels)
const { showTooltip } = useTooltipManager()
Expand All @@ -79,17 +83,16 @@ function Synthesis() {
const modalElement = getActiveModalElement()

useEffect(() => {
if (has_code) return

World.InitWorld()

let mira_path = DEFAULT_MIRA_PATH

const urlParams = new URLSearchParams(document.location.search)

if (urlParams.has("mira")) {
mira_path = `test_mira/${urlParams.get("mira")!}`
console.debug(`Selected Mirabuf File: ${mira_path}`)
}
console.log(urlParams)

const setup = async () => {
const miraAssembly = await LoadMirabufRemote(mira_path)
Expand Down
3 changes: 0 additions & 3 deletions fission/src/Window.d.ts
BrandonPacewic marked this conversation as resolved.
Show resolved Hide resolved

This file was deleted.

Loading