Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom domains #3

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"dependencies": {
"is-valid-domain": "0.0.14"
},
"devDependencies": {
"webpack-plugin": "^1.0.5"
}
}
13 changes: 13 additions & 0 deletions prefs/prefs.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<html>
<head>
<title>Copy JIRA ID Settings.</title>
</head>
<body>
By default this extension supports jira.com and atlassian.net domains.
You can add your custom domains below for self-hosted JIRA.
If you have multiple domains, you can add them separated by a comma.

<input type="text" id="field-custom-domains">
<input type="button" onclick="">
</body>
</html>
23 changes: 23 additions & 0 deletions prefs/prefs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const isValidDomain = require('is-valid-domain')


savePrefs = () => {
const customDomains = document.getElementById("field-custom-domains").value;
const invalidDomains = [];
const validDomains = [];
customDomains.split(',').forEach(domain => {
if(domain.trim() && isValidDomain(domain, {subdomain : true, wildcard: false})){
validDomains.push(domain);
}else{
if(domain.trim()){
invalidDomains.push(domain);
}
}
});
if(invalidDomains.length){

}else{
saveDomains(validDomains);
}
}

Empty file added webpack.js
Empty file.