Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function login() {
if (access) {
try {
api = new GitLab({
url: BASE_SERVER,
oauthToken: access.access_token
});
console.log(api);
currentUser = await api.Users.current();
await renderUser();
return;
} catch (e) {
console.log("Login using access_token failed. Proceeding with OAuth2", e, access);
}
} else
console.log("First time login. Welcome in!");
let modal = document.createElement("div");
modal.dialog = document.createElement("form");
modal.content = document.createElement("main");
modal.dialog.className = "modal-dialog modal-dialog-centered";
this.repository = this.deployment.siteConfig.deployment.gitlab.repo;
this.user = this.deployment.siteConfig.deployment.gitlab.user;
this.branch = this.deployment.siteConfig.deployment.gitlab.branch;
this.remoteFilesList = [];
this.filesToRemove = [];
this.filesToUpdate = [];
this.filesToUpload = [];
this.waitForTimeout = true;
let token = this.deployment.siteConfig.deployment.gitlab.token;
let account = slug(this.deployment.siteConfig.name);
if (token === 'publii-gl-token ' + account) {
token = await passwordSafeStorage.getPassword('publii-gl-token', account);
}
this.client = new Gitlab({
url: this.deployment.siteConfig.deployment.gitlab.server,
token: token
});
this.setUploadProgress(6);
console.log('(!) CLIENT CREATED');
process.send({
type: 'web-contents',
message: 'app-connection-in-progress'
});
this.deployment.setInput();
this.deployment.setOutput(true);
this.deployment.prepareLocalFilesList();
this.setUploadProgress(7);
constructor (options = {}) {
super(options.username, options.repository, options.branch)
const token = config.get('gitlabToken')
if (options.oauthToken) {
this.api = new GitLabApi({
url: config.get('gitlabBaseUrl'),
oauthToken: options.oauthToken
})
} else if (token) {
this.api = new GitLabApi({
url: config.get('gitlabBaseUrl'),
token
})
} else {
throw new Error('Require an `oauthToken` or `token` option')
}
}
constructor(logger, url, token) {
this.classProperties();
this.logger = logger;
this.api = new Gitlab({
url: url,
token: token
});
this.url = url;
this.token = token;
}
constructor({ token, projectId }) {
this._api = new Gitlab({ token });
this._projectId = projectId;
}
async testConnection (app, deploymentConfig, siteName) {
let repository = deploymentConfig.gitlab.repo;
let branchName = deploymentConfig.gitlab.branch;
let token = deploymentConfig.gitlab.token;
let account = slug(siteName);
this.waitForTimeout = true;
if (token === 'publii-gl-token ' + account) {
token = await passwordSafeStorage.getPassword('publii-gl-token', account);
}
this.client = new Gitlab({
url: deploymentConfig.gitlab.server,
token: token
});
this.client.Projects.all({
owned: true,
maxPages: 1,
perPage: 1
}).then(project => {
this.client.Projects.all({
search: repository,
owned: true,
maxPages: 1,
perPage: 1
}).then(projects => {
let projectID = projects[0].id;
var colors = require('colors');
var Gitlab = require('gitlab/dist/es5').default;
var editor = require('editor');
var exec = childProcess.exec;
var fs = require('fs');
var legacies = {};
var open = require('open');
var projectDir = process.cwd();
var Promise = require('promise');
var URL = require('url');
var options = require('./options')
var packageJson = require('./package.json')
var regexParseProjectName = /(.+:\/\/.+?\/|.+:)(.+\/[^\.]+)+(\.git)?/;
var gitlab = new Gitlab(options);
gitlab.options = options;
var store = (function(){
return {
set : function(obj){
Object.assign(this, obj)
},
get : function(key){
return this[key]
}
}
})()
var log = {
getInstance: function(verbose) {
return {
log: function() {
module.exports = (n, errorData) => {
const title = messageBuilder.title(n, errorData);
let endpoint = 'https://gitlab.com';
if (n.endpoint) {
endpoint = n.endpoint;
}
const g = new Gitlab({
url: endpoint,
token: n.personalAccessToken
});
let acitonIfExist = 'reopen-and-comment';
if (n.if_exist) {
acitonIfExist = n.if_exist;
}
function isReopen() {
return (['reopen', 'reopen-and-comment', 'reopen-and-update'].indexOf(acitonIfExist) >= 0);
}
function isComment() {
return (['comment', 'reopen-and-comment'].indexOf(acitonIfExist) >= 0);
}