This commit is contained in:
Derek Reiff 2024-05-08 12:23:15 +08:00 committed by GitHub
commit e9469d442b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 6 deletions

View File

@ -402,9 +402,14 @@ export class Torrent extends EventTarget {
// maybe filter by tracker...
if (pass && tracker && tracker.length > 0) {
pass = this.getCollatedTrackers().includes(tracker);
if ('public' === tracker) {
pass = !this.getPrivateFlag();
} else if ('private' === tracker) {
pass = this.getPrivateFlag();
} else {
pass = this.getCollatedTrackers().includes(tracker);
}
}
return pass;
}

View File

@ -961,9 +961,22 @@ TODO: fix this when notifications get fixed
// build the new html
let string = '';
// All trackers option
string += this.filterTracker
? '<option value="all">All</option>'
: '<option value="all" selected="selected">All</option>';
// Public/private trackers options
string +=
this.filterTracker === 'public'
? '<option value="public" selected="selected">Public</option>'
: '<option value="public">Public</option>';
string +=
this.filterTracker === 'private'
? '<option value="private" selected="selected">Private</option>'
: '<option value="private">Private</option>';
string += '<option style="background-color: #000000;" disabled>--</option>';
for (const sitename of sitenames) {
string += `<option value="${sitename}"`;
if (sitename === this.filterTracker) {
@ -972,10 +985,7 @@ TODO: fix this when notifications get fixed
string += `>${Transmission._displayName(sitename)}</option>`;
}
if (!this.filterTrackersStr || this.filterTrackersStr !== string) {
this.filterTrackersStr = string;
document.querySelector('#filter-tracker').innerHTML = string;
}
document.querySelector('#filter-tracker').innerHTML = string;
}
/// FILTER