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)) {
|
if (!this.sanity(links, media)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const selected = makeUniqueItems([
|
const type = await Prefs.get("last-type", "links");
|
||||||
await API.filter(links, TYPE_LINK),
|
const items = await (async () => {
|
||||||
await API.filter(media, TYPE_MEDIA),
|
if (type === "links") {
|
||||||
]);
|
return await API.filter(links, TYPE_LINK);
|
||||||
|
}
|
||||||
|
return await API.filter(media, TYPE_MEDIA);
|
||||||
|
})();
|
||||||
|
const selected = makeUniqueItems([items]);
|
||||||
if (!selected.length) {
|
if (!selected.length) {
|
||||||
return await this.regular(links, media);
|
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 known = new Map();
|
||||||
const unique = [];
|
const unique = [];
|
||||||
for (const itemlist of items) {
|
for (const itemlist of items) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user