Skip to content

Commit

Permalink
Merge pull request #10 from polarityio/develop
Browse files Browse the repository at this point in the history
INT-1296: Fix v5 regex, add copy btn, update url list
  • Loading branch information
sarus authored Aug 9, 2024
2 parents ed027ae + f8fa57f commit 5008a6a
Show file tree
Hide file tree
Showing 9 changed files with 183 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-int-dev-checklist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
jobs:
run-integration-development-checklist:
runs-on: ubuntu-latest
container: 'centos:7'
container: 'rockylinux:8'

steps:
- uses: actions/checkout@v2
Expand Down
23 changes: 22 additions & 1 deletion components/block.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
polarity.export = PolarityComponent.extend({
details: Ember.computed.alias('block.data.details')
showCopyMessage: false,
details: Ember.computed.alias('block.data.details'),
actions: {
copyData: function () {
Ember.run.scheduleOnce('afterRender', this, this.copyElementToClipboard);
}
},
copyElementToClipboard() {
let url = this.get('details.resolved_url').trim();
let defangedUrl = url.replace(/\./g, '[.]');
defangedUrl = defangedUrl.replace(/^http/, 'hxxp');

navigator.clipboard.writeText(defangedUrl).then(() => {
this.set('showCopyMessage', true);

setTimeout(() => {
if (!this.isDestroyed) {
this.set('showCopyMessage', false);
}
}, 2000);
});
}
});
4 changes: 2 additions & 2 deletions config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"description": "Un-Shorten URLs created by URL shortening services using the unshorten.me API.",
"customTypes": [
{
"key": "domain-url",
"regex": "((https|http)?:\\\\/\\\\/)?([a-zA-Z0-9-]{1,256})\\\\.([a-z]{2,10})\\\\b([-a-zA-Z0-9@:%_\\\\+.~#?&//=]*)"
"key": "domainUrl",
"regex": "((https|http)?:\\/\\/)?([a-zA-Z0-9-]{1,256})\\.([a-z]{2,10})\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)"
}
],
"defaultColor": "light-gray",
Expand Down
1 change: 0 additions & 1 deletion integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function doLookup(entities, options, cb) {
updateListJob = schedule.scheduleJob(rule, async () => {
Logger.info('Running automatic updating of MISP urlshortener list data');
await updateList.run();
Logger.info('Reloading updated urlshortener list indicators');
urlShorteners = await loadUrls();
Logger.info(`Loaded ${urlShorteners.size} url shorteners`);
});
Expand Down
149 changes: 33 additions & 116 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "Unshorten.me",
"version": "3.1.0",
"version": "3.2.0",
"main": "./integration.js",
"private": true,
"scripts": {
"update:urls": "node -e \"require('./lib/update-lists').run()\""
},
"dependencies": {
"async": "^3.2.4",
"node-schedule": "^1.3.2",
"postman-request": "^2.88.1-postman.33"
"async": "^3.2.5",
"node-schedule": "^2.1.1",
"postman-request": "^2.88.1-postman.38"
}
}
45 changes: 44 additions & 1 deletion styles/styles.less
Original file line number Diff line number Diff line change
@@ -1,8 +1,51 @@
.p-block{
.p-block {
margin-top: 5px;
background-color: #eee;
padding: 5px;
white-space: pre-wrap;
word-break: break-all;
word-wrap: break-word;
}

.copy-btn-container {
flex: 1 1 auto;
position: absolute;
right: 10px;
top: 7px;

.copy-btn {
font-size: 12px;
padding: 0px;
height: 20px;

:active {
color: darken(#388e3c, 5%);
}
}

.copy-success-message {
position: absolute;
top: 20px;
right: 0px;
background-color: rgb(222, 226, 230);
min-width: max-content;;
padding: 5px;
border-radius: 3px;

.copy-success-icon {
color: #aaa;
}

&.visible {
visibility: visible;
opacity: 1;
transition: opacity 0.25s linear;
}

&.hidden {
visibility: hidden;
opacity: 0;
transition: visibility 0s 0.25s, opacity 0.25s linear;
}
}
}
Loading

0 comments on commit 5008a6a

Please sign in to comment.