Skip to content

Commit

Permalink
Fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
ochorocho committed Apr 22, 2019
1 parent 6fb5989 commit 5fe9cac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const action = async context => {
const dateUntil = moment().add(context.config.get('lifeTime'), 'days');
const validUntil = dateUntil.format('YYYY-MM-DD');
const uploadUrl = join(url, '/remote.php/webdav/', fileTarget);
const shareUrl = join(url,'/ocs/v1.php/apps/files_sharing/api/v1/shares');
const shareUrl = join(url, '/ocs/v1.php/apps/files_sharing/api/v1/shares');

/**
* Create Read Stream of filePath
Expand All @@ -37,7 +37,7 @@ const action = async context => {
readmeStream.on('error', console.log);
const {size} = fs.statSync(filePath);
const headers = {'OCS-APIRequest': 'true', 'Content-Length': size,};
const auth = { username: context.config.get('username'), password: context.config.get('password') };
const auth = {username: context.config.get('username'), password: context.config.get('password')};

/**
* Upload File to Nextcloud
Expand All @@ -51,7 +51,7 @@ const action = async context => {
body: readmeStream
},
function (error, response) {
if(response.statusCode !== 201) {
if (response.statusCode !== 201) {
context.config.delete("username");
context.config.delete("password");
}
Expand All @@ -72,7 +72,7 @@ const action = async context => {
}
let additionalInfo = `\n\nValid until: ${dateUntil.format('DD-MM-YYYY')}`

if(context.config.get('randomPassword') === true) {
if (context.config.get('randomPassword') === true) {
let generator = require('generate-password');

let password = generator.generate({
Expand All @@ -93,7 +93,7 @@ const action = async context => {
},
function (error, response, body) {
try {
if(response.statusCode === 403) {
if (response.statusCode === 403) {
context.notify('Public upload was disabled by Nextcloud admin, use random password option in config');
} else {
context.copyToClipboard(body.ocs.data.url + additionalInfo);
Expand Down
7 changes: 5 additions & 2 deletions login.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const login = context => {
let url = request.url.substr(5);
let elements = url.split('&');

elements.forEach(function(item) {
elements.forEach(function (item) {
let key = item.split(/:(.*)/)[0]
let value = item.split(/:(.*)/)[1]
credentials[key] = value
Expand Down Expand Up @@ -44,7 +44,10 @@ const login = context => {
}
});

let extraHeaders = { userAgent: 'KapScreenRecorder', extraHeaders: 'OCS-APIREQUEST: true\n ACCEPT_LANGUAGE: "en-US"' }
let extraHeaders = {
userAgent: 'KapScreenRecorder',
extraHeaders: 'OCS-APIREQUEST: true\n ACCEPT_LANGUAGE: "en-US"'
}
authWindow.loadURL(join(context.config.get("url"), '/index.php/login/flow'), extraHeaders);

/**
Expand Down

0 comments on commit 5fe9cac

Please sign in to comment.