Initial Commit
This commit is contained in:
parent
950050ea38
commit
eb02c6f3bd
13 changed files with 718 additions and 0 deletions
12
options/options.html
Normal file
12
options/options.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>AI Filter Options</title>
|
||||
</head>
|
||||
<body>
|
||||
<label>Endpoint: <input id="endpoint" type="text"></label><br>
|
||||
<button id="save">Save</button>
|
||||
<script src="options.js"></script>
|
||||
</body>
|
||||
</html>
|
14
options/options.js
Normal file
14
options/options.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
document.addEventListener('DOMContentLoaded', async () => {
|
||||
let { endpoint = 'http://127.0.0.1:5000/v1/classify' } = await browser.storage.local.get(['endpoint']);
|
||||
document.getElementById('endpoint').value = endpoint;
|
||||
});
|
||||
|
||||
document.getElementById('save').addEventListener('click', async () => {
|
||||
const endpoint = document.getElementById('endpoint').value;
|
||||
await browser.storage.local.set({ endpoint });
|
||||
try {
|
||||
await browser.aiFilter.initConfig({ endpoint });
|
||||
} catch (e) {
|
||||
console.error('[ai-filter][options] failed to apply config', e);
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue