add cookie on web

This commit is contained in:
Nyagami
2024-01-14 22:03:37 +07:00
parent 73bb7e9509
commit 8e3909c1d2
4 changed files with 69 additions and 26 deletions
+8
View File
@@ -50,6 +50,14 @@
</script>
</nav>
<div id="test-container">
<div class="test-wrapper" id="add-cookie">
<div class="form-group">
<label for="cookie">Cookie 🍪</label> <span id="cookie-content"></span>
<input type="email" class="form-control" id="cookie" aria-describedby="cookieHelp" placeholder="cf_clearance=abcxyzblalba">
<small id="cookieHelp" class="form-text text-muted">Add cookie into headers to bypass cloudflare</small>
<button type="button" class="btn btn-primary" id="add-cookie-btn">Add</button>
</div>
</div>
<div class="test-wrapper" id="popularNovels">
<div class="modal-container">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#filtersModal">
+17
View File
@@ -922,6 +922,23 @@ class PluginWrapper {
}
}
$("#add-cookie-btn").on("click", () => {
const cookie = $('#cookie').val();
fetch('/add_cookie', {
method: 'POST',
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
'cookie': cookie,
}),
}).then(() => {
$('#cookie').val('');
$('#cookie-content').text(`: ${cookie}`);
})
})
$(".popularNovels-btn").on("click", () =>
state.current_plugin?.getPopularNovels()
);