Skip to content

Commit

Permalink
1.17.2 - Some bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tumblfeed committed Oct 9, 2022
1 parent f604873 commit 11e0c1a
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 35 deletions.
4 changes: 3 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ const gSass = require('gulp-sass');
const gSourcemaps = require('gulp-sourcemaps');
const gZip = require('gulp-zip');

const package = require('./package.json');

// Config & Helpers

const paths = {
Expand Down Expand Up @@ -104,7 +106,7 @@ function sass() {
*/
function zip() {
return src(`${paths.build}/**/*`)
.pipe(gZip('nzbunity.zip'))
.pipe(gZip(`nzbunity-${package.version}.zip`))
.pipe(dest(paths.dist));
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nzbunity",
"version": "1.17.1",
"version": "1.17.2",
"license": "MPL-2.0",
"description": "Send and control NZB files directly with SABnzbd or NZBGet download clients.",
"author": "tumblfeed@gmail.com",
Expand Down
16 changes: 7 additions & 9 deletions src/content/css/popup.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ body {
font-size: 13px;
overflow-x: hidden;
width: 380px;
max-height: 380px;
}

select, input, .btn {
Expand Down Expand Up @@ -44,7 +43,7 @@ input {
color: $dark-blue;
float: right;
font-size: 10px;
margin-top: -5px;
margin-top: -5px;
}

#profile {
Expand Down Expand Up @@ -138,8 +137,8 @@ input {
border-top: 1px solid $dark-blue;
}

&:nth-child(odd) {
}
// &:nth-child(odd) {
// }

span {
display: block;
Expand All @@ -155,8 +154,8 @@ input {
margin-left: 5px;
}

.category {
}
// .category {
// }

.size {
margin-right: 5px;
Expand All @@ -181,7 +180,6 @@ input {
font-family: monospace;
font-size: 11px;
line-height: 13px;
margin: 10px 0;
max-height: 220px;
min-height: 120px;
overflow: scroll;
Expand All @@ -195,7 +193,7 @@ input {

#menu {
@extend .flex-row;
margin: 10px 0;
padding: 10px 0;

.btn {
flex-grow: 0;
Expand Down Expand Up @@ -232,4 +230,4 @@ body.theme-light {
background: linear-gradient(to left, $blue 0%, $light-blue 100%);
}
}
}
}
16 changes: 16 additions & 0 deletions src/content/popup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,22 @@ class Popup {
// Queue
this.queue.empty();

// For testing large queues
// for (let i = 0; i < 40; i++) {
// queue.queue.push({
// id: `test${i}`,
// status: 'Downloading',
// name: `test item ${i}`,
// category: 'test',
// size: '0MB',
// sizeBytes: 0,
// sizeRemaining: '0MB',
// sizeRemainingBytes: 0,
// timeRemaining: '0s',
// percentage: Math.floor(Math.random() * 100),
// });
// }

if (queue.queue.length) {
queue.queue.forEach((item) => {
// console.log(i);
Expand Down
37 changes: 17 additions & 20 deletions src/content/sites/omgwtfnzbs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,34 @@ class NZBUnityOmgwtfnzbs {
if (enabled) {
console.info(`[NZB Unity] Initializing 1-click functionality...`);

this.username = this.getUsername();
this.apiurl = `${window.location.protocol}//api.omgwtfnzbs.me/nzb/`;
this.username = this.getUsername();
this.apikey = this.getApiKey();

this.getApiKey()
.then((apikey) => {
this.apikey = apikey;

if (this.username && this.apikey) {
console.info(`Got username and api key: ${this.username}, ${this.apikey}`);
this.initializeLinks();
} else {
console.warn('Could not get API key');
}
});
if (this.username && this.apikey) {
console.info(`Got username and api key: ${this.username}, ${this.apikey}`);
this.initializeLinks();
} else {
console.warn('Could not get API key');
}
} else {
console.info(`[NZB Unity] 1-click functionality disabled for this site`);
}
});
}

getUsername():string {
return $('a[href="/account"]')[0].innerText;
// Username is in an html comment that looks like:
// <!---<extention_user>somebody</extention_user>-->
const match = document.body.innerHTML.match(/<extention_user>(.*?)<\/extention_user>/);
return match ? match[1].trim() : null;
}

getApiKey():Promise<string> {
return PageUtil.request({ url: '/account' })
.then((r) => {
let el = $(r).find('a[href="account?action=api"]');
let api:string = el.length ? el[0].innerText : null;
return api.match(/^[a-f0-9]+$/i) ? api : null; // api key must be hex
})
getApiKey():string {
// API key is in an html comment that looks like:
// <!---<extention_api>deadbeefcafe1234</extention_api>-->
const match = document.body.innerHTML.match(/<extention_api>(.*?)<\/extention_api>/);
return match ? match[1].trim() : null;
}

getNzbUrl(id:string):string {
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "NZB Unity",
"version": "1.17.1",
"version": "1.17.2",
"author": "tumblfeed@gmail.com",
"description": "Send and control NZB files directly with SABnzbd or NZBGet download clients.",
"background": {
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -829,9 +829,9 @@ __metadata:
linkType: hard

"caniuse-lite@npm:^1.0.30001109, caniuse-lite@npm:^1.0.30001280":
version: 1.0.30001280
resolution: "caniuse-lite@npm:1.0.30001280"
checksum: 5794b22f4254927f095e83c65e89ddfc63065c7ed16e6544555a3252ee3d16e48f8a7846713dc64869c52e1abe9a2a93161804b40c2097d1abc9aaa0155a0b65
version: 1.0.30001418
resolution: "caniuse-lite@npm:1.0.30001418"
checksum: 03380a9ba50b1abd0081e76bfdf331bfb2c28f2277ce5eead5b83960c4db9f1fbbd84a536efa6f8f1fe2c038bc01129d6c42d17f8323fe99a016a5da3829c4bc
languageName: node
linkType: hard

Expand Down

0 comments on commit 11e0c1a

Please sign in to comment.