stellarium-ts 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +9 -0
- package/package.json +1 -1
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,UAAU,YAAY;IAClB,OAAO,EAAE,OAAO,CAAC;CACpB;AA+BD;;;;GAIG;AACH,QAAA,MAAM,MAAM,EAAE,kBAAkB,CAAC,YAAY,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,UAAU,YAAY;IAClB,OAAO,EAAE,OAAO,CAAC;CACpB;AA+BD;;;;GAIG;AACH,QAAA,MAAM,MAAM,EAAE,kBAAkB,CAAC,YAAY,CAmJ5C,CAAC;eAGa,MAAM"}
|
package/dist/routes.js
CHANGED
|
@@ -88,6 +88,15 @@ const routes = async (fastify, options) => {
|
|
|
88
88
|
fastify.post('/run/resource', async (request, reply) => {
|
|
89
89
|
const resourceRequest = request.body;
|
|
90
90
|
const paymentVoucher = resourceRequest.paymentVoucher;
|
|
91
|
+
// Check that the API Key matches the env variable
|
|
92
|
+
const authorizationHeader = request.headers['authorization'];
|
|
93
|
+
if (!authorizationHeader) {
|
|
94
|
+
return reply.status(401).send({ error: 'Authorization header is required' });
|
|
95
|
+
}
|
|
96
|
+
const apiKey = authorizationHeader.split(' ')[1];
|
|
97
|
+
if (apiKey !== process.env.API_KEY) {
|
|
98
|
+
return reply.status(401).send({ error: 'Invalid API Key' });
|
|
99
|
+
}
|
|
91
100
|
if (paymentVoucher) {
|
|
92
101
|
const isValid = verifyData(paymentVoucherPayload(paymentVoucher, resourceRequest.resourcePath, resourceRequest.resourceName, resourceRequest.parameters), paymentVoucher.publicKey, paymentVoucher.signature);
|
|
93
102
|
if (!isValid) {
|