diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a760ca2..1a055ee7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [v3.4.1] - 2023-09-01 + +### Added + +- allow dev tools in prod builds of electron + +### Changed + +- refactored user logging and email system + +### Fixed + +- electron build failing +- electron build to handle SameSite attribute on session cookie + ## [v3.4.0] - 2023-08-31 ### Removed diff --git a/memberportal/access/models.py b/memberportal/access/models.py index 4f76fbc6..917ba30a 100644 --- a/memberportal/access/models.py +++ b/memberportal/access/models.py @@ -5,7 +5,6 @@ from django.db import models from datetime import timedelta from django.utils import timezone -from membermatters.helpers import log_event import pytz from django.conf import settings from django.contrib import auth diff --git a/memberportal/api_billing/views.py b/memberportal/api_billing/views.py index 61d3e6ce..c91ced74 100644 --- a/memberportal/api_billing/views.py +++ b/memberportal/api_billing/views.py @@ -13,7 +13,6 @@ from services import canvas, sms from services.emails import send_email_to_admin from constance import config -from membermatters.helpers import log_user_event from django.db.utils import OperationalError from sentry_sdk import capture_exception @@ -65,8 +64,8 @@ def get(self, request): if not customer_exists: try: - log_user_event( - request.user, "Attempting to create stripe customer.", "stripe" + request.user.log_event( + "Attempting to create stripe customer.", "stripe" ) customer = stripe.Customer.create( email=request.user.email, @@ -77,8 +76,7 @@ def get(self, request): profile.stripe_customer_id = customer.id profile.save() - log_user_event( - request.user, + request.user.log_event( f"Created stripe customer {request.user.profile.get_full_name()} (Stripe ID: {customer.id}).", "stripe", ) @@ -88,8 +86,7 @@ def get(self, request): return Response({"clientSecret": intent.client_secret}) except stripe.error.StripeError as e: - log_user_event( - request.user, + request.user.log_event( "Unknown stripe while saving payment details.", "stripe", request, @@ -105,8 +102,7 @@ def get(self, request): ) except Exception as e: - log_user_event( - request.user, + request.user.log_event( "Unknown other error while saving payment details.", "stripe", request, @@ -219,8 +215,7 @@ def create_subscription(attempts=0): attempts += 1 if attempts > 3: - log_user_event( - request.user, + request.user.log_event( "Too many attempts while creating subscription.", "stripe", "", @@ -249,8 +244,7 @@ def create_subscription(attempts=0): error["code"] == "resource_missing" and "default payment method" in error["message"] ): - log_user_event( - request.user, + request.user.log_event( "InvalidRequestError (missing default payment method) from Stripe while creating subscription.", "stripe", error, @@ -270,8 +264,7 @@ def create_subscription(attempts=0): error["code"] == "resource_missing" and "a similar object exists in live mode" in error["message"] ): - log_user_event( - request.user, + request.user.log_event( "InvalidRequestError (used test key with production object) from Stripe while " "creating subscription.", "stripe", @@ -287,8 +280,7 @@ def create_subscription(attempts=0): ) else: - log_user_event( - request.user, + request.user.log_event( "InvalidRequestError from Stripe while creating subscription.", "stripe", error, @@ -302,8 +294,7 @@ def create_subscription(attempts=0): ) except Exception as e: - log_user_event( - request.user, + request.user.log_event( "InvalidRequestError from Stripe while creating subscription.", "stripe", e, @@ -326,8 +317,7 @@ def create_subscription(attempts=0): request.user.profile.subscription_status = "active" request.user.profile.save() - log_user_event( - request.user, + request.user.log_event( "Successfully created subscription in Stripe.", "stripe", "", @@ -337,8 +327,7 @@ def create_subscription(attempts=0): elif new_subscription.status == "incomplete": # if we got here, that means the subscription wasn't successfully created - log_user_event( - request.user, + request.user.log_event( f"Failed to create subscription in Stripe with status {new_subscription.status}.", "stripe", "", @@ -349,8 +338,7 @@ def create_subscription(attempts=0): ) else: - log_user_event( - request.user, + request.user.log_event( f"Failed to create subscription in Stripe with status {new_subscription.status}.", "stripe", "", diff --git a/memberportal/api_general/views.py b/memberportal/api_general/views.py index edc98cfa..a21a6d89 100644 --- a/memberportal/api_general/views.py +++ b/memberportal/api_general/views.py @@ -258,16 +258,20 @@ def post(self, request): return Response(status=status.HTTP_400_BAD_REQUEST) try: - user = Profile.objects.get(rfid=body.get("cardId")).user + kiosk = Kiosk.objects.get(kiosk_id=body.get("kioskId")) - except Profile.DoesNotExist: + except Kiosk.DoesNotExist: return Response(status=status.HTTP_401_UNAUTHORIZED) - kiosk = Kiosk.objects.get(kiosk_id=body.get("kioskId")) - if not kiosk.authorised: return Response(status=status.HTTP_403_FORBIDDEN) + try: + user = Profile.objects.get(rfid=body.get("cardId")).user + + except Profile.DoesNotExist: + return Response(status=status.HTTP_401_UNAUTHORIZED) + if not user.email_verified: return Response( {"message": "error.emailNotVerified"}, status=status.HTTP_403_FORBIDDEN diff --git a/memberportal/api_member_tools/views.py b/memberportal/api_member_tools/views.py index c79e2f28..252bb550 100644 --- a/memberportal/api_member_tools/views.py +++ b/memberportal/api_member_tools/views.py @@ -1,7 +1,6 @@ from profile.models import User, Profile from api_meeting.models import Meeting from constance import config -from membermatters.helpers import log_user_event from services.emails import send_single_email from random import shuffle import requests @@ -133,8 +132,7 @@ def post(self, request): response = requests.request("POST", url, params=querystring) if response.status_code == 200: - log_user_event( - request.user, + request.user.log_event( "Submitted issue: " + title + " Content: " + description, "generic", ) diff --git a/memberportal/memberbucks/views.py b/memberportal/memberbucks/views.py index 7a0c533f..cc39e94e 100644 --- a/memberportal/memberbucks/views.py +++ b/memberportal/memberbucks/views.py @@ -1,6 +1,5 @@ from django.core.exceptions import ObjectDoesNotExist from django.utils import timezone -from membermatters.helpers import log_user_event from .models import MemberBucks from profile.models import Profile, User from constance import config @@ -70,8 +69,7 @@ def post(self, request, rfid=None, amount=None, description="No Description"): subject, subject, subject, message ) - log_user_event( - profile.user, + profile.user.log_event( f"Successfully debited ${amount} from {config.MEMBERBUCKS_NAME} account.", "memberbucks", ) @@ -81,8 +79,7 @@ def post(self, request, rfid=None, amount=None, description="No Description"): ) else: - log_user_event( - profile.user, + profile.user.log_event( f"Not enough funds to debit ${amount} from {config.MEMBERBUCKS_NAME} account.", "memberbucks", ) diff --git a/memberportal/membermatters/helpers.py b/memberportal/membermatters/helpers.py deleted file mode 100644 index 0a408ade..00000000 --- a/memberportal/membermatters/helpers.py +++ /dev/null @@ -1,11 +0,0 @@ -from profile.models import EventLog, UserEventLog - - -def log_user_event(user, description, event_type, data=""): - UserEventLog( - description=description, logtype=event_type, user=user, data=data - ).save() - - -def log_event(description, event_type, data=""): - EventLog(description=description, logtype=event_type, data=data).save() diff --git a/memberportal/profile/models.py b/memberportal/profile/models.py index 7f39308a..bc3bd94b 100644 --- a/memberportal/profile/models.py +++ b/memberportal/profile/models.py @@ -17,8 +17,8 @@ from api_admin_tools.models import MemberTier, PaymentPlan import json import uuid -from postmarker.core import PostmarkClient import logging +from services.emails import send_single_email from services import sms logger = logging.getLogger("app") @@ -57,8 +57,8 @@ class EventLog(Log): pass -# this needs to be here because it relies on the models defined above -from membermatters.helpers import log_user_event +def log_event(description, event_type, data=""): + EventLog(description=description, logtype=event_type, data=data).save() class UserManager(BaseUserManager): @@ -140,32 +140,13 @@ def is_admin(self): "Is the user a admin member?" return self.admin - def __send_email(self, subject, body): - # TODO: move this to celery - - if config.POSTMARK_API_KEY: - postmark = PostmarkClient(server_token=config.POSTMARK_API_KEY) - postmark.emails.send( - From=config.EMAIL_DEFAULT_FROM, - To=self.email, - Subject=subject, - HtmlBody=body, - ) - log_user_event( - self, - "Sent email with subject: " + subject, - "email", - "Email content: " + body, - ) - else: - log_user_event( - self, - "Email NOT sent due to configuration issue: " + subject, - "email", - "Email content: " + body, - ) + def log_event(description, event_type, data=""): + UserEventLog( + description=description, logtype=event_type, user=user, data=data + ).save() - return True + def __send_email(self, subject, body): + return send_single_email(self, self.email, subject, subject, body) def email_notification(self, subject, title, preheader, message): email_vars = {"preheader": preheader, "title": title, "message": message} @@ -245,7 +226,7 @@ def email_enable_member(self): return False def reset_password(self): - log_user_event(self, "Password reset requested", "profile") + self.log_event("Password reset requested", "profile") self.password_reset_key = uuid.uuid4() self.password_reset_expire = timezone.now() + timedelta(hours=24) self.save() @@ -381,14 +362,12 @@ def sync_access(self): def deactivate(self, request=None): if request: - log_user_event( - self.user, + self.user.log_event( request.user.profile.get_full_name() + " deactivated member", "profile", ) else: - log_user_event( - self.user, + self.user.log_event( "system deactivated member", "profile", ) @@ -403,14 +382,12 @@ def deactivate(self, request=None): def activate(self, request=None): if request: - log_user_event( - self.user, + self.user.log_event( request.user.profile.get_full_name() + " activated member", "profile", ) else: - log_user_event( - self.user, + self.user.log_event( "system activated member", "profile", ) @@ -440,22 +417,10 @@ def email_profile_to(self, to_email): ) subject = "A new member signed up! ({})".format(self.get_full_name()) - postmark = PostmarkClient(server_token=config.POSTMARK_API_KEY) - postmark.emails.send( - From=config.EMAIL_DEFAULT_FROM, - To=to_email, - Subject=subject, - HtmlBody=email_string, + return send_single_email( + self.user, to_email, subject=subject, title=subject, message=email_string ) - log_user_event( - self.user, - "Sent email with subject: " + subject, - "email", - "Email content: " + email_string, - ) - return True - def get_logs(self): return UserEventLog.objects.filter(user=self.user) diff --git a/memberportal/services/emails.py b/memberportal/services/emails.py index 50c2bec7..7f77873b 100644 --- a/memberportal/services/emails.py +++ b/memberportal/services/emails.py @@ -1,6 +1,5 @@ from django.template.loader import render_to_string from django.utils.html import escape -from membermatters.helpers import log_user_event from constance import config from postmarker.core import PostmarkClient @@ -32,40 +31,21 @@ def send_single_email( ReplyTo=reply_to or config.EMAIL_DEFAULT_FROM, ) - log_user_event( - user, - "Sent email with subject: " + subject, - "email", - "Email content: " + message, - ) + if user: + user.log_event( + "Sent email with subject: " + subject, + "email", + "Email content: " + message, + ) else: - log_user_event( - self, - "Email NOT sent due to configuration issue: " + subject, - "email", - "Email content: " + message, - ) + if user: + user.log_event( + "Email NOT sent due to configuration issue: " + subject, + "email", + "Email content: " + message, + ) return True def send_email_to_admin(subject: object, title: object, message: object, reply_to=None): - # TODO: move to celery - - message = escape(message) - message = message.replace("~br~", "
") - email_vars = {"preheader": "", "title": title, "message": message} - email_string = render_to_string( - "email_without_button.html", {"email": email_vars, "config": config} - ) - - if config.POSTMARK_API_KEY: - postmark = PostmarkClient(server_token=config.POSTMARK_API_KEY) - postmark.emails.send( - From=config.EMAIL_DEFAULT_FROM, - To=config.EMAIL_ADMIN, - Subject=subject, - HtmlBody=email_string, - ReplyTo=reply_to or config.EMAIL_DEFAULT_FROM, - ) - else: - print("Email NOT sent due to configuration issue: " + subject) + return send_single_email(config.EMAIL_ADMIN, subject, title, message, reply_to) diff --git a/package.json b/package.json index 16903583..4d3b06e9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "membermatters", - "version": "3.4.0", + "version": "3.4.1", "devDependencies": { "eslint-webpack-plugin": "^3.1.1", "husky": "^6.0.0", diff --git a/src-frontend/package-lock.json b/src-frontend/package-lock.json index 10ef486b..5f126a4c 100644 --- a/src-frontend/package-lock.json +++ b/src-frontend/package-lock.json @@ -1,12 +1,12 @@ { "name": "frontend", - "version": "3.3.0", + "version": "3.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "frontend", - "version": "3.3.0", + "version": "3.4.0", "dependencies": { "@capacitor/core": "^3.5.0", "@capacitor/splash-screen": "^1.2.2", @@ -59,10 +59,10 @@ "autoprefixer": "^10.4.2", "babel-eslint": "^10.0.1", "devtron": "^1.4.0", - "electron": "^18.3.7", + "electron": "^26.1.0", "electron-debug": "^3.1.0", "electron-devtools-installer": "^3.0.0", - "electron-packager": "^15.5.1", + "electron-packager": "^17.1.2", "eslint": "^8.14.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.5.0", @@ -2171,25 +2171,99 @@ } }, "node_modules/@electron/get": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.14.1.tgz", - "integrity": "sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-2.0.2.tgz", + "integrity": "sha512-eFZVFoRXb3GFGd7Ak7W4+6jBl9wBtiZ4AaYOse97ej6mKj5tkyO0dUnUChs1IhJZtx1BENo4/p4WUTXpi6vT+g==", "dev": true, "dependencies": { "debug": "^4.1.1", "env-paths": "^2.2.0", "fs-extra": "^8.1.0", - "got": "^9.6.0", + "got": "^11.8.5", "progress": "^2.0.3", "semver": "^6.2.0", "sumchecker": "^3.0.1" }, "engines": { - "node": ">=8.6" + "node": ">=12" }, "optionalDependencies": { - "global-agent": "^3.0.0", - "global-tunnel-ng": "^2.7.1" + "global-agent": "^3.0.0" + } + }, + "node_modules/@electron/get/node_modules/@sindresorhus/is": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.6.0.tgz", + "integrity": "sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sindresorhus/is?sponsor=1" + } + }, + "node_modules/@electron/get/node_modules/@szmarczak/http-timer": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-4.0.6.tgz", + "integrity": "sha512-4BAffykYOgO+5nzBWYwE3W90sBgLJoUPRWWcL8wlyiM8IB8ipJz3UMJ9KXQd1RKQXpKp8Tutn80HZtWsu2u76w==", + "dev": true, + "dependencies": { + "defer-to-connect": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/get/node_modules/cacheable-lookup": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", + "integrity": "sha512-2/kNscPhpcxrOigMZzbiWF7dz8ilhb/nIHU3EyZiXWXpeq/au8qJ8VhdftMkty3n7Gj6HIGalQG8oiBNB3AJgA==", + "dev": true, + "engines": { + "node": ">=10.6.0" + } + }, + "node_modules/@electron/get/node_modules/cacheable-request": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-7.0.4.tgz", + "integrity": "sha512-v+p6ongsrp0yTGbJXjgxPow2+DL93DASP4kXCDKb8/bwRtt9OEF3whggkkDkGNzgcWy2XaF4a8nZglC7uElscg==", + "dev": true, + "dependencies": { + "clone-response": "^1.0.2", + "get-stream": "^5.1.0", + "http-cache-semantics": "^4.0.0", + "keyv": "^4.0.0", + "lowercase-keys": "^2.0.0", + "normalize-url": "^6.0.1", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/get/node_modules/decompress-response": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", + "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "dev": true, + "dependencies": { + "mimic-response": "^3.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@electron/get/node_modules/defer-to-connect": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-2.0.1.tgz", + "integrity": "sha512-4tvttepXG1VaYGrRibk5EwJd1t4udunSOVMdLSAL6mId1ix438oPwPZMALY41FCijukO1L0twNcGsdzS7dHgDg==", + "dev": true, + "engines": { + "node": ">=10" } }, "node_modules/@electron/get/node_modules/fs-extra": { @@ -2206,6 +2280,65 @@ "node": ">=6 <7 || >=8" } }, + "node_modules/@electron/get/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "dependencies": { + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@electron/get/node_modules/got": { + "version": "11.8.6", + "resolved": "https://registry.npmjs.org/got/-/got-11.8.6.tgz", + "integrity": "sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g==", + "dev": true, + "dependencies": { + "@sindresorhus/is": "^4.0.0", + "@szmarczak/http-timer": "^4.0.5", + "@types/cacheable-request": "^6.0.1", + "@types/responselike": "^1.0.0", + "cacheable-lookup": "^5.0.3", + "cacheable-request": "^7.0.2", + "decompress-response": "^6.0.0", + "http2-wrapper": "^1.0.0-beta.5.2", + "lowercase-keys": "^2.0.0", + "p-cancelable": "^2.0.0", + "responselike": "^2.0.0" + }, + "engines": { + "node": ">=10.19.0" + }, + "funding": { + "url": "https://github.com/sindresorhus/got?sponsor=1" + } + }, + "node_modules/@electron/get/node_modules/http2-wrapper": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/http2-wrapper/-/http2-wrapper-1.0.3.tgz", + "integrity": "sha512-V+23sDMr12Wnz7iTcDeJr3O6AIxlnvT/bmaAAAP/Xda35C90p9599p0F1eHR/N1KILWSoWVAiOMFjBBXaXSMxg==", + "dev": true, + "dependencies": { + "quick-lru": "^5.1.1", + "resolve-alpn": "^1.0.0" + }, + "engines": { + "node": ">=10.19.0" + } + }, + "node_modules/@electron/get/node_modules/json-buffer": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", + "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", + "dev": true + }, "node_modules/@electron/get/node_modules/jsonfile": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", @@ -2215,10 +2348,73 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/@electron/get/node_modules/keyv": { + "version": "4.5.3", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.3.tgz", + "integrity": "sha512-QCiSav9WaX1PgETJ+SpNnx2PRRapJ/oRSXM4VO5OGYGSjrxbKPVFVhB3l2OCbLCk329N8qyAtsJjSjvVBWzEug==", + "dev": true, + "dependencies": { + "json-buffer": "3.0.1" + } + }, + "node_modules/@electron/get/node_modules/lowercase-keys": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", + "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/get/node_modules/mimic-response": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", + "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@electron/get/node_modules/normalize-url": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", + "integrity": "sha512-DlL+XwOy3NxAQ8xuC0okPgK46iuVNAK01YN7RueYBqqFeGsBjV9XmCAzAdgt+667bCl5kPh9EqKKDwnaPG1I7A==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@electron/get/node_modules/p-cancelable": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-2.1.1.tgz", + "integrity": "sha512-BZOr3nRQHOntUjTrH8+Lh54smKHoHyur8We1V8DSMVrl5A2malOOwuJRnKRDjSnkoeBh4at6BwEnb5I7Jl31wg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@electron/get/node_modules/responselike": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/responselike/-/responselike-2.0.1.tgz", + "integrity": "sha512-4gl03wn3hj1HP3yzgdI7d3lCkF95F21Pz4BPGvKHinyQzALR5CapwC8yIi0Rh58DEMQ/SguC03wFj2k0M/mHhw==", + "dev": true, + "dependencies": { + "lowercase-keys": "^2.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@electron/get/node_modules/semver": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", - "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", "dev": true, "bin": { "semver": "bin/semver.js" @@ -2233,6 +2429,81 @@ "node": ">= 4.0.0" } }, + "node_modules/@electron/notarize": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.4.tgz", + "integrity": "sha512-W5GQhJEosFNafewnS28d3bpQ37/s91CDWqxVchHfmv2dQSTWpOzNlUVQwYzC1ay5bChRV/A9BTL68yj0Pa+TSg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/@electron/notarize/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@electron/osx-sign": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@electron/osx-sign/-/osx-sign-1.0.5.tgz", + "integrity": "sha512-k9ZzUQtamSoweGQDV2jILiRIHUu7lYlJ3c6IEmjv1hC17rclE+eb9U+f6UFlOOETo0JzY1HNlXy4YOlCvl+Lww==", + "dev": true, + "dependencies": { + "compare-version": "^0.1.2", + "debug": "^4.3.4", + "fs-extra": "^10.0.0", + "isbinaryfile": "^4.0.8", + "minimist": "^1.2.6", + "plist": "^3.0.5" + }, + "bin": { + "electron-osx-flat": "bin/electron-osx-flat.js", + "electron-osx-sign": "bin/electron-osx-sign.js" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/@electron/osx-sign/node_modules/fs-extra": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@electron/osx-sign/node_modules/isbinaryfile": { + "version": "4.0.10", + "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-4.0.10.tgz", + "integrity": "sha512-iHrqe5shvBUcFbmZq9zOQHBoeOhZJu6RQGrDpBgenUm/Am+F3JM2MgQj+rK3Z601fzrL5gLZWtAPH2OBaSVcyw==", + "dev": true, + "engines": { + "node": ">= 8.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/gjtorikian/" + } + }, "node_modules/@electron/universal": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.3.4.tgz", @@ -4770,6 +5041,18 @@ "@types/node": "*" } }, + "node_modules/@types/cacheable-request": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/@types/cacheable-request/-/cacheable-request-6.0.3.tgz", + "integrity": "sha512-IQ3EbTzGxIigb1I3qPZc1rWJnH0BmSKv5QYTalEwweFvyBDLSAe24zP0le/hyi7ecGfZVlIVAg4BZqb8WBwKqw==", + "dev": true, + "dependencies": { + "@types/http-cache-semantics": "*", + "@types/keyv": "^3.1.4", + "@types/node": "*", + "@types/responselike": "^1.0.0" + } + }, "node_modules/@types/chrome": { "version": "0.0.208", "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.208.tgz", @@ -4949,6 +5232,15 @@ "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", "dev": true }, + "node_modules/@types/keyv": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@types/keyv/-/keyv-3.1.4.tgz", + "integrity": "sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/mime": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/@types/mime/-/mime-1.3.2.tgz", @@ -4996,6 +5288,15 @@ "integrity": "sha512-EEhsLsD6UsDM1yFhAvy0Cjr6VwmpMWqFBCb9w07wVugF7w9nfajxLuVmngTIpgS6svCnm6Vaw+MZhoDCKnOfsw==", "devOptional": true }, + "node_modules/@types/responselike": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@types/responselike/-/responselike-1.0.0.tgz", + "integrity": "sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/retry": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/@types/retry/-/retry-0.12.0.tgz", @@ -6325,7 +6626,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", - "devOptional": true, + "dev": true, "dependencies": { "normalize-path": "^3.0.0", "picomatch": "^2.0.4" @@ -6542,37 +6843,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/asar": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/asar/-/asar-3.2.0.tgz", - "integrity": "sha512-COdw2ZQvKdFGFxXwX3oYh2/sOsJWJegrdJCGxnN4MZ7IULgRBp9P6665aqj9z1v9VwP4oP1hRBojRDQ//IGgAg==", - "deprecated": "Please use @electron/asar moving forward. There is no API change, just a package name change", - "dev": true, - "dependencies": { - "chromium-pickle-js": "^0.2.0", - "commander": "^5.0.0", - "glob": "^7.1.6", - "minimatch": "^3.0.4" - }, - "bin": { - "asar": "bin/asar.js" - }, - "engines": { - "node": ">=10.12.0" - }, - "optionalDependencies": { - "@types/glob": "^7.1.1" - } - }, - "node_modules/asar/node_modules/commander": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-5.1.0.tgz", - "integrity": "sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -7400,7 +7670,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "devOptional": true, + "dev": true, "engines": { "node": ">=8" } @@ -8007,7 +8277,7 @@ "version": "3.5.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "devOptional": true, + "dev": true, "funding": [ { "type": "individual", @@ -8397,54 +8667,15 @@ } }, "node_modules/compression/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "engines": [ - "node >= 0.8" - ], - "dependencies": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "node_modules/concat-stream/node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", - "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/concat-stream/node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "dependencies": { - "safe-buffer": "~5.1.0" - } + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/config-chain": { "version": "1.1.13", @@ -10073,21 +10304,21 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" }, "node_modules/electron": { - "version": "18.3.15", - "resolved": "https://registry.npmjs.org/electron/-/electron-18.3.15.tgz", - "integrity": "sha512-frkBt8skyo8SmlG4TbByDxZw6/tqttRYYIBaeTBfkoG18OyD59IVwVaXXHO8UYKB5/1C2Rce0Gj6uoxlAHQHzQ==", + "version": "26.1.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-26.1.0.tgz", + "integrity": "sha512-qEh19H09Pysn3ibms5nZ0haIh5pFoOd7/5Ww7gzmAwDQOulRi8Sa2naeueOyIb1GKpf+6L4ix3iceYRAuA5r5Q==", "dev": true, "hasInstallScript": true, "dependencies": { - "@electron/get": "^1.13.0", - "@types/node": "^16.11.26", - "extract-zip": "^1.0.3" + "@electron/get": "^2.0.0", + "@types/node": "^18.11.18", + "extract-zip": "^2.0.1" }, "bin": { "electron": "cli.js" }, "engines": { - "node": ">= 8.6" + "node": ">= 12.20.55" } }, "node_modules/electron-debug": { @@ -10139,101 +10370,23 @@ "keyboardevents-areequal": "^0.2.1" } }, - "node_modules/electron-notarize": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/electron-notarize/-/electron-notarize-1.2.2.tgz", - "integrity": "sha512-ZStVWYcWI7g87/PgjPJSIIhwQXOaw4/XeXU+pWqMMktSLHaGMLHdyPPN7Cmao7+Cr7fYufA16npdtMndYciHNw==", - "deprecated": "Please use @electron/notarize moving forward. There is no API change, just a package name change", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "fs-extra": "^9.0.1" - }, - "engines": { - "node": ">= 10.0.0" - } - }, - "node_modules/electron-notarize/node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", - "dev": true, - "dependencies": { - "at-least-node": "^1.0.0", - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/electron-osx-sign": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/electron-osx-sign/-/electron-osx-sign-0.5.0.tgz", - "integrity": "sha512-icoRLHzFz/qxzDh/N4Pi2z4yVHurlsCAYQvsCSG7fCedJ4UJXBS6PoQyGH71IfcqKupcKeK7HX/NkyfG+v6vlQ==", - "deprecated": "Please use @electron/osx-sign moving forward. Be aware the API is slightly different", - "dev": true, - "dependencies": { - "bluebird": "^3.5.0", - "compare-version": "^0.1.2", - "debug": "^2.6.8", - "isbinaryfile": "^3.0.2", - "minimist": "^1.2.0", - "plist": "^3.0.1" - }, - "bin": { - "electron-osx-flat": "bin/electron-osx-flat.js", - "electron-osx-sign": "bin/electron-osx-sign.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/electron-osx-sign/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/electron-osx-sign/node_modules/isbinaryfile": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/isbinaryfile/-/isbinaryfile-3.0.3.tgz", - "integrity": "sha512-8cJBL5tTd2OS0dM4jz07wQd5g0dCCqIhUxPIGtZfa5L6hWlvV5MHTITy/DBAsF+Oe2LS1X3krBUhNwaGUWpWxw==", - "dev": true, - "dependencies": { - "buffer-alloc": "^1.2.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/electron-osx-sign/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, "node_modules/electron-packager": { - "version": "15.5.2", - "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-15.5.2.tgz", - "integrity": "sha512-8zUdkSONn0jomu/efqoxApGzgqIb56ooMs671HeB/BXTPnWcWvqpEY08g16PL6ok2ymA5zPj8vmUszLrq99F0Q==", + "version": "17.1.2", + "resolved": "https://registry.npmjs.org/electron-packager/-/electron-packager-17.1.2.tgz", + "integrity": "sha512-XofXdikjYI7MVBcnXeoOvRR+yFFFHOLs3J7PF5KYQweigtgLshcH4W660PsvHr4lYZ03JBpLyEcUB8DzHZ+BNw==", "dev": true, "dependencies": { - "@electron/get": "^1.6.0", - "@electron/universal": "^1.2.1", - "asar": "^3.1.0", + "@electron/asar": "^3.2.1", + "@electron/get": "^2.0.0", + "@electron/notarize": "^1.2.3", + "@electron/osx-sign": "^1.0.5", + "@electron/universal": "^1.3.2", "cross-spawn-windows-exe": "^1.2.0", "debug": "^4.0.1", - "electron-notarize": "^1.1.1", - "electron-osx-sign": "^0.5.0", "extract-zip": "^2.0.0", "filenamify": "^4.1.0", - "fs-extra": "^10.1.0", - "galactus": "^0.2.1", + "fs-extra": "^11.1.0", + "galactus": "^1.0.0", "get-package-info": "^1.0.0", "junk": "^3.1.0", "parse-author": "^2.0.0", @@ -10241,76 +10394,18 @@ "rcedit": "^3.0.1", "resolve": "^1.1.6", "semver": "^7.1.3", - "yargs-parser": "^20.2.9" + "yargs-parser": "^21.1.1" }, "bin": { "electron-packager": "bin/electron-packager.js" }, "engines": { - "node": ">= 10.12.0" + "node": ">= 14.17.5" }, "funding": { "url": "https://github.com/electron/electron-packager?sponsor=1" } }, - "node_modules/electron-packager/node_modules/extract-zip": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", - "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", - "dev": true, - "dependencies": { - "debug": "^4.1.1", - "get-stream": "^5.1.0", - "yauzl": "^2.10.0" - }, - "bin": { - "extract-zip": "cli.js" - }, - "engines": { - "node": ">= 10.17.0" - }, - "optionalDependencies": { - "@types/yauzl": "^2.9.1" - } - }, - "node_modules/electron-packager/node_modules/fs-extra": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", - "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/electron-packager/node_modules/get-stream": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", - "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", - "dev": true, - "dependencies": { - "pump": "^3.0.0" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/electron-packager/node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/electron-to-chromium": { "version": "1.4.435", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.435.tgz", @@ -10318,9 +10413,9 @@ "dev": true }, "node_modules/electron/node_modules/@types/node": { - "version": "16.18.36", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.36.tgz", - "integrity": "sha512-8egDX8dE50XyXWH6C6PRCNkTP106DuUrvdrednFouDSmCi7IOvrqr0frznfZaHifHH/3aq/7a7v9N4wdXMqhBQ==", + "version": "18.17.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.17.12.tgz", + "integrity": "sha512-d6xjC9fJ/nSnfDeU0AMDsaJyb1iHsqCSOdi84w4u+SlN/UgQdY5tRhpMzaFYsI4mnpvgTivEaQd0yOUhAtOnEQ==", "dev": true }, "node_modules/elementtree": { @@ -10597,6 +10692,7 @@ "cpu": [ "arm64" ], + "dev": true, "optional": true, "os": [ "darwin" @@ -11518,35 +11614,40 @@ } }, "node_modules/extract-zip": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-1.7.0.tgz", - "integrity": "sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", "dev": true, "dependencies": { - "concat-stream": "^1.6.2", - "debug": "^2.6.9", - "mkdirp": "^0.5.4", + "debug": "^4.1.1", + "get-stream": "^5.1.0", "yauzl": "^2.10.0" }, "bin": { "extract-zip": "cli.js" + }, + "engines": { + "node": ">= 10.17.0" + }, + "optionalDependencies": { + "@types/yauzl": "^2.9.1" } }, - "node_modules/extract-zip/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/extract-zip/node_modules/get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, "dependencies": { - "ms": "2.0.0" + "pump": "^3.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/extract-zip/node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -11859,48 +11960,30 @@ "dev": true }, "node_modules/flora-colossus": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-1.0.1.tgz", - "integrity": "sha512-d+9na7t9FyH8gBJoNDSi28mE4NgQVGGvxQ4aHtFRetjyh5SXjuus+V5EZaxFmFdXVemSOrx0lsgEl/ZMjnOWJA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/flora-colossus/-/flora-colossus-2.0.0.tgz", + "integrity": "sha512-dz4HxH6pOvbUzZpZ/yXhafjbR2I8cenK5xL0KtBFb7U2ADsR+OwXifnxZjij/pZWF775uSCMzWVd+jDik2H2IA==", "dev": true, "dependencies": { - "debug": "^4.1.1", - "fs-extra": "^7.0.0" + "debug": "^4.3.4", + "fs-extra": "^10.1.0" }, "engines": { - "node": ">= 6.0.0" + "node": ">= 12" } }, "node_modules/flora-colossus/node_modules/fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" }, "engines": { - "node": ">=6 <7 || >=8" - } - }, - "node_modules/flora-colossus/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/flora-colossus/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, - "engines": { - "node": ">= 4.0.0" + "node": ">=12" } }, "node_modules/follow-redirects": { @@ -12117,6 +12200,7 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -12159,52 +12243,31 @@ } }, "node_modules/galactus": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/galactus/-/galactus-0.2.1.tgz", - "integrity": "sha512-mDc8EQJKtxjp9PMYS3PbpjjbX3oXhBTxoGaPahw620XZBIHJ4+nvw5KN/tRtmmSDR9dypstGNvqQ3C29QGoGHQ==", - "dev": true, - "dependencies": { - "debug": "^3.1.0", - "flora-colossus": "^1.0.0", - "fs-extra": "^4.0.0" - } - }, - "node_modules/galactus/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/galactus/-/galactus-1.0.0.tgz", + "integrity": "sha512-R1fam6D4CyKQGNlvJne4dkNF+PvUUl7TAJInvTGa9fti9qAv95quQz29GXapA4d8Ec266mJJxFVh82M4GIIGDQ==", "dev": true, "dependencies": { - "ms": "^2.1.1" + "debug": "^4.3.4", + "flora-colossus": "^2.0.0", + "fs-extra": "^10.1.0" + }, + "engines": { + "node": ">= 12" } }, "node_modules/galactus/node_modules/fs-extra": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz", - "integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.1.0.tgz", + "integrity": "sha512-oRXApq54ETRj4eMiFzGnHWGy+zo5raudjuxN0b8H7s/RU2oW0Wvsx9O0ACRN/kRq9E8Vu/ReskGB5o3ji+FzHQ==", "dev": true, "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "node_modules/galactus/node_modules/jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/galactus/node_modules/universalify": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", - "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", - "dev": true, + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, "engines": { - "node": ">= 4.0.0" + "node": ">=12" } }, "node_modules/gensync": { @@ -12348,7 +12411,7 @@ "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "devOptional": true, + "dev": true, "dependencies": { "is-glob": "^4.0.1" }, @@ -12412,22 +12475,6 @@ "node": ">=10" } }, - "node_modules/global-tunnel-ng": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz", - "integrity": "sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==", - "dev": true, - "optional": true, - "dependencies": { - "encodeurl": "^1.0.2", - "lodash": "^4.17.10", - "npm-conf": "^1.1.3", - "tunnel": "^0.0.6" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/globals": { "version": "13.20.0", "resolved": "https://registry.npmjs.org/globals/-/globals-13.20.0.tgz", @@ -13410,7 +13457,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "devOptional": true, + "dev": true, "dependencies": { "binary-extensions": "^2.0.0" }, @@ -15339,7 +15386,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "devOptional": true, + "dev": true, "engines": { "node": ">=0.10.0" } @@ -17937,7 +17984,7 @@ "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "devOptional": true, + "dev": true, "dependencies": { "picomatch": "^2.2.1" }, @@ -18482,7 +18529,7 @@ "version": "1.32.12", "resolved": "https://registry.npmjs.org/sass/-/sass-1.32.12.tgz", "integrity": "sha512-zmXn03k3hN0KaiVTjohgkg98C3UowhL1/VSGdj4/VAAiMKGQOE80PFPxFP2Kyq0OUskPKcY5lImkhBKEHlypJA==", - "devOptional": true, + "dev": true, "dependencies": { "chokidar": ">=3.0.0 <4.0.0" }, @@ -20089,16 +20136,6 @@ "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==" }, - "node_modules/tunnel": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", - "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", - "dev": true, - "optional": true, - "engines": { - "node": ">=0.6.11 <=0.7.0 || >=0.7.3" - } - }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -20161,12 +20198,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==", - "dev": true - }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", diff --git a/src-frontend/package.json b/src-frontend/package.json index 13808080..eb2b2cbc 100644 --- a/src-frontend/package.json +++ b/src-frontend/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "3.4.0", + "version": "3.4.1", "description": "The MemberMatters frontend", "productName": "MemberMatters", "author": "Jaimyn Mayer ", @@ -73,10 +73,10 @@ "autoprefixer": "^10.4.2", "babel-eslint": "^10.0.1", "devtron": "^1.4.0", - "electron": "^18.3.7", + "electron": "^26.1.0", "electron-debug": "^3.1.0", "electron-devtools-installer": "^3.0.0", - "electron-packager": "^15.5.1", + "electron-packager": "^17.1.2", "eslint": "^8.14.0", "eslint-config-airbnb-base": "^15.0.0", "eslint-config-prettier": "^8.5.0", diff --git a/src-frontend/quasar.config.js b/src-frontend/quasar.config.js index df4e59a0..17a461dc 100644 --- a/src-frontend/quasar.config.js +++ b/src-frontend/quasar.config.js @@ -179,85 +179,84 @@ module.exports = configure(async function (ctx) { // electronMain: 'src-electron/electron-main', // electronPreload: 'src-electron/electron-preload' // }, + }, + // https://v2.quasar.dev/quasar-cli-vite/developing-ssr/configuring-ssr + ssr: { + // ssrPwaHtmlFilename: 'offline.html', // do NOT use index.html as name! + // will mess up SSR - // https://v2.quasar.dev/quasar-cli-vite/developing-ssr/configuring-ssr - ssr: { - // ssrPwaHtmlFilename: 'offline.html', // do NOT use index.html as name! - // will mess up SSR - - // extendSSRWebserverConf (esbuildConf) {}, - // extendPackageJson (json) {}, - - pwa: false, + // extendSSRWebserverConf (esbuildConf) {}, + // extendPackageJson (json) {}, - // manualStoreHydration: true, - // manualPostHydrationTrigger: true, + pwa: false, - prodPort: 3000, // The default port that the production server should use - // (gets superseded if process.env.PORT is specified at runtime) + // manualStoreHydration: true, + // manualPostHydrationTrigger: true, - middlewares: [ - 'render', // keep this as last one - ], - }, + prodPort: 3000, // The default port that the production server should use + // (gets superseded if process.env.PORT is specified at runtime) - // https://v2.quasar.dev/quasar-cli-vite/developing-pwa/configuring-pwa - pwa: { - workboxMode: 'generateSW', // or 'injectManifest' - injectPwaMetaTags: true, - swFilename: 'sw.js', - manifestFilename: 'manifest.json', - useCredentialsForManifestTag: false, - }, + middlewares: [ + 'render', // keep this as last one + ], + }, - // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-cordova-apps/configuring-cordova - cordova: { - // noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing - }, + // https://v2.quasar.dev/quasar-cli-vite/developing-pwa/configuring-pwa + pwa: { + workboxMode: 'generateSW', // or 'injectManifest' + injectPwaMetaTags: true, + swFilename: 'sw.js', + manifestFilename: 'manifest.json', + useCredentialsForManifestTag: false, + }, - // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-capacitor-apps/configuring-capacitor - capacitor: { - hideSplashscreen: false, - iosStatusBarPadding: true, - }, + // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-cordova-apps/configuring-cordova + cordova: { + // noIosLegacyBuildFlag: true, // uncomment only if you know what you are doing + }, - // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-electron-apps/configuring-electron - electron: { - // extendElectronMainConf (esbuildConf) - // extendElectronPreloadConf (esbuildConf) + // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-capacitor-apps/configuring-capacitor + capacitor: { + hideSplashscreen: false, + iosStatusBarPadding: true, + }, - inspectPort: 5858, + // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-electron-apps/configuring-electron + electron: { + // extendElectronMainConf (esbuildConf) + // extendElectronPreloadConf (esbuildConf) - bundler: 'packager', // 'packager' or 'builder' + inspectPort: 5858, - packager: { - // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options - // OS X / Mac App Store - // appBundleId: '', - // appCategoryType: '', - // osxSign: '', - // protocol: 'myapp://path', - // Windows only - // win32metadata: { ... } - }, + bundler: 'packager', // 'packager' or 'builder' - builder: { - // https://www.electron.build/configuration/configuration + packager: { + // https://github.com/electron-userland/electron-packager/blob/master/docs/api.md#options + // OS X / Mac App Store + // appBundleId: '', + // appCategoryType: '', + // osxSign: '', + // protocol: 'myapp://path', + // Windows only + // win32metadata: { ... } + }, - appId: 'membermatters', - }, + builder: { + // https://www.electron.build/configuration/configuration - nodeIntegration: true, + appId: 'membermatters', }, - // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-browser-extensions/configuring-bex - bex: { - // contentScripts: [ - // 'my-content-script' - // ], - // extendBexScriptsConf (esbuildConf) {} - // extendBexManifestJson (json) {} - }, + nodeIntegration: true, + }, + + // Full list of options: https://v2.quasar.dev/quasar-cli-vite/developing-browser-extensions/configuring-bex + bex: { + // contentScripts: [ + // 'my-content-script' + // ], + // extendBexScriptsConf (esbuildConf) {} + // extendBexManifestJson (json) {} }, }; }); diff --git a/src-frontend/src-electron/electron-env.d.ts b/src-frontend/src-electron/electron-env.d.ts new file mode 100644 index 00000000..dea1502a --- /dev/null +++ b/src-frontend/src-electron/electron-env.d.ts @@ -0,0 +1,8 @@ +/* eslint-disable */ + +declare namespace NodeJS { + interface ProcessEnv { + QUASAR_ELECTRON_PRELOAD: string; + APP_URL: string; + } +} diff --git a/src-frontend/src-electron/electron-flag.d.ts b/src-frontend/src-electron/electron-flag.d.ts index d0213426..ffbda77e 100644 --- a/src-frontend/src-electron/electron-flag.d.ts +++ b/src-frontend/src-electron/electron-flag.d.ts @@ -1,3 +1,4 @@ +/* eslint-disable */ // THIS FEATURE-FLAG FILE IS AUTOGENERATED, // REMOVAL OR CHANGES WILL CAUSE RELATED TYPES TO STOP WORKING import 'quasar/dist/types/feature-flag'; diff --git a/src-frontend/src-electron/electron-main.ts b/src-frontend/src-electron/electron-main.ts new file mode 100644 index 00000000..bf742c2e --- /dev/null +++ b/src-frontend/src-electron/electron-main.ts @@ -0,0 +1,74 @@ +import { app, BrowserWindow, nativeTheme, session } from 'electron'; +import path from 'path'; +import os from 'os'; + +// needed in case process is undefined under Linux +const platform = process.platform || os.platform(); + +try { + if (platform === 'win32' && nativeTheme.shouldUseDarkColors === true) { + require('fs').unlinkSync( + path.join(app.getPath('userData'), 'DevTools Extensions') + ); + } +} catch (_) {} + +let mainWindow: BrowserWindow | undefined; + +function createWindow() { + /** + * Initial window options + */ + mainWindow = new BrowserWindow({ + icon: path.resolve(__dirname, 'icons/icon.png'), // tray icon + fullscreen: process.env.NODE_ENV !== 'Development', + useContentSize: true, + webPreferences: { + contextIsolation: true, + // More info: https://v2.quasar.dev/quasar-cli-vite/developing-electron-apps/electron-preload-script + preload: path.resolve(__dirname, process.env.QUASAR_ELECTRON_PRELOAD), + }, + }); + + // Set the SameSite attribute to "None" for all cookies + session.defaultSession.webRequest.onHeadersReceived((details, callback) => { + if (details.responseHeaders && details.responseHeaders['set-cookie']) { + details.responseHeaders['set-cookie'] = details.responseHeaders[ + 'set-cookie' + ].map((cookie: string) => { + return cookie + '; SameSite=None; Secure'; + }); + } + callback({ cancel: false, responseHeaders: details.responseHeaders }); + }); + + mainWindow.loadURL(process.env.APP_URL); + + if (process.env.DEBUGGING) { + // if on DEV or Production with debug enabled + mainWindow.webContents.openDevTools(); + } else { + // TODO: comment out if you want to block access to dev tools in production + // mainWindow.webContents.on('devtools-opened', () => { + // mainWindow?.webContents.closeDevTools(); + // }); + } + + mainWindow.on('closed', () => { + mainWindow = undefined; + }); +} + +app.whenReady().then(createWindow); + +app.on('window-all-closed', () => { + if (platform !== 'darwin') { + app.quit(); + } +}); + +app.on('activate', () => { + if (mainWindow === undefined) { + createWindow(); + } +}); diff --git a/src-frontend/src-electron/electron-preload.ts b/src-frontend/src-electron/electron-preload.ts new file mode 100644 index 00000000..03d24fe6 --- /dev/null +++ b/src-frontend/src-electron/electron-preload.ts @@ -0,0 +1,29 @@ +/** + * This file is used specifically for security reasons. + * Here you can access Nodejs stuff and inject functionality into + * the renderer thread (accessible there through the "window" object) + * + * WARNING! + * If you import anything from node_modules, then make sure that the package is specified + * in package.json > dependencies and NOT in devDependencies + * + * Example (injects window.myAPI.doAThing() into renderer thread): + * + * import { contextBridge } from 'electron' + * + * contextBridge.exposeInMainWorld('myAPI', { + * doAThing: () => {} + * }) + * + * WARNING! + * If accessing Node functionality (like importing @electron/remote) then in your + * electron-main.ts you will need to set the following when you instantiate BrowserWindow: + * + * mainWindow = new BrowserWindow({ + * // ... + * webPreferences: { + * // ... + * sandbox: false // <-- to be able to import @electron/remote in preload script + * } + * } + */ diff --git a/src-frontend/src-electron/main-process/electron-main.dev.js b/src-frontend/src-electron/main-process/electron-main.dev.js deleted file mode 100644 index 39a596fd..00000000 --- a/src-frontend/src-electron/main-process/electron-main.dev.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * This file is used specifically and only for development. It installs - * `electron-debug` & `vue-devtools`. There shouldn't be any need to - * modify this file, but it can be used to extend your development - * environment. - */ - -// Install `electron-debug` with `devtron` -// eslint-disable-next-line @typescript-eslint/no-var-requires -require('electron-debug')({ showDevTools: true }); - -// Install `vue-devtools` -// eslint-disable-next-line @typescript-eslint/no-var-requires -require('electron').app.on('ready', () => { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const installExtension = require('electron-devtools-installer'); - installExtension - .default(installExtension.VUEJS_DEVTOOLS) - // eslint-disable-next-line @typescript-eslint/no-empty-function - .then(() => {}) - .catch((err) => { - console.log('Unable to install `vue-devtools`: \n', err); - }); -}); - -// Require `main` process to boot app -require('./electron-main'); diff --git a/src-frontend/src-electron/main-process/electron-main.js b/src-frontend/src-electron/main-process/electron-main.js deleted file mode 100644 index d26c6906..00000000 --- a/src-frontend/src-electron/main-process/electron-main.js +++ /dev/null @@ -1,64 +0,0 @@ -/* eslint-disable */ -import { app, BrowserWindow, nativeTheme } from 'electron'; - -try { - if ( - process.platform === 'win32' && - nativeTheme.shouldUseDarkColors === true - ) { - require('fs').unlinkSync( - require('path').join(app.getPath('userData'), 'DevTools Extensions') - ); - } -} catch (_) {} - -/** - * Set `__statics` path to static files in production; - * The reason we are setting it here is that the path needs to be evaluated at runtime - */ -if (process.env.PROD) { - global.__statics = require('path') - .join(__dirname, 'statics') - .replace(/\\/g, '\\\\'); -} - -let mainWindow; - -function createWindow() { - /** - * Initial window options - */ - mainWindow = new BrowserWindow({ - fullscreen: process.env.NODE_ENV !== 'Development', - useContentSize: true, - webPreferences: { - // Change from /quasar.conf.js > electron > nodeIntegration; - // More info: https://quasar.dev/quasar-cli/developing-electron-apps/node-integration - nodeIntegration: process.env.QUASAR_NODE_INTEGRATION, - enableRemoteModule: true, - - // More info: /quasar-cli/developing-electron-apps/electron-preload-script - // preload: path.resolve(__dirname, 'electron-preload.js') - }, - }); - - mainWindow.loadURL(process.env.APP_URL); - - mainWindow.on('closed', () => { - mainWindow = null; - }); -} - -app.on('ready', createWindow); - -app.on('window-all-closed', () => { - if (process.platform !== 'darwin') { - app.quit(); - } -}); - -app.on('activate', () => { - if (mainWindow === null) { - createWindow(); - } -});