Skip to content

Commit

Permalink
fix: update PimEyes
Browse files Browse the repository at this point in the history
  • Loading branch information
dessant committed Oct 29, 2023
1 parent 02751d9 commit 53e7301
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 22 deletions.
39 changes: 22 additions & 17 deletions src/engines/pimeyes.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,31 @@ async function search({session, search, image, storageIds}) {

input.dispatchEvent(new Event('change'));

const searchButton = await findNode('.start-search-inner > button');

if (searchButton.classList.contains('disabled')) {
await findNode('.permissions input[type=checkbox]');
const searchButton = await findNode('.start-search-inner > button', {
throwError: false
});

for (const checkbox of document.querySelectorAll(
'.permissions input[type=checkbox]'
)) {
if (!checkbox.checked) {
checkbox.click();
// button is missing when no faces were detected
if (searchButton) {
if (searchButton.classList.contains('disabled')) {
await findNode('.permissions input[type=checkbox]');

for (const checkbox of document.querySelectorAll(
'.permissions input[type=checkbox]'
)) {
if (!checkbox.checked) {
checkbox.click();
}
}
}

(
await findNode('.start-search-inner > button:not(.disabled)', {
observerOptions: {attributes: true, attributeFilter: ['class']}
})
).click();
} else {
searchButton.click();
(
await findNode('.start-search-inner > button:not(.disabled)', {
observerOptions: {attributes: true, attributeFilter: ['class']}
})
).click();
} else {
searchButton.click();
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,9 @@ async function getPlatform({fallback = true} = {}) {
}));
} catch (err) {
if (fallback) {
({os, arch} = await browser.runtime.sendMessage({
({
response: {os, arch}
} = await browser.runtime.sendMessage({
id: 'sendNativeMessage',
message: {id: 'getPlatform'}
}));
Expand Down Expand Up @@ -520,13 +522,11 @@ async function shareFiles(files) {
}

async function isAndroid() {
const {os} = await getPlatform();
return os === 'android';
return (await getPlatform()).isAndroid;
}

async function isMobile() {
const {os} = await getPlatform();
return ['android', 'ios', 'ipados'].includes(os);
return (await getPlatform()).isMobile;
}

function getDarkColorSchemeQuery() {
Expand Down

0 comments on commit 53e7301

Please sign in to comment.