-
Notifications
You must be signed in to change notification settings - Fork 5
/
constants.js
61 lines (51 loc) · 2.12 KB
/
constants.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
const GITHUB = "github";
const GITLAB = "gitlab";
const SERVER_GH = `https://github.com`;
const SERVER_GL = `https://gitlab.com`; //TODO: make server configurable
const API_GH = `https://api.github.com`;
const API_GL = `https://gitlab.com/api/v4`;
const EXTENSION_ID = "le-git-imate";
const EMAIL_GH = `users.noreply.github.com`;
const EMAIL_GL = `users.noreply.gitlab.com`;
const TOKEN_GH = "github_token";
const TOKEN_GL = "gitlab_token";
const USER_GH = "github_user";
const USER_GL = "gitlab_user";
const UNKNOWN_REQUEST = "unknown-request";
const UNKNOWN_SERVER = "unknown-server";
const REQ_DELETE = "delete";
const REQ_EDIT = "edit";
const REQ_NEW = "new";
const REQ_UPLOAD = "upload";
const REQ_REGULAR = "regular";
const REQ_MERGE = "merge";
const MERGE_CONFLICT = "merge-conflict";
const MERGE_CLOSED = "merge-closed";
const MERGE_GH = "pull";
const MERGE_GL = "merge_requests";
const MODE_BLOB = "100644";
const MODE_TREE = "40000";
const NULL_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904";
const TYPE_BLOB = "blob";
const TYPE_COMMIT = "commit";
const TYPE_TREE = "tree";
const PGP_SIG = "gpgsig";
const PGP_START = "-----BEGIN PGP SIGNATURE-----";
const PGP_END = "-----END PGP SIGNATURE-----";
const RPACK = "git-receive-pack";
const UPACK = "git-upload-pack";
//CORS Proxy Server
const CORSPROXY = "https://cors.isomorphic-git.org";
// TODO: Put a comprehensive regex in place
const REGEX_EMAIL =
/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;
//github user regex: https://github.com/shinnn/github-username-regex#user-content-githubusernameregex
var REGEX_USER_GH = /^[a-z\d](?:[a-z\d]|-(?=[a-z\d])){0,38}$/;
//gitlab user regex: https://github.com/gitlabhq/gitlabhq/blob/master/lib/gitlab/path_regex.rb#L130
var REGEX_USER_GL = /^[a-zA-Z0-9_\-]|[a-zA-Z0-9_]$/;
/* File Path
* https://stackoverflow.com/questions/16231210/file-path-validation-in-javascript
* https://digitalfortress.tech/tricks/top-15-commonly-used-regex/
* var REGEX_PATH = /^[a-z]:((\\|\/)[a-z0-9\s_@\-^!#$%&+={}\[\]]+)+\.xml$/;
* var REGEX_PATH = /^((\/|\\|\/\/|https?:\\\\|https?:\/\/)[a-z0-9 _@\-^!#$%&+={}.\/\\\[\]]+)+\.[a-z]+$/
**/