mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-06 06:54:58 +00:00
Update aviation.js
This commit is contained in:
parent
c14f4358f3
commit
c1f9249252
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -108,6 +108,7 @@ bin
|
||||||
data/chatgpt-apikey.txt
|
data/chatgpt-apikey.txt
|
||||||
data/anthropic-apikey.txt
|
data/anthropic-apikey.txt
|
||||||
data/groq-apikey.txt
|
data/groq-apikey.txt
|
||||||
|
data/aviationstack-apikey.txt
|
||||||
app/assets/img/_templates
|
app/assets/img/_templates
|
||||||
app/assets/img/_captured
|
app/assets/img/_captured
|
||||||
settings.ini
|
settings.ini
|
||||||
|
|
|
@ -9,7 +9,12 @@
|
||||||
var HTTP = require("lib/http");
|
var HTTP = require("lib/http");
|
||||||
|
|
||||||
var API_BASE_URL = "https://api.aviationstack.com/v1";
|
var API_BASE_URL = "https://api.aviationstack.com/v1";
|
||||||
var API_ACCESS_KEY = "YOUR_ACCESS_KEY";
|
var API_ACCESS_KEY = "";
|
||||||
|
|
||||||
|
function loadApiKey() {
|
||||||
|
var s = FILE.readFile("data/aviationstack-apikey.txt", FILE.CdoCharset.CdoUTF_8);
|
||||||
|
return s.trim();
|
||||||
|
}
|
||||||
|
|
||||||
function getData(type, params, limit, offset) {
|
function getData(type, params, limit, offset) {
|
||||||
var params = params || {};
|
var params = params || {};
|
||||||
|
@ -20,6 +25,10 @@ function getData(type, params, limit, offset) {
|
||||||
return n > -1 ? n : 0;
|
return n > -1 ? n : 0;
|
||||||
}(parseInt(limit));
|
}(parseInt(limit));
|
||||||
|
|
||||||
|
if (API_ACCESS_KEY == "") {
|
||||||
|
API_ACCESS_KEY = loadApiKey();
|
||||||
|
}
|
||||||
|
|
||||||
params["limit"] = limit;
|
params["limit"] = limit;
|
||||||
params["offset"] = offset;
|
params["offset"] = offset;
|
||||||
params["access_key"] = API_ACCESS_KEY;
|
params["access_key"] = API_ACCESS_KEY;
|
||||||
|
@ -79,7 +88,7 @@ exports.getCountries = getCountries;
|
||||||
exports.getFlightSchedules = getFlightSchedules;
|
exports.getFlightSchedules = getFlightSchedules;
|
||||||
exports.getFlightsFuture = getFlightsFuture;
|
exports.getFlightsFuture = getFlightsFuture;
|
||||||
|
|
||||||
exports.VERSIONINFO = "Aviation Data Integration (aviation.js) version 0.1";
|
exports.VERSIONINFO = "Aviation Data Integration (aviation.js) version 0.1.1";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user