From 82c3ac2aadf13bba18cb30e7705b9f02a7322cce Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sun, 4 Dec 2022 16:34:48 -0500 Subject: [PATCH] Discord wasn't aborting correctly when the key wasn't configured. Livestream test still used an old schema. Configs needed to be updated in commands/templates --- README.md | 2 ++ commands/templates/client/config.js | 31 +++++++++++++++++--------- commands/templates/emails/config.js | 24 ++++++++++---------- commands/templates/secrets/config.json | 14 +++++++++--- lib/queues.js | 4 ++-- queues/discord.js | 2 +- tests/ui/livestream.js | 1 - 7 files changed, 48 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 61c0c3c..83400a9 100644 --- a/README.md +++ b/README.md @@ -17,3 +17,5 @@ If this doesn't work then this might https://github.com/nodejs/node-gyp/blob/mai ``` npm explore npm/node_modules/@npmcli/run-script -g -- npm_config_global=false npm install node-gyp@latest ``` + +There's also an issue with installing node-pre-gyp where it seems you need to install @mapbox/node-pre-gyp and also node-pre-gyp. diff --git a/commands/templates/client/config.js b/commands/templates/client/config.js index 0b0c558..f3123ae 100644 --- a/commands/templates/client/config.js +++ b/commands/templates/client/config.js @@ -4,28 +4,37 @@ * is allowed to see. Anything else should go in lib/config.js and * *never* import that file in any client/* files. */ -export const fake_payments = false; +export const fake_payments = true; export const webtorrent = { - announce: "https://localhost:5001/tracker", use_dht: false, - private: true, - tracker: true, - webSeeds: true, - maxConns: 50 + private: true } -export const btcpay_url = 'https://btc.yourpaymentsite.com/modal/btcpay.js'; +export const product = { + price: 20, + currency: 'USD', + description: 'Super Product', + id: 1 +} + +export const btcpay_url = 'https://pay.yoursite.com/modal/btcpay.js'; -export const product_id = 1; +// brought over from ljsthw but need to adapt to the new product setting +export const product_id = product.id; export const base_host = 'http://localhost:5001'; export const support_email = "help@yourcompany.com"; export const paypal_public = { + disabled: true, + client_id: "YOUR PAYPAL PUBLIC KEY", +} + +export const stripe_public = { disabled: false, - client_id: "your_client_key_NOT_secret_key", + client_id: "pk_MhuNltOn2Gq5VBZ9lMNxv4CB3wFOa" } export const darkmode_default = "light"; @@ -34,6 +43,6 @@ export const register_enabled = true; export const log_levels = ["debug", "warn", "info", "error", "table", "assert"]; -export const twitter_user = "@yourtwitter"; +export const twitter_user = "@lzsthw"; -export const price = 59; +export const site_name = "localhost:5001"; diff --git a/commands/templates/emails/config.js b/commands/templates/emails/config.js index e29dd16..f3c929d 100644 --- a/commands/templates/emails/config.js +++ b/commands/templates/emails/config.js @@ -1,17 +1,17 @@ export const company = { - owner: 'Person A. People', - product: 'Awesome Business', + owner: 'Cool Coder', + product: 'Super Product', copyright_date: '2021', - name: 'BizTime, LLC', - street: '1234 Weird Street Address', - zip_code: '33333', - city: 'Big City', - state: 'BC', + name: 'Super Company, LLC', + street: 'Address Address', + zip_code: '99999', + city: 'City', + state: 'CC', country: 'USA', phone: '1-800-NO-WAY', - mail: 'payments@biztime.com', - website: 'localhost:5001', - credit_line: "CRDT", - forum: "talk.biztime.com", - unsubscribe: "https://localhost:5001/client/#/email/unsubscribe/", + mail: '"Person from PRODUCT" ', + website: 'supercool.com', + credit_line: "SUERPCOOL", + forum: "supercool.com", + unsubscribe: "https://supercool.com/client/#/email/unsubscribe/", } diff --git a/commands/templates/secrets/config.json b/commands/templates/secrets/config.json index aa366b1..6bead3d 100644 --- a/commands/templates/secrets/config.json +++ b/commands/templates/secrets/config.json @@ -1,11 +1,19 @@ { "paypal_private": { "email": "payments@thesite.com", - "client_id": "", - "secret": "", - "disabled": false + "client_id": "PUBLICCLIENTID", + "secret": "SECRETKEY", + "disabled": true }, + "stripe_private": { + "email": "payments@thesite.com", + "client_id": "pk_YOURPUBLICID", + "secret": "YOURSECRET", + "endpoint_secret": "ENDPOINTSECRET", + "api_version": "2022-08-01", + "disabled": true + }, "btcpay_private": { "url": "https://yourbtcpayserver.com", "auth": "your BTC pay auth key", diff --git a/lib/queues.js b/lib/queues.js index b43bba1..1023fb7 100644 --- a/lib/queues.js +++ b/lib/queues.js @@ -17,9 +17,9 @@ export const send_welcome = (user) => { mail.add({user}); } -export const send_receipt = (user, payment_id, course_id) => { +export const send_receipt = (user, payment_id, product_id) => { const mail = create("mail/receipt"); - mail.add({user, payment_id, course_id}); + mail.add({user, payment_id, product_id}); } export const send_reset = (user, ip_address, browser) => { diff --git a/queues/discord.js b/queues/discord.js index 7a97c2e..d74e643 100644 --- a/queues/discord.js +++ b/queues/discord.js @@ -38,7 +38,7 @@ const load_guild_channel = async (client) => { } log.info("Connecting to discord server..."); -client.login(discord.token); +await client.login(discord.token); const [guild, channel] = await load_guild_channel(client); diff --git a/tests/ui/livestream.js b/tests/ui/livestream.js index 4aaa21c..71c8406 100644 --- a/tests/ui/livestream.js +++ b/tests/ui/livestream.js @@ -7,7 +7,6 @@ const fixture = { "description": "Come hang out and watch me survive the first release of Learn JS the Hard Way.", "starts_on": "2022-04-15 14:00:00-04", "is_free": 0, - "course_id": 1, "state": "pending", "viewer_count": 206, "episode": 1