Extract server endpoints for thumbnails and extensions into separate files

This commit is contained in:
Cohee
2023-09-16 16:16:48 +03:00
parent 2d774f32b2
commit 6e562bd1ff
6 changed files with 499 additions and 423 deletions

View File

@ -206,7 +206,7 @@ async function doExtrasFetch(endpoint, args) {
async function discoverExtensions() {
try {
const response = await fetch('/discover_extensions');
const response = await fetch('/api/extensions/discover');
if (response.ok) {
const extensions = await response.json();
@ -631,7 +631,7 @@ async function onUpdateClick() {
/**
* Handles the click event for the delete button of an extension.
* This function makes a POST request to '/delete_extension' with the extension's name.
* This function makes a POST request to '/api/extensions/delete' with the extension's name.
* If the extension is deleted, it displays a success message.
* Creates a popup for the user to confirm before delete.
*/
@ -641,7 +641,7 @@ async function onDeleteClick() {
const confirmation = await callPopup(`Are you sure you want to delete ${extensionName}?`, 'delete_extension');
if (confirmation) {
try {
const response = await fetch('/delete_extension', {
const response = await fetch('/api/extensions/delete', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ extensionName })
@ -668,7 +668,7 @@ async function onDeleteClick() {
*/
async function getExtensionVersion(extensionName) {
try {
const response = await fetch('/get_extension_version', {
const response = await fetch('/api/extensions/version', {
method: 'POST',
headers: getRequestHeaders(),
body: JSON.stringify({ extensionName })