diff --git a/src/utils/corpus.utils.js b/src/utils/corpus.utils.js index 5755d7c..2b28c44 100644 --- a/src/utils/corpus.utils.js +++ b/src/utils/corpus.utils.js @@ -12,67 +12,42 @@ const keys = require('/srv/keys/owlboard/keys.configs'); const axios = require('axios'); const zlib = require('zlib'); -async function initCorpus() { - let gzipData = await getCorpusAgain(); +async function init() { + var gzipData = await get(); console.log(gzipData); + var rawData = await extract(gzipData); + console.log(rawData); + var cleanData = await clean(rawData); + console.log(cleanData) + return cleanData; } -async function getCorpus() { +async function get() { authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64'); const url = 'https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS' const options = { method: 'get', - timeout: 3000, + timeout: 20000, headers: {'Authorization': `Basic ${authHead}`}, responseType: 'arraybuffer' }; - return await axios.get(url, options).then(function (response){console.log(response.data);return response.data;}); + var { output } = await axios.get(url, options) + console.log(output) + return output; } -async function getCorpusAgain() { - authHead = Buffer.from(`${keys.nr_user}:${keys.nr_pass}`).toString('base64'); - const decomp = zlib.createGunzip(); - const getReq = axios.create({ - method: 'get', - baseURL: 'https://datafeeds.networkrail.co.uk/ntrod/SupportingFileAuthenticate?type=CORPUS', - timeout: 3000, - headers: {'Authorization': `Basic ${authHead}`}, - responseType: 'arraybuffer' - }); - - let download = await getReq().then(function (response){ - return response.data; - }) - - zlib.gunzip(download, function (_err, output){ - let string = output.toString() - let obj = JSON.parse(string) - //console.log(obj); - return obj; // Find out how to get data out of callback -> See pinned tab on laptop2.ws - }) -} - -async function init() { // PSUEDOCODE - var zipData = await get(); - var rawData = extract(zipData); - var cleanData = clean(rawData) -} - -async function get() { - -} - -async function extract() { - +async function extract(input) { + var { data } = zlib.Gunzip(input); + let string = data.toString() + let obj = JSON.parse(string) + //console.log(obj); + return obj; // Find out how to get data out of callback -> See pinned tab on laptop2.ws } async function clean() { - + return "Empty Function: clean()" } module.exports = { - initCorpus, - getCorpusAgain, - getCorpus, init } \ No newline at end of file diff --git a/static/board.html b/static/board.html new file mode 100644 index 0000000..376455b --- /dev/null +++ b/static/board.html @@ -0,0 +1,5 @@ + + + OwlBoard - Loading + + \ No newline at end of file diff --git a/static/js/sw.js b/static/help.html similarity index 100% rename from static/js/sw.js rename to static/help.html diff --git a/static/images/.app-icon-main.xcf b/static/images/.app-icon-main.xcf new file mode 100644 index 0000000..71d9344 Binary files /dev/null and b/static/images/.app-icon-main.xcf differ diff --git a/static/images/app-icons/any/app-256.png b/static/images/app-icons/any/app-256.png new file mode 100644 index 0000000..1ac2fec Binary files /dev/null and b/static/images/app-icons/any/app-256.png differ diff --git a/static/images/app-icons/any/app-512.png b/static/images/app-icons/any/app-512.png new file mode 100644 index 0000000..70d65aa Binary files /dev/null and b/static/images/app-icons/any/app-512.png differ diff --git a/static/images/app-icons/app-1200.png b/static/images/app-icons/maskable/app-1200.png similarity index 100% rename from static/images/app-icons/app-1200.png rename to static/images/app-icons/maskable/app-1200.png diff --git a/static/images/app-icons/app-128.png b/static/images/app-icons/maskable/app-128.png similarity index 100% rename from static/images/app-icons/app-128.png rename to static/images/app-icons/maskable/app-128.png diff --git a/static/images/app-icons/app-256.png b/static/images/app-icons/maskable/app-256.png similarity index 100% rename from static/images/app-icons/app-256.png rename to static/images/app-icons/maskable/app-256.png diff --git a/static/images/app-icons/app-384.png b/static/images/app-icons/maskable/app-384.png similarity index 100% rename from static/images/app-icons/app-384.png rename to static/images/app-icons/maskable/app-384.png diff --git a/static/images/app-icons/app-512.png b/static/images/app-icons/maskable/app-512.png similarity index 100% rename from static/images/app-icons/app-512.png rename to static/images/app-icons/maskable/app-512.png diff --git a/static/images/app-icons/app-76.png b/static/images/app-icons/maskable/app-76.png similarity index 100% rename from static/images/app-icons/app-76.png rename to static/images/app-icons/maskable/app-76.png diff --git a/static/images/app-icons/app-768.png b/static/images/app-icons/maskable/app-768.png similarity index 100% rename from static/images/app-icons/app-768.png rename to static/images/app-icons/maskable/app-768.png diff --git a/static/index.html b/static/index.html index 6937c15..40f9f64 100644 --- a/static/index.html +++ b/static/index.html @@ -1,32 +1,30 @@ - + - - - - - - - - - Athena - - - + + + + + + + + + + OwlBoard -