mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 13:25:19 +00:00
Fixed a few things in example
This commit is contained in:
@@ -1,28 +1,29 @@
|
||||
const functions = require("firebase-functions");
|
||||
const admin = require("firebase-admin");
|
||||
const { PKPass } = require("passkit-generator");
|
||||
var fs = require("node:fs");
|
||||
var path = require("node:path");
|
||||
var axios = require("axios");
|
||||
var os = require("node:os");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const axios = require("axios");
|
||||
const os = require("node:os");
|
||||
|
||||
// Firebase init
|
||||
admin.initializeApp({
|
||||
credential: admin.credential.cert(require("CERTIFICATE_PATH")),
|
||||
storageBucket: "STORAGE_BUCKET_URL",
|
||||
});
|
||||
var storageRef = admin.storage().bucket();
|
||||
|
||||
exports.pass = functions.https.onRequest((request, response) => {
|
||||
PKPass.from(
|
||||
const storageRef = admin.storage().bucket();
|
||||
|
||||
exports.pass = functions.https.onRequest(async (request, response) => {
|
||||
const newPass = await PKPass.from(
|
||||
{
|
||||
// Get relevant pass model from model folder (see passkit-generator/examples/models/)
|
||||
model: `./model/${request.body.passType}.pass`,
|
||||
certificates: {
|
||||
// Assigning certificates from certs folder (you will need to provide these yourself)
|
||||
wwdr: fs.fs.readFileSync("./certs/wwdr.pem"),
|
||||
signerCert: fs.fs.readFileSync("./certs/signerCert.pem"),
|
||||
signerKey: fs.fs.readFileSync("./certs/signerKey.pem"),
|
||||
wwdr: fs.readFileSync("./certs/wwdr.pem"),
|
||||
signerCert: fs.readFileSync("./certs/signerCert.pem"),
|
||||
signerKey: fs.readFileSync("./certs/signerKey.pem"),
|
||||
signerKeyPassphrase: "PASSPHRASE",
|
||||
},
|
||||
},
|
||||
@@ -34,7 +35,8 @@ exports.pass = functions.https.onRequest((request, response) => {
|
||||
backgroundColor: request.body.backgroundColor,
|
||||
labelColor: request.body.labelColor,
|
||||
},
|
||||
).then(async (newPass) => {
|
||||
);
|
||||
|
||||
let currentPassType = request.body.passType;
|
||||
|
||||
if (currentPassType == "boardingPass") {
|
||||
@@ -200,5 +202,4 @@ exports.pass = functions.https.onRequest((request, response) => {
|
||||
result: "FAILED",
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user