Skip to content

Commit

Permalink
Refresh APS Token (#982)
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterBarclay authored Jul 9, 2024
2 parents f3f7325 + f429e64 commit 6020db0
Show file tree
Hide file tree
Showing 10 changed files with 245 additions and 164 deletions.
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
2 changes: 2 additions & 0 deletions fission/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_SYNTHESIS_SERVER_PATH=/
# VITE_SYNTHESIS_SERVER_PATH=https://synthesis.autodesk.com/
17 changes: 10 additions & 7 deletions fission/src/Synthesis.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,23 @@ 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, { ENDPOINT_SYNTHESIS_CHALLENGE } from "./aps/APS.ts"

Check warning on line 57 in fission/src/Synthesis.tsx

View workflow job for this annotation

GitHub Actions / ESLint Format Validation

'ENDPOINT_SYNTHESIS_CHALLENGE' is defined but never used. Allowed unused vars must match /^_/u

Check warning on line 57 in fission/src/Synthesis.tsx

View workflow job for this annotation

GitHub Actions / ESLint Format Validation

'ENDPOINT_SYNTHESIS_CHALLENGE' is defined but never used. Allowed unused vars must match /^_/u
import ResetAllInputsModal from "./ui/modals/configuring/ResetAllInputsModal.tsx"
import Skybox from './ui/components/Skybox.tsx';

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 @@ -81,17 +85,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 info = await MirabufCachingService.CacheRemote(mira_path, MiraType.ROBOT)
Expand Down
6 changes: 0 additions & 6 deletions fission/src/Window.d.ts

This file was deleted.

Loading

0 comments on commit 6020db0

Please sign in to comment.