-
-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
145 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import {findNode, runOnce} from 'utils/common'; | ||
import {setFileInputData, initSearch, sendReceipt} from 'utils/engines'; | ||
|
||
const engine = 'lenso'; | ||
|
||
async function search({session, search, image, storageIds}) { | ||
if (search.assetType === 'image') { | ||
const inputSelector = 'input[type=file]'; | ||
const input = await findNode(inputSelector); | ||
|
||
await setFileInputData(inputSelector, input, image); | ||
|
||
await sendReceipt(storageIds); | ||
|
||
input.dispatchEvent(new Event('change')); | ||
|
||
const modal = await findNode('.manage-consents-modal', { | ||
timeout: 10000, | ||
throwError: false | ||
}); | ||
|
||
if (modal) { | ||
( | ||
await findNode('label[for="privacy-policy"]', {rootNode: modal}) | ||
).click(); | ||
|
||
( | ||
await findNode('button.perfom-search-btn:not([disabled])', { | ||
rootNode: modal, | ||
observerOptions: {attributes: true} | ||
}) | ||
).click(); | ||
} | ||
} else { | ||
await sendReceipt(storageIds); | ||
|
||
( | ||
await findNode('.search-by-url .cta-btn', { | ||
timeout: 10000, | ||
throwError: false | ||
}) | ||
).click(); | ||
} | ||
} | ||
|
||
function init() { | ||
initSearch(search, engine, taskId); | ||
} | ||
|
||
if (runOnce('search')) { | ||
init(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
src/storage/revisions/local/20250102095603_add_lenso.ai.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const message = 'Add Lenso.ai'; | ||
|
||
const revision = '20250102095603_add_lenso.ai'; | ||
|
||
async function upgrade() { | ||
const changes = {}; | ||
const {engines, disabledEngines} = await browser.storage.local.get([ | ||
'engines', | ||
'disabledEngines' | ||
]); | ||
const newEngine = 'lenso'; | ||
|
||
const enabledEngineCount = engines.length - disabledEngines.length; | ||
|
||
engines.splice(1, 0, newEngine); | ||
changes.engines = engines; | ||
|
||
if (enabledEngineCount <= 1) { | ||
disabledEngines.push(newEngine); | ||
} | ||
if (enabledEngineCount === 8 && !disabledEngines.includes('alamy')) { | ||
disabledEngines.push('alamy'); | ||
} | ||
changes.disabledEngines = disabledEngines; | ||
|
||
changes.storageVersion = revision; | ||
return browser.storage.local.set(changes); | ||
} | ||
|
||
export {message, revision, upgrade}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters