diff options
| author | kaotisk <kaotisk@arching-kaos.org> | 2024-11-20 12:10:56 +0200 | 
|---|---|---|
| committer | kaotisk <kaotisk@arching-kaos.org> | 2024-11-20 12:10:56 +0200 | 
| commit | 8a25a69ee253e4da0bc088d9d81818bd821e1b5c (patch) | |
| tree | 22ef3ea380d2580e40adbec77140f67badc5870f /api/routes | |
| parent | 59afc2bc737f4c9edf32cc1ee05e81b99f0eeb2f (diff) | |
| download | arching-kaos-tools-8a25a69ee253e4da0bc088d9d81818bd821e1b5c.tar.gz arching-kaos-tools-8a25a69ee253e4da0bc088d9d81818bd821e1b5c.tar.bz2 arching-kaos-tools-8a25a69ee253e4da0bc088d9d81818bd821e1b5c.zip  | |
Clean up
Diffstat (limited to 'api/routes')
| -rw-r--r-- | api/routes/getMrk/index.js | 38 | ||||
| -rw-r--r-- | api/routes/getTr/index.js | 37 | 
2 files changed, 0 insertions, 75 deletions
diff --git a/api/routes/getMrk/index.js b/api/routes/getMrk/index.js deleted file mode 100644 index 92f8c1e..0000000 --- a/api/routes/getMrk/index.js +++ /dev/null @@ -1,38 +0,0 @@ -const fs = require("fs"); -const config = require("../../config"); - -/* - * Gets a local merkle leaf - * - * Returns: - *  the merkle leaf - * - */ -function fetchFmrk(mrk, res){ -    res.set('Content-Type', 'application/json'); -    const path = config.workDir+"/fmrk/"+mrk; -    // console.log(path) -    try { -        if(fs.existsSync(path)){ -            res.send(fs.readFileSync(path)); -        } -    } catch (error) { -        res.send({"error":error.message}); -    } -}; - -module.exports = (req, res) => { -    console.log(req.params) -    res.set('Content-Type', 'application/json'); -    if ( (req.params.mrk) && typeof req.params.mrk === "string" && req.params.mrk.length === 128 ){ -        regex= /[a-f0-9]{128}/; -        if (regex.test(req.params.mrk)){ -            let mrk = req.params.mrk; -            fetchFmrk(mrk,res); -        } else { -            res.send({error:"Invalid data: regexp failed to pass"}); -        } -    } else { -        res.send({error:"Invalid data: no valid zblock was provided"}); -    } -} diff --git a/api/routes/getTr/index.js b/api/routes/getTr/index.js deleted file mode 100644 index 11ef38e..0000000 --- a/api/routes/getTr/index.js +++ /dev/null @@ -1,37 +0,0 @@ -const fs = require("fs"); -const config = require("../../config"); - -/* - * Gets a file chunk - * - * Returns: - *  the chunk - * - */ -function fetchFtr(tr, res){ -    res.set('Content-Type', 'application/json'); -    const path = config.workDir+"/ftr/"+tr; -    try { -        if(fs.existsSync(path)){ -            res.send(fs.readFileSync(path)); -        } -    } catch (error) { -        res.send({"error":error.message}); -    } -}; - -module.exports = (req, res) => { -    console.log(req.params) -    res.set('Content-Type', 'application/json'); -    if ( (req.params.tr) && typeof req.params.tr === "string" && req.params.tr.length === 128 ){ -        regex= /[a-f0-9]{128}/; -        if (regex.test(req.params.tr)){ -            let tr = req.params.tr; -            fetchFtr(tr,res); -        } else { -            res.send({error:"Invalid data: regexp failed to pass"}); -        } -    } else { -        res.send({error:"Invalid data: no valid zblock was provided"}); -    } -}  | 
