From 95015639248a7742c052598f17926f031ba8a6e0 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Thu, 2 May 2024 03:46:04 +0300 Subject: [PATCH 01/10] fix export to word --- server.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/server.js b/server.js index 616ec1d..cb0bdf4 100644 --- a/server.js +++ b/server.js @@ -336,8 +336,11 @@ nextApp placeOfEvent: shift.cartEvent.location.name, time: time, //bold the text after - in the notes - notes: shift.notes.substring(0, shift.notes.indexOf("-") + 1), - notes_bold: shift.notes.substring(shift.notes.indexOf("-") + 1), + //notes: shift.notes.substring(0, shift.notes.indexOf("-") + 1), + //notes_bold: shift.notes.substring(shift.notes.indexOf("-") + 1), + notes: shift.assignments.some(a => a.isWithTransport) ? "Транспорт: " : "", + notes_bold: shift.assignments.filter(a => a.isWithTransport).map(a => common.getInitials(a.publisher.firstName + " " + a.publisher.lastName)).join(", "), + names: shift.assignments .map((assignment) => { return ( From ce715aa6cf59188d94f5dc869efddc7cee1f16e9 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Thu, 2 May 2024 21:07:20 +0300 Subject: [PATCH 02/10] proper HTML --- pages/auth/signin.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/pages/auth/signin.tsx b/pages/auth/signin.tsx index ce655e3..8a43446 100644 --- a/pages/auth/signin.tsx +++ b/pages/auth/signin.tsx @@ -70,15 +70,16 @@ export default function SignIn({ csrfToken }) { src="https://authjs.dev/img/providers/google.svg" className="mr-2" /> Влез чрез Google + {/* Apple Sign-In Button */} + {/* Add more buttons for other SSO providers here in similar style */} + - {/* Apple Sign-In Button */} - {/* Divider (Optional) */}
From 4443f178bf1ba9bf914e30baf55a0e0ed6fad522 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Thu, 2 May 2024 21:13:45 +0300 Subject: [PATCH 03/10] setup nextauth --- package.json | 2 +- pages/api/auth/[...nextauth].ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 89803af..87076ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pwwa", - "version": "1.2.0", + "version": "1.2.2", "private": true, "description": "JW PW Web App", "repository": "http://git.d-popov.com/popov/next-cart-app.git", diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 220d66e..faf0f3c 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -45,10 +45,10 @@ export const authOptions: NextAuthOptions = { } } }), - // AppleProvider({ - // clientId: process.env.APPLE_APP_ID, - // clientSecret: process.env.APPLE_SECRET - // }), + AppleProvider({ + clientId: process.env.APPLE_APP_ID, + clientSecret: process.env.APPLE_SECRET + }), // AzureADProvider({ // clientId: process.env.AZURE_AD_CLIENT_ID, // clientSecret: process.env.AZURE_AD_CLIENT_SECRET, From 367ca6615c18fbd1aea19cac1f0757b0d1d8ad6e Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Fri, 3 May 2024 01:03:08 +0300 Subject: [PATCH 04/10] appleID: try dynamic secret --- .env | 6 ++++-- pages/api/auth/[...nextauth].ts | 23 +++++++++++++++-------- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.env b/.env index 52016e2..f86855c 100644 --- a/.env +++ b/.env @@ -24,6 +24,9 @@ AZURE_AD_TENANT_ID=f69d1a93-bfba-498a-9b60-e87c1bc26276 APPLE_TEAM_ID=XC57P9SXDK APPLE_KEY_ID=TB3V355G5Y +APPLE_APP_ID=com.mwhitnessing.sofia +APPLE_SECRET=eyJhbGciOiJFUzI1NiIsImtpZCI6IjlRVzkyNkZTSzkifQ.eyJhdWQiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiaXNzIjoiWEM1N1A5U1hESyIsImlhdCI6MTcxNDY3MDQxOSwiZXhwIjoxNzMwMjIyNDIwLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.KUW2roM2MAyfe2RphAoeAB-OK4LolGcO347SCxIocM3RXR0Z_5GVwu0BJiHwh2nO4WGXi2xHJgBvuwZhdAPWug +APPLE_PK=-----BEGIN PRIVATE KEY-----\nMIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQgLJtuaml9xsCzcKSH\nRvaTqmxoQgPzxXtk9jWZGU90FQCgCgYIKoZIzj0DAQehRANCAATM910/AhLshLvn\nWbmWi7F580AqLoNvHKHB4A1bccz+9QSvj0AcYA4J0BiMFfQrhXC5/SKEe7I0pDcv\nn4UlL3Sx\n-----END PRIVATE KEY----- # APPLE_APP_ID=com.mwhitnessing.sofia # APPLE_SECRET=eyJhbGciOiJFUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6IlRCM1YzNTVHNVkifQ.eyJpYXQiOjE3MTMzMDQ1OTMsImV4cCI6MTcyODg1NjU5MywiYXVkIjoiaHR0cHM6Ly9hcHBsZWlkLmFwcGxlLmNvbSIsImlzcyI6IlhDNTdQOVNYREsiLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.iO2prjQ_4P7F17R7LTJfG9zHluj59uUtm8DA1LbK49jVBMeGHQP_Az7s_yU5D-GeMHSwU7VnVHcaVKiGWT_Yjg @@ -32,8 +35,7 @@ APPLE_KEY_ID=TB3V355G5Y #APPLE_APP_ID=XC57P9SXDK.com.mwhitnessing.sofia #APPLE_SECRET=eyJhbGciOiJFUzI1NiIsImtpZCI6IlRCM1YzNTVHNVkifQ.eyJhdWQiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiaXNzIjoiWEM1N1A5U1hESyIsImlhdCI6MTcxMjE3ODM0MiwiZXhwIjoxNzI3NzMwMzQzLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.XceA0qUQi0tXg0GM_LkJkpNU5AqXLiSB2JlEVbHCB_nINbQTWkjtoWxfqmvdOkIzwKtvdQ8FFb-crK9no9Bbbw # to generate -APPLE_APP_ID=com.mwhitnessing.sofia -APPLE_SECRET=eyJhbGciOiJFUzI1NiIsImtpZCI6IjlRVzkyNkZTSzkifQ.eyJhdWQiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiaXNzIjoiWEM1N1A5U1hESyIsImlhdCI6MTcxNDY3MDQxOSwiZXhwIjoxNzMwMjIyNDIwLCJzdWIiOiJjb20ubXdoaXRuZXNzaW5nLnNvZmlhIn0.KUW2roM2MAyfe2RphAoeAB-OK4LolGcO347SCxIocM3RXR0Z_5GVwu0BJiHwh2nO4WGXi2xHJgBvuwZhdAPWug + diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index faf0f3c..cb0edee 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -46,8 +46,15 @@ export const authOptions: NextAuthOptions = { } }), AppleProvider({ + // clientId: process.env.APPLE_APP_ID, + // clientSecret: process.env.APPLE_SECRET clientId: process.env.APPLE_APP_ID, - clientSecret: process.env.APPLE_SECRET + clientSecret: { + appleId: process.env.APPLE_APP_ID, + teamId: process.env.APPLE_TEAM_ID, + privateKey: process.env.APPLE_PK, + keyId: process.env.APPLE_KEY_ID, + } }), // AzureADProvider({ // clientId: process.env.AZURE_AD_CLIENT_ID, @@ -251,13 +258,13 @@ export const authOptions: NextAuthOptions = { }; }, }, - pages: { - signIn: "/auth/signin", - signOut: "/auth/signout", - error: "/message", // Error code passed in query string as ?error= - verifyRequest: "/auth/verify-request", // (used for check email message) - newUser: null // If set, new users will be directed here on first sign in - }, + // pages: { + // signIn: "/auth/signin", + // signOut: "/auth/signout", + // error: "/message", // Error code passed in query string as ?error= + // verifyRequest: "/auth/verify-request", // (used for check email message) + // newUser: null // If set, new users will be directed here on first sign in + // }, } export default NextAuth(authOptions) \ No newline at end of file From 75573340f85470ba8cbceb4af29d1db0932e0e45 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Fri, 3 May 2024 16:47:28 +0300 Subject: [PATCH 05/10] crf fix when logged out --- package-lock.json | 6 ------ pages/auth/signin.tsx | 4 +++- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index e6292bd..1dbaf43 100644 --- a/package-lock.json +++ b/package-lock.json @@ -26,7 +26,6 @@ "axios": "^1.6.7", "axios-jwt": "^4.0.2", "bcrypt": "^5.1.1", - "bcryptjs": "^2.4.3", "date-fns": "^3.3.1", "docx": "^8.5.0", "docx-templates": "^4.11.4", @@ -5499,11 +5498,6 @@ "tweetnacl": "^0.14.3" } }, - "node_modules/bcryptjs": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/bcryptjs/-/bcryptjs-2.4.3.tgz", - "integrity": "sha512-V/Hy/X9Vt7f3BbPJEi8BdVFMByHi+jNXrYkW3huaybV/kQ0KJg0Y6PkEMbn+zeT+i+SiKZ/HMqJGIIt4LZDqNQ==" - }, "node_modules/bidi-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.0.3.tgz", diff --git a/pages/auth/signin.tsx b/pages/auth/signin.tsx index ce655e3..a22b01a 100644 --- a/pages/auth/signin.tsx +++ b/pages/auth/signin.tsx @@ -131,9 +131,11 @@ export default function SignIn({ csrfToken }) { // This gets called on every request export async function getServerSideProps(context) { + const csrfToken = await getCsrfToken(context); return { props: { - csrfToken: await getCsrfToken(context), + ...(csrfToken ? { csrfToken } : {}), }, }; } + From 43a4f93bb3be29e15f800fca87b60b98892a7e40 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Fri, 3 May 2024 21:18:08 +0300 Subject: [PATCH 06/10] email subscription labels update --- components/publisher/PublisherForm.js | 58 ++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 9 deletions(-) diff --git a/components/publisher/PublisherForm.js b/components/publisher/PublisherForm.js index 1635270..fc4b42f 100644 --- a/components/publisher/PublisherForm.js +++ b/components/publisher/PublisherForm.js @@ -246,15 +246,54 @@ export default function PublisherForm({ item, me }) {
-
- {/* notifications */} -
- - - - - {/* prompt to install PWA */} -
+ + {/* notifications */} +
+
+ Известия по имейл +
+
+ + +
+
+ + +
+
+ + +
+
+
{/* button to install PWA */} @@ -267,6 +306,7 @@ export default function PublisherForm({ item, me }) { {/* ADMINISTRATORS ONLY */}
+ {/* prompt to install PWA */}
From 924928178548c1611091146425767ac329b6016b Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 4 May 2024 00:51:31 +0300 Subject: [PATCH 07/10] fix searchreplacemet UI on small screens --- components/publisher/SearchReplacement.js | 75 ++++++++++++----------- 1 file changed, 39 insertions(+), 36 deletions(-) diff --git a/components/publisher/SearchReplacement.js b/components/publisher/SearchReplacement.js index 5d69bf1..9f9b545 100644 --- a/components/publisher/SearchReplacement.js +++ b/components/publisher/SearchReplacement.js @@ -85,43 +85,46 @@ function ConfirmationModal({ isOpen, onClose, onConfirm, subscribedPublishers, a return (
-
+

Можете да изпратите заявка за заместник до следните групи:

-
- -
-
- +
+
+ handleToggleGroup('subscribedPublishers')} + /> + +
+
+ +
+
+ handleToggleGroup('availablePublishers')} + /> + +
+
+ +