mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-01-12 02:25:27 +00:00
commit
4505d892f8
86 changed files with 3451 additions and 3318 deletions
16
.editorconfig
Normal file
16
.editorconfig
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
root = true
|
||||||
|
|
||||||
|
[*.js]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
end_of_line = lf
|
||||||
|
|
||||||
|
[*.go]
|
||||||
|
indent_style = tab
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
end_of_line = lf
|
|
@ -1,37 +1,32 @@
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"extends": [
|
extends: [
|
||||||
"standard",
|
"standard",
|
||||||
"plugin:jest/recommended",
|
"plugin:jest/recommended",
|
||||||
"plugin:react/recommended",
|
"plugin:react/recommended",
|
||||||
"prettier",
|
"prettier",
|
||||||
"prettier/react"
|
"prettier/react"
|
||||||
],
|
],
|
||||||
"plugins": [
|
plugins: ["react", "jest", "prettier"],
|
||||||
"react",
|
parser: "babel-eslint",
|
||||||
"jest",
|
parserOptions: {
|
||||||
"prettier"
|
ecmaVersion: 2016,
|
||||||
],
|
sourceType: "module",
|
||||||
"parser": "babel-eslint",
|
ecmaFeatures: {
|
||||||
"parserOptions": {
|
jsx: true
|
||||||
"ecmaVersion": 2016,
|
|
||||||
"sourceType": "module",
|
|
||||||
"ecmaFeatures": {
|
|
||||||
"jsx": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"env": {
|
env: {
|
||||||
"es6": true,
|
es6: true,
|
||||||
"browser": true,
|
browser: true,
|
||||||
"node": true,
|
node: true,
|
||||||
"jest/globals": true
|
"jest/globals": true
|
||||||
},
|
},
|
||||||
"rules": {
|
rules: {
|
||||||
"react/prop-types": 1,
|
"react/prop-types": 1,
|
||||||
"prettier/prettier": [
|
"prettier/prettier": [
|
||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"trailingComma": "all",
|
trailingComma: "all",
|
||||||
"useTabs": true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,11 +140,8 @@ export default class Default extends Component {
|
||||||
exact={true}
|
exact={true}
|
||||||
component={UserReposMenu}
|
component={UserReposMenu}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route path="/account/" exact={false} component={undefined} />
|
||||||
path="/account/"
|
BuildMenu
|
||||||
exact={false}
|
|
||||||
component={undefined}
|
|
||||||
/>BuildMenu
|
|
||||||
<Route
|
<Route
|
||||||
path="/:owner/:repo/:build(\d*)/:proc(\d*)"
|
path="/:owner/:repo/:build(\d*)/:proc(\d*)"
|
||||||
exact={true}
|
exact={true}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { displayMessage } from "./message";
|
import { displayMessage } from "./message";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates a personal access token and stores the results in
|
* Generates a personal access token and stores the results in
|
||||||
* the state tree.
|
* the state tree.
|
||||||
*
|
*
|
||||||
* @param {Object} tree - The drone state tree.
|
* @param {Object} tree - The drone state tree.
|
||||||
* @param {Object} client - The drone client.
|
* @param {Object} client - The drone client.
|
||||||
|
|
267
web/vendor/drone-js/index.js
vendored
267
web/vendor/drone-js/index.js
vendored
|
@ -1,4 +1,4 @@
|
||||||
(function (global, factory) {
|
(function(global, factory) {
|
||||||
if (typeof define === "function" && define.amd) {
|
if (typeof define === "function" && define.amd) {
|
||||||
define(["exports"], factory);
|
define(["exports"], factory);
|
||||||
} else if (typeof exports !== "undefined") {
|
} else if (typeof exports !== "undefined") {
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
factory(mod.exports);
|
factory(mod.exports);
|
||||||
global.index = mod.exports;
|
global.index = mod.exports;
|
||||||
}
|
}
|
||||||
})(this, function (exports) {
|
})(this, function(exports) {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", {
|
Object.defineProperty(exports, "__esModule", {
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _createClass = function () {
|
var _createClass = (function() {
|
||||||
function defineProperties(target, props) {
|
function defineProperties(target, props) {
|
||||||
for (var i = 0; i < props.length; i++) {
|
for (var i = 0; i < props.length; i++) {
|
||||||
var descriptor = props[i];
|
var descriptor = props[i];
|
||||||
|
@ -34,14 +34,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (Constructor, protoProps, staticProps) {
|
return function(Constructor, protoProps, staticProps) {
|
||||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||||
if (staticProps) defineProperties(Constructor, staticProps);
|
if (staticProps) defineProperties(Constructor, staticProps);
|
||||||
return Constructor;
|
return Constructor;
|
||||||
};
|
};
|
||||||
}();
|
})();
|
||||||
|
|
||||||
var DroneClient = function () {
|
var DroneClient = (function() {
|
||||||
function DroneClient(server, token, csrf) {
|
function DroneClient(server, token, csrf) {
|
||||||
_classCallCheck(this, DroneClient);
|
_classCallCheck(this, DroneClient);
|
||||||
|
|
||||||
|
@ -50,160 +50,260 @@
|
||||||
this.csrf = csrf;
|
this.csrf = csrf;
|
||||||
}
|
}
|
||||||
|
|
||||||
_createClass(DroneClient, [{
|
_createClass(
|
||||||
|
DroneClient,
|
||||||
|
[
|
||||||
|
{
|
||||||
key: "getRepoList",
|
key: "getRepoList",
|
||||||
value: function getRepoList(opts) {
|
value: function getRepoList(opts) {
|
||||||
var query = encodeQueryString(opts);
|
var query = encodeQueryString(opts);
|
||||||
return this._get("/api/user/repos?" + query);
|
return this._get("/api/user/repos?" + query);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getRepo",
|
key: "getRepo",
|
||||||
value: function getRepo(owner, repo) {
|
value: function getRepo(owner, repo) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo);
|
return this._get("/api/repos/" + owner + "/" + repo);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "activateRepo",
|
key: "activateRepo",
|
||||||
value: function activateRepo(owner, repo) {
|
value: function activateRepo(owner, repo) {
|
||||||
return this._post("/api/repos/" + owner + "/" + repo);
|
return this._post("/api/repos/" + owner + "/" + repo);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "updateRepo",
|
key: "updateRepo",
|
||||||
value: function updateRepo(owner, repo, data) {
|
value: function updateRepo(owner, repo, data) {
|
||||||
return this._patch("/api/repos/" + owner + "/" + repo, data);
|
return this._patch("/api/repos/" + owner + "/" + repo, data);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "deleteRepo",
|
key: "deleteRepo",
|
||||||
value: function deleteRepo(owner, repo) {
|
value: function deleteRepo(owner, repo) {
|
||||||
return this._delete("/api/repos/" + owner + "/" + repo);
|
return this._delete("/api/repos/" + owner + "/" + repo);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getBuildList",
|
key: "getBuildList",
|
||||||
value: function getBuildList(owner, repo, opts) {
|
value: function getBuildList(owner, repo, opts) {
|
||||||
var query = encodeQueryString(opts);
|
var query = encodeQueryString(opts);
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/builds?" + query);
|
return this._get(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/builds?" + query
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getBuild",
|
key: "getBuild",
|
||||||
value: function getBuild(owner, repo, number) {
|
value: function getBuild(owner, repo, number) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/builds/" + number);
|
return this._get(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/builds/" + number
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getBuildFeed",
|
key: "getBuildFeed",
|
||||||
value: function getBuildFeed(opts) {
|
value: function getBuildFeed(opts) {
|
||||||
var query = encodeQueryString(opts);
|
var query = encodeQueryString(opts);
|
||||||
return this._get("/api/user/feed?" + query);
|
return this._get("/api/user/feed?" + query);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "cancelBuild",
|
key: "cancelBuild",
|
||||||
value: function cancelBuild(owner, repo, number, ppid) {
|
value: function cancelBuild(owner, repo, number, ppid) {
|
||||||
return this._delete("/api/repos/" + owner + "/" + repo + "/builds/" + number + "/" + ppid);
|
return this._delete(
|
||||||
|
"/api/repos/" +
|
||||||
|
owner +
|
||||||
|
"/" +
|
||||||
|
repo +
|
||||||
|
"/builds/" +
|
||||||
|
number +
|
||||||
|
"/" +
|
||||||
|
ppid
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "approveBuild",
|
key: "approveBuild",
|
||||||
value: function approveBuild(owner, repo, build) {
|
value: function approveBuild(owner, repo, build) {
|
||||||
return this._post("/api/repos/" + owner + "/" + repo + "/builds/" + build + "/approve");
|
return this._post(
|
||||||
|
"/api/repos/" +
|
||||||
|
owner +
|
||||||
|
"/" +
|
||||||
|
repo +
|
||||||
|
"/builds/" +
|
||||||
|
build +
|
||||||
|
"/approve"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "declineBuild",
|
key: "declineBuild",
|
||||||
value: function declineBuild(owner, repo, build) {
|
value: function declineBuild(owner, repo, build) {
|
||||||
return this._post("/api/repos/" + owner + "/" + repo + "/builds/" + build + "/decline");
|
return this._post(
|
||||||
|
"/api/repos/" +
|
||||||
|
owner +
|
||||||
|
"/" +
|
||||||
|
repo +
|
||||||
|
"/builds/" +
|
||||||
|
build +
|
||||||
|
"/decline"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "restartBuild",
|
key: "restartBuild",
|
||||||
value: function restartBuild(owner, repo, build, opts) {
|
value: function restartBuild(owner, repo, build, opts) {
|
||||||
var query = encodeQueryString(opts);
|
var query = encodeQueryString(opts);
|
||||||
return this._post("/api/repos/" + owner + "/" + repo + "/builds/" + build + "?" + query);
|
return this._post(
|
||||||
|
"/api/repos/" +
|
||||||
|
owner +
|
||||||
|
"/" +
|
||||||
|
repo +
|
||||||
|
"/builds/" +
|
||||||
|
build +
|
||||||
|
"?" +
|
||||||
|
query
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getLogs",
|
key: "getLogs",
|
||||||
value: function getLogs(owner, repo, build, proc) {
|
value: function getLogs(owner, repo, build, proc) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/logs/" + build + "/" + proc);
|
return this._get(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/logs/" + build + "/" + proc
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getArtifact",
|
key: "getArtifact",
|
||||||
value: function getArtifact(owner, repo, build, proc, file) {
|
value: function getArtifact(owner, repo, build, proc, file) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/files/" + build + "/" + proc + "/" + file + "?raw=true");
|
return this._get(
|
||||||
|
"/api/repos/" +
|
||||||
|
owner +
|
||||||
|
"/" +
|
||||||
|
repo +
|
||||||
|
"/files/" +
|
||||||
|
build +
|
||||||
|
"/" +
|
||||||
|
proc +
|
||||||
|
"/" +
|
||||||
|
file +
|
||||||
|
"?raw=true"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getArtifactList",
|
key: "getArtifactList",
|
||||||
value: function getArtifactList(owner, repo, build) {
|
value: function getArtifactList(owner, repo, build) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/files/" + build);
|
return this._get(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/files/" + build
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getSecretList",
|
key: "getSecretList",
|
||||||
value: function getSecretList(owner, repo) {
|
value: function getSecretList(owner, repo) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/secrets");
|
return this._get("/api/repos/" + owner + "/" + repo + "/secrets");
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "createSecret",
|
key: "createSecret",
|
||||||
value: function createSecret(owner, repo, secret) {
|
value: function createSecret(owner, repo, secret) {
|
||||||
return this._post("/api/repos/" + owner + "/" + repo + "/secrets", secret);
|
return this._post(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/secrets",
|
||||||
|
secret
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "deleteSecret",
|
key: "deleteSecret",
|
||||||
value: function deleteSecret(owner, repo, secret) {
|
value: function deleteSecret(owner, repo, secret) {
|
||||||
return this._delete("/api/repos/" + owner + "/" + repo + "/secrets/" + secret);
|
return this._delete(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/secrets/" + secret
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getRegistryList",
|
key: "getRegistryList",
|
||||||
value: function getRegistryList(owner, repo) {
|
value: function getRegistryList(owner, repo) {
|
||||||
return this._get("/api/repos/" + owner + "/" + repo + "/registry");
|
return this._get("/api/repos/" + owner + "/" + repo + "/registry");
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "createRegistry",
|
key: "createRegistry",
|
||||||
value: function createRegistry(owner, repo, registry) {
|
value: function createRegistry(owner, repo, registry) {
|
||||||
return this._post("/api/repos/" + owner + "/" + repo + "/registry", registry);
|
return this._post(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/registry",
|
||||||
|
registry
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "deleteRegistry",
|
key: "deleteRegistry",
|
||||||
value: function deleteRegistry(owner, repo, address) {
|
value: function deleteRegistry(owner, repo, address) {
|
||||||
return this._delete("/api/repos/" + owner + "/" + repo + "/registry/" + address);
|
return this._delete(
|
||||||
|
"/api/repos/" + owner + "/" + repo + "/registry/" + address
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getSelf",
|
key: "getSelf",
|
||||||
value: function getSelf() {
|
value: function getSelf() {
|
||||||
return this._get("/api/user");
|
return this._get("/api/user");
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "getToken",
|
key: "getToken",
|
||||||
value: function getToken() {
|
value: function getToken() {
|
||||||
return this._post("/api/user/token");
|
return this._post("/api/user/token");
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "on",
|
key: "on",
|
||||||
value: function on(callback) {
|
value: function on(callback) {
|
||||||
return this._subscribe("/stream/events", callback, {
|
return this._subscribe("/stream/events", callback, {
|
||||||
reconnect: true
|
reconnect: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "stream",
|
key: "stream",
|
||||||
value: function stream(owner, repo, build, proc, callback) {
|
value: function stream(owner, repo, build, proc, callback) {
|
||||||
return this._subscribe("/stream/logs/" + owner + "/" + repo + "/" + build + "/" + proc, callback, {
|
return this._subscribe(
|
||||||
|
"/stream/logs/" + owner + "/" + repo + "/" + build + "/" + proc,
|
||||||
|
callback,
|
||||||
|
{
|
||||||
reconnect: false
|
reconnect: false
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}, {
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
key: "_get",
|
key: "_get",
|
||||||
value: function _get(path) {
|
value: function _get(path) {
|
||||||
return this._request("GET", path, null);
|
return this._request("GET", path, null);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "_post",
|
key: "_post",
|
||||||
value: function _post(path, data) {
|
value: function _post(path, data) {
|
||||||
return this._request("POST", path, data);
|
return this._request("POST", path, data);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "_patch",
|
key: "_patch",
|
||||||
value: function _patch(path, data) {
|
value: function _patch(path, data) {
|
||||||
return this._request("PATCH", path, data);
|
return this._request("PATCH", path, data);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "_delete",
|
key: "_delete",
|
||||||
value: function _delete(path) {
|
value: function _delete(path) {
|
||||||
return this._request("DELETE", path, null);
|
return this._request("DELETE", path, null);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "_subscribe",
|
key: "_subscribe",
|
||||||
value: function _subscribe(path, callback, opts) {
|
value: function _subscribe(path, callback, opts) {
|
||||||
var query = encodeQueryString({
|
var query = encodeQueryString({
|
||||||
|
@ -213,12 +313,12 @@
|
||||||
path = this.token ? path + "?" + query : path;
|
path = this.token ? path + "?" + query : path;
|
||||||
|
|
||||||
var events = new EventSource(path);
|
var events = new EventSource(path);
|
||||||
events.onmessage = function (event) {
|
events.onmessage = function(event) {
|
||||||
var data = JSON.parse(event.data);
|
var data = JSON.parse(event.data);
|
||||||
callback(data);
|
callback(data);
|
||||||
};
|
};
|
||||||
if (!opts.reconnect) {
|
if (!opts.reconnect) {
|
||||||
events.onerror = function (err) {
|
events.onerror = function(err) {
|
||||||
if (err.data === "eof") {
|
if (err.data === "eof") {
|
||||||
events.close();
|
events.close();
|
||||||
}
|
}
|
||||||
|
@ -226,7 +326,8 @@
|
||||||
}
|
}
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "_request",
|
key: "_request",
|
||||||
value: function _request(method, path, data) {
|
value: function _request(method, path, data) {
|
||||||
var endpoint = [this.server, path].join("");
|
var endpoint = [this.server, path].join("");
|
||||||
|
@ -238,8 +339,9 @@
|
||||||
if (method !== "GET" && this.csrf) {
|
if (method !== "GET" && this.csrf) {
|
||||||
xhr.setRequestHeader("X-CSRF-TOKEN", this.csrf);
|
xhr.setRequestHeader("X-CSRF-TOKEN", this.csrf);
|
||||||
}
|
}
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(
|
||||||
xhr.onload = function () {
|
function(resolve, reject) {
|
||||||
|
xhr.onload = function() {
|
||||||
if (xhr.readyState === 4) {
|
if (xhr.readyState === 4) {
|
||||||
if (xhr.status >= 300) {
|
if (xhr.status >= 300) {
|
||||||
var error = {
|
var error = {
|
||||||
|
@ -253,14 +355,17 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var contentType = xhr.getResponseHeader("Content-Type");
|
var contentType = xhr.getResponseHeader("Content-Type");
|
||||||
if (contentType && contentType.startsWith("application/json")) {
|
if (
|
||||||
|
contentType &&
|
||||||
|
contentType.startsWith("application/json")
|
||||||
|
) {
|
||||||
resolve(JSON.parse(xhr.response));
|
resolve(JSON.parse(xhr.response));
|
||||||
} else {
|
} else {
|
||||||
resolve(xhr.response);
|
resolve(xhr.response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.bind(this);
|
}.bind(this);
|
||||||
xhr.onerror = function (e) {
|
xhr.onerror = function(e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
};
|
};
|
||||||
if (data) {
|
if (data) {
|
||||||
|
@ -269,38 +374,58 @@
|
||||||
} else {
|
} else {
|
||||||
xhr.send();
|
xhr.send();
|
||||||
}
|
}
|
||||||
}.bind(this));
|
}.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}], [{
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
{
|
||||||
key: "fromEnviron",
|
key: "fromEnviron",
|
||||||
value: function fromEnviron() {
|
value: function fromEnviron() {
|
||||||
return new DroneClient(process && process.env && process.env.DRONE_SERVER, process && process.env && process.env.DRONE_TOKEN, process && process.env && process.env.DRONE_CSRF);
|
return new DroneClient(
|
||||||
|
process && process.env && process.env.DRONE_SERVER,
|
||||||
|
process && process.env && process.env.DRONE_TOKEN,
|
||||||
|
process && process.env && process.env.DRONE_CSRF
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}, {
|
},
|
||||||
|
{
|
||||||
key: "fromWindow",
|
key: "fromWindow",
|
||||||
value: function fromWindow() {
|
value: function fromWindow() {
|
||||||
return new DroneClient(window && window.DRONE_SERVER, window && window.DRONE_TOKEN, window && window.DRONE_CSRF);
|
return new DroneClient(
|
||||||
|
window && window.DRONE_SERVER,
|
||||||
|
window && window.DRONE_TOKEN,
|
||||||
|
window && window.DRONE_CSRF
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}]);
|
}
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
return DroneClient;
|
return DroneClient;
|
||||||
}();
|
})();
|
||||||
|
|
||||||
exports.default = DroneClient;
|
exports.default = DroneClient;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Encodes the values into url encoded form sorted by key.
|
* Encodes the values into url encoded form sorted by key.
|
||||||
*
|
*
|
||||||
* @param {object} query parameters in key value object.
|
* @param {object} query parameters in key value object.
|
||||||
* @return {string} query parameter string
|
* @return {string} query parameter string
|
||||||
*/
|
*/
|
||||||
var encodeQueryString = exports.encodeQueryString = function encodeQueryString() {
|
var encodeQueryString = (exports.encodeQueryString = function encodeQueryString() {
|
||||||
var params = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
var params =
|
||||||
|
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||||
|
|
||||||
return params ? Object.keys(params).sort().map(function (key) {
|
return params
|
||||||
|
? Object.keys(params)
|
||||||
|
.sort()
|
||||||
|
.map(function(key) {
|
||||||
var val = params[key];
|
var val = params[key];
|
||||||
return encodeURIComponent(key) + "=" + encodeURIComponent(val);
|
return encodeURIComponent(key) + "=" + encodeURIComponent(val);
|
||||||
}).join("&") : "";
|
})
|
||||||
};
|
.join("&")
|
||||||
|
: "";
|
||||||
|
});
|
||||||
});
|
});
|
Loading…
Reference in a new issue