Skip to content

Commit

Permalink
Do not trigger shar when upload failed due to missing credentials/per…
Browse files Browse the repository at this point in the history
…missions

Issue #5

Signed-off-by: Jochen <rothjochen@gmail.com>
  • Loading branch information
ochorocho committed Jun 11, 2020
1 parent 2e39c2e commit c9fb0a0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
18 changes: 9 additions & 9 deletions login.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ const login = context => {
return new Promise((resolve, reject) => {
const credentials = []

const authWindow = new BrowserWindow({
'use-content-size': true,
alwaysOnTop: true,
autoHideMenuBar: false,
webPreferences: {
nodeIntegration: false
}
})

/**
* Register nc:// protocol
*/
Expand All @@ -42,6 +33,15 @@ const login = context => {
console.error(error)
})

const authWindow = new BrowserWindow({
'use-content-size': true,
alwaysOnTop: true,
autoHideMenuBar: false,
webPreferences: {
nodeIntegration: false
}
})

const extraHeaders = {
userAgent: 'KapScreenRecorder',
extraHeaders: 'OCS-APIREQUEST: true\n ACCEPT_LANGUAGE: "en-US"'
Expand Down
2 changes: 1 addition & 1 deletion 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": "kap-nextcloud",
"version": "1.4.2",
"version": "1.4.3",
"description": "Upload Screencast to your Nextcloud Instance",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 3 additions & 2 deletions upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,14 @@ const upload = (context, filePath) => {
if (response.statusCode !== 201) {
context.config.delete('username')
context.config.delete('password')
} else {
context.setProgress('Upload finished', 'completed')
share(context, filePath)
}

if (error) {
return console.error('Nextcloud upload failed:', error)
}
context.setProgress('Upload finished', 'completed')
share(context, filePath)
})
}

Expand Down

0 comments on commit c9fb0a0

Please sign in to comment.