Browse Source

tron: fix generated url + avoid crash on 404

content-update
Clement Denis 4 years ago
parent
commit
5573cf635f
  1. 4
      subjects/tron/index.html

4
subjects/tron/index.html

@ -217,7 +217,7 @@ const toBlob = async r => {
const memo = {} const memo = {}
const fetchBlob = url => memo[url] || (memo[url] = fetch(url).then(toBlob)) const fetchBlob = url => memo[url] || (memo[url] = fetch(url).then(toBlob))
const remoteURL = (login, sha) => const remoteURL = (login, sha) =>
`${location.origin}/${login}/tron/raw/branch/${sha || 'master'}/ai.js` `https://git.${location.host}/${login}/tron/raw/branch/${sha || 'master'}/ai.js`
const formatURL = url => { const formatURL = url => {
if (url.startsWith('/')) return `${location.pathname}/ai/${url}` if (url.startsWith('/')) return `${location.pathname}/ai/${url}`
@ -318,7 +318,7 @@ const start = async ({ urls, seed }) => {
} }
} catch (err) { } catch (err) {
console.error(err) console.error(err)
kill('FAILED-TO-LOAD') return kill('FAILED-TO-LOAD')
} }
move(ai.x, ai.y, ai.color, turn) move(ai.x, ai.y, ai.color, turn)

Loading…
Cancel
Save