Skip to content

Commit

Permalink
Merge pull request #9 from hermanho/dev
Browse files Browse the repository at this point in the history
1.1.1
  • Loading branch information
hermanho authored Oct 9, 2024
2 parents 2be7b9b + 9b988f6 commit 4c5612c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# MMM-OneDrive Change Log

**`[1.1.1] - 2024/10/09`**
fix: wrap require("electron") inside the function for the headless environment

**`[1.1.0] - 2024/08/15`**
- Fixed: albumn info did not show when startup caching
- Fixed: depedencies packages update
Expand Down
10 changes: 8 additions & 2 deletions msal/AuthProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

const { PublicClientApplication, InteractionRequiredAuthError, ServerError } = require("@azure/msal-node");
const { shell } = require("electron");

class AuthProvider {
msalConfig;
Expand Down Expand Up @@ -55,6 +54,7 @@ class AuthProvider {
* https://learn.microsoft.com/azure/active-directory/develop/v2-protocols-oidc#send-a-sign-out-request
*/
if (this.account.idTokenClaims.hasOwnProperty("login_hint")) {
const { shell } = require("electron");
await shell.openExternal(`${this.msalConfig.auth.authority}/oauth2/v2.0/logout?logout_hint=${encodeURIComponent(this.account.idTokenClaims.login_hint)}`);
}

Expand Down Expand Up @@ -98,7 +98,13 @@ class AuthProvider {

async getTokenInteractive(tokenRequest) {
const openBrowser = async (url) => {
await shell.openExternal(url);
try {
const { shell } = require("electron");
await shell.openExternal(url);
} catch (e) {
console.error("Unable to open external browser. Please run the module with a screen UI environment ", e);
throw e;
}
};

const authResponse = await this.clientApplication.acquireTokenInteractive({
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mmm-onedrive",
"version": "1.1.0",
"version": "1.1.1",
"description": "MagicMirror² module to display your photos from OneDrive.",
"license": "MIT",
"author": "hermanho",
Expand Down

0 comments on commit 4c5612c

Please sign in to comment.