diff options
author | 0neGal <mail@0negal.com> | 2023-01-15 22:22:03 +0100 |
---|---|---|
committer | 0neGal <mail@0negal.com> | 2023-01-15 22:22:03 +0100 |
commit | dee886fb40c4e8600a309a44e4a6938bcb61d51d (patch) | |
tree | 4bfd43cc9379f7a1818c0dbd403bd89f635c7996 | |
parent | 6c34ee014aecb9248d519bae0ab64aebab5b3e31 (diff) | |
download | Viper-dee886fb40c4e8600a309a44e4a6938bcb61d51d.tar.gz Viper-dee886fb40c4e8600a309a44e4a6938bcb61d51d.zip |
added version numbers to requests in requests.js
-rw-r--r-- | src/modules/requests.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/modules/requests.js b/src/modules/requests.js index a5f3121..6841fe2 100644 --- a/src/modules/requests.js +++ b/src/modules/requests.js @@ -1,9 +1,10 @@ const { app } = require("electron"); const path = require("path"); const fs = require("fs"); -const { https } = require("follow-redirects"); +const { https, http } = require("follow-redirects"); const lang = require("../lang"); +const json = require("./json"); // all requests results are stored in this file const cachePath = path.join(app.getPath("cache"), "viper-requests.json"); @@ -11,6 +12,7 @@ const NORTHSTAR_LATEST_RELEASE_KEY = "nsLatestRelease"; const NORTHSTAR_RELEASE_NOTES_KEY = "nsReleaseNotes"; const VIPER_RELEASE_NOTES_KEY = "vpReleaseNotes"; +const user_agent = "viper/" + json(path.join(__dirname, "../../package.json")).version; function _saveCache(data) { fs.writeFileSync(cachePath, JSON.stringify(data)); @@ -40,7 +42,7 @@ async function getLatestNsVersion() { port: 443, path: "/repos/R2Northstar/Northstar/releases/latest", method: "GET", - headers: { "User-Agent": "viper" } + headers: { "User-Agent": user_agent } }, response => { @@ -90,7 +92,7 @@ async function getNsReleaseNotes() { port: 443, path: "/repos/R2Northstar/Northstar/releases", method: "GET", - headers: { "User-Agent": "viper" } + headers: { "User-Agent": user_agent } }, response => { @@ -141,7 +143,7 @@ async function getVpReleaseNotes() { port: 443, path: "/repos/0negal/viper/releases", method: "GET", - headers: { "User-Agent": "viper" } + headers: { "User-Agent": user_agent } }, response => { |