-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Test improved Github actions config 1 * Test improved Github actions config 2 * Test improved Github actions config 3 * update * update * update docs * Enable dev builds on docker * Add Fast.com backend and options
- Loading branch information
Showing
6 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 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,41 @@ | ||
import FastSpeedtest from 'fast-speedtest-api'; | ||
|
||
async function getFastToken() { | ||
const response = await fetch('https://fast.com/app-ed402d.js'); | ||
|
||
const data = await response.text(); | ||
|
||
let token = data.match(/token:"(.{32})"/)[1]; | ||
|
||
console.log("Recieved API token: ", token); | ||
|
||
return token; | ||
} | ||
|
||
export async function speedtestFast() { | ||
|
||
const token = await getFastToken(); | ||
|
||
let speedtest = new FastSpeedtest({ | ||
token: token, // required | ||
verbose: false, // default: false | ||
timeout: 10000, // default: 5000 | ||
https: true, // default: true | ||
urlCount: 5, // default: 5 | ||
bufferSize: 8, // default: 8 | ||
}); | ||
|
||
return new Promise((resolveFunc) => { | ||
speedtest.getSpeed().then(s => { | ||
resolveFunc({ | ||
error: false, | ||
download: ~~(s / 1e4) / 1e2 | ||
}); | ||
}).catch(e => { | ||
resolveFunc({ | ||
error: true, | ||
message: e.message | ||
}); | ||
}); | ||
}); | ||
} |
This file contains 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