mirror of
https://github.com/teoxoy/factorio-blueprint-editor.git
synced 2024-12-26 20:54:22 +02:00
Add the ability to fetch blueprint data from https://www.factorio.school/api/blueprintData (#250)
* Add the ability to fetch blueprint data from https://www.factorio.school/api/blueprintData * Use href --------- Co-authored-by: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com>
This commit is contained in:
parent
0bec144b89
commit
fd197792d8
@ -196,6 +196,10 @@ function getBlueprintOrBookFromSource(source: string): Promise<Blueprint | Book>
|
|||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(data => data.blueprintString)
|
.then(data => data.blueprintString)
|
||||||
case 'factorio': // factorio.school
|
case 'factorio': // factorio.school
|
||||||
|
if (pathParts[0] === 'api') {
|
||||||
|
return fetchData(url.href).then(r => r.text())
|
||||||
|
}
|
||||||
|
|
||||||
return fetchData(`https://www.factorio.school/api/blueprint/${pathParts[1]}`)
|
return fetchData(`https://www.factorio.school/api/blueprint/${pathParts[1]}`)
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(data => data.blueprintString.blueprintString)
|
.then(data => data.blueprintString.blueprintString)
|
||||||
|
Loading…
Reference in New Issue
Block a user