Skip to content

Commit fcc5ffe

Browse files
committed
new branch bb
1 parent b7a8be5 commit fcc5ffe

File tree

2 files changed

+54
-7
lines changed

2 files changed

+54
-7
lines changed

src-electron/main-process/electron-main.js

Lines changed: 52 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ if (process.env.PROD) {
1919

2020
let mainWindow;
2121
let authCode;
22-
let authResponse;
2322

2423
function logEverywhere(...toBeLogged) {
2524
console.log(...toBeLogged);
@@ -28,16 +27,64 @@ function logEverywhere(...toBeLogged) {
2827
}
2928
}
3029

31-
const protocol = isDev ? "dev-app" : "prod-app";
32-
const deeplink = new Deeplink({ app, mainWindow, protocol, isDev });
30+
const protocol = isDev ? 'overvuedev' : 'overvue'
31+
const deeplink = new Deeplink({
32+
app,
33+
mainWindow,
34+
protocol,
35+
isDev ,
36+
debugLogging: true,
37+
electronPath: '../../node_modules/electron/dist/electron.exe'
38+
});
3339
// ipcMain.handle('slackAuth', slackAuth)
3440

41+
let deeplinkingUrl;
42+
43+
function customDeepLink() {
44+
if (isDev && process.platform === 'win32') {
45+
// Set the path of electron.exe and your app.
46+
// These two additional parameters are only available on windows.
47+
// Setting this is required to get this working in dev mode.
48+
app.setAsDefaultProtocolClient('overvuedev', process.execPath, [
49+
resolve(process.argv[1])
50+
]);
51+
} else {
52+
app.setAsDefaultProtocolClient('overvue');
53+
}
54+
55+
app.on('open-url', function (event, url) {
56+
event.preventDefault();
57+
deeplinkingUrl = url;
58+
});
59+
60+
// Force single application instance
61+
const gotTheLock = app.requestSingleInstanceLock();
62+
63+
if (!gotTheLock) {
64+
app.quit();
65+
return;
66+
} else {
67+
app.on('second-instance', (e, argv) => {
68+
if (process.platform !== 'darwin') {
69+
// Find the arg that is our custom protocol url and store it
70+
deeplinkingUrl = argv.find((arg) => arg.startsWith('overvuedev://test'));
71+
}
72+
73+
if (myWindow) {
74+
if (myWindow.isMinimized()) myWindow.restore();
75+
myWindow.focus();
76+
}
77+
})
78+
}
79+
}
80+
81+
3582
function getSlackAuth () {
3683
const authData = {
3784
client_id: clientId,
3885
client_secret: clientSecret,
3986
code: authCode,
40-
redirect_uri: 'overvue://slack'
87+
redirect_uri: isDev ? 'overvuedev://test' : 'overvue://slack'
4188
}
4289

4390
const request = net.request({
@@ -72,7 +119,6 @@ function getSlackToken () {
72119
getSlackAuth()
73120
});
74121
}
75-
//overvue://slack/?code=2696943977700.2730026875664.c754c0f5326f5c8495cd66fb374c5ea441c610b2cff0064dd4832b0290db6b5b
76122

77123
function createWindow() {
78124
/**
@@ -89,6 +135,7 @@ function createWindow() {
89135
}
90136
});
91137

138+
logEverywhere('current protocol ', deeplink.getProtocol())
92139
mainWindow.loadURL(process.env.APP_URL)
93140

94141
mainWindow.on("closed", () => {

src/components/slack_login/SlackLoginWindow.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ export default {
3232
name: 'SlackLoginWindow',
3333
data () {
3434
return {
35-
oauthURL: slackApiStuff.oauthURL,
3635
isAuthenticating: false
3736
}
3837
},
@@ -48,7 +47,8 @@ export default {
4847
const responseType = 'code'
4948
const scope = 'openid profile'
5049
const clientId = slackApiStuff.clientId
51-
const redirectUri = process.env.DEV ? 'https://localhost:8080' : 'overvue://slack'
50+
const redirectUri = process.env.DEV ? 'overvuedev://test' : 'overvue://slack'
51+
// const redirectUri = 'overvue://slack'
5252
5353
this.isAuthenticating = true;
5454

0 commit comments

Comments
 (0)