mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Extras: Add API authentication support
An API key is extremely important for ST-Extras servers that are exposed to the internet. Add an API key field below where the user enters the extras URL. For convenience, this key is persisted whenever the user refreshes the page. Also modify the fetch requests to always include API keys if present. See ST-Extras for more information on how this works. Signed-off-by: kingbri <bdashore3@proton.me>
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
import { getStringHash, debounce } from "../../utils.js";
|
||||
import { getContext, getApiUrl, extension_settings, ModuleWorkerWrapper } from "../../extensions.js";
|
||||
import { getContext, getApiUrl, extension_settings, ModuleWorkerWrapper, doExtrasFetch } from "../../extensions.js";
|
||||
import { extension_prompt_types, is_send_press, saveSettingsDebounced } from "../../../script.js";
|
||||
export { MODULE_NAME };
|
||||
|
||||
@ -232,7 +232,7 @@ async function summarizeChat(context) {
|
||||
const url = new URL(getApiUrl());
|
||||
url.pathname = '/api/summarize';
|
||||
|
||||
const apiResult = await fetch(url, {
|
||||
const apiResult = await doExtrasFetch(url, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
|
Reference in New Issue
Block a user