Select the proper turbo list
This commit is contained in:
parent
26cd8e8a00
commit
176060183e
12
lib/api.ts
12
lib/api.ts
@ -91,10 +91,14 @@ export const API = new class {
|
||||
if (!this.sanity(links, media)) {
|
||||
return false;
|
||||
}
|
||||
const selected = makeUniqueItems([
|
||||
await API.filter(links, TYPE_LINK),
|
||||
await API.filter(media, TYPE_MEDIA),
|
||||
]);
|
||||
const type = await Prefs.get("last-type", "links");
|
||||
const items = await (async () => {
|
||||
if (type === "links") {
|
||||
return await API.filter(links, TYPE_LINK);
|
||||
}
|
||||
return await API.filter(media, TYPE_MEDIA);
|
||||
})();
|
||||
const selected = makeUniqueItems([items]);
|
||||
if (!selected.length) {
|
||||
return await this.regular(links, media);
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ function transfer(e: any, other: any) {
|
||||
}
|
||||
|
||||
|
||||
export function makeUniqueItems(items: any, mapping?: Function) {
|
||||
export function makeUniqueItems(items: any[][], mapping?: Function) {
|
||||
const known = new Map();
|
||||
const unique = [];
|
||||
for (const itemlist of items) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user