mirror of
https://github.com/marcogll/passkit-generator.git
synced 2026-03-15 14:25:17 +00:00
Fixed missing __dirname in all the self-hosted examples
This commit is contained in:
@@ -29,11 +29,14 @@
|
|||||||
* A feedback to Apple have been sent for this.
|
* A feedback to Apple have been sent for this.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
import path from "node:path";
|
||||||
|
import { promises as fs } from "node:fs";
|
||||||
|
import { PKPass } from "passkit-generator";
|
||||||
import { app } from "./webserver.js";
|
import { app } from "./webserver.js";
|
||||||
import { getCertificates } from "./shared.js";
|
import { getCertificates } from "./shared.js";
|
||||||
import { promises as fs } from "node:fs";
|
|
||||||
import path from "node:path";
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
import { PKPass } from "passkit-generator";
|
|
||||||
|
|
||||||
// *************************** //
|
// *************************** //
|
||||||
// *** EXAMPLE FROM NOW ON *** //
|
// *** EXAMPLE FROM NOW ON *** //
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import { PKPass } from "passkit-generator";
|
import { PKPass } from "passkit-generator";
|
||||||
import { app } from "./webserver.js";
|
import { app } from "./webserver.js";
|
||||||
import { getCertificates } from "./shared.js";
|
import { getCertificates } from "./shared.js";
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
app.route("/localize/:modelName").get(async (request, response) => {
|
app.route("/localize/:modelName").get(async (request, response) => {
|
||||||
const passName =
|
const passName =
|
||||||
request.params.modelName +
|
request.params.modelName +
|
||||||
@@ -31,7 +34,12 @@ app.route("/localize/:modelName").get(async (request, response) => {
|
|||||||
signerKeyPassphrase: certificates.signerKeyPassphrase,
|
signerKeyPassphrase: certificates.signerKeyPassphrase,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
request.body || request.params || request.query,
|
Object.assign(
|
||||||
|
{
|
||||||
|
serialNumber: Math.random().toString(36).substring(2, 15),
|
||||||
|
},
|
||||||
|
request.body || request.query || {},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Italian, already has an .lproj which gets included...
|
// Italian, already has an .lproj which gets included...
|
||||||
|
|||||||
@@ -5,10 +5,13 @@
|
|||||||
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
import { promises as fs } from "node:fs";
|
import { promises as fs } from "node:fs";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import { PKPass } from "passkit-generator";
|
import { PKPass } from "passkit-generator";
|
||||||
import { app } from "./webserver.js";
|
import { app } from "./webserver.js";
|
||||||
import { getCertificates } from "./shared.js";
|
import { getCertificates } from "./shared.js";
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
function getRandomColorPart() {
|
function getRandomColorPart() {
|
||||||
return Math.floor(Math.random() * 255);
|
return Math.floor(Math.random() * 255);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,9 +10,12 @@
|
|||||||
|
|
||||||
import { PKPass } from "passkit-generator";
|
import { PKPass } from "passkit-generator";
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import { app } from "./webserver.js";
|
import { app } from "./webserver.js";
|
||||||
import { getCertificates } from "./shared.js";
|
import { getCertificates } from "./shared.js";
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
app.route("/barcodes/:modelName").get(async (request, response) => {
|
app.route("/barcodes/:modelName").get(async (request, response) => {
|
||||||
const passName =
|
const passName =
|
||||||
request.params.modelName +
|
request.params.modelName +
|
||||||
|
|||||||
@@ -8,10 +8,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import path from "node:path";
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
import { PKPass } from "passkit-generator";
|
import { PKPass } from "passkit-generator";
|
||||||
import { app } from "./webserver.js";
|
import { app } from "./webserver.js";
|
||||||
import { getCertificates } from "./shared.js";
|
import { getCertificates } from "./shared.js";
|
||||||
|
|
||||||
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
app.route("/expirationDate/:modelName").get(async (request, response) => {
|
app.route("/expirationDate/:modelName").get(async (request, response) => {
|
||||||
if (!request.query.fn) {
|
if (!request.query.fn) {
|
||||||
response.send(
|
response.send(
|
||||||
|
|||||||
Reference in New Issue
Block a user