mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Rename settings API endpoints
This commit is contained in:
@@ -5566,7 +5566,7 @@ async function doOnboarding(avatarId) {
|
|||||||
//***************SETTINGS****************//
|
//***************SETTINGS****************//
|
||||||
///////////////////////////////////////////
|
///////////////////////////////////////////
|
||||||
async function getSettings() {
|
async function getSettings() {
|
||||||
const response = await fetch('/getsettings', {
|
const response = await fetch('/api/settings/get', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
body: JSON.stringify({}),
|
body: JSON.stringify({}),
|
||||||
@@ -5759,7 +5759,7 @@ async function saveSettings(type) {
|
|||||||
|
|
||||||
return jQuery.ajax({
|
return jQuery.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: '/savesettings',
|
url: '/api/settings/save',
|
||||||
data: JSON.stringify({
|
data: JSON.stringify({
|
||||||
firstRun: firstRun,
|
firstRun: firstRun,
|
||||||
currentVersion: currentVersion,
|
currentVersion: currentVersion,
|
||||||
|
@@ -26,7 +26,7 @@ const defaultSettings = {
|
|||||||
|
|
||||||
//method from worldinfo
|
//method from worldinfo
|
||||||
async function updateQuickReplyPresetList() {
|
async function updateQuickReplyPresetList() {
|
||||||
const result = await fetch('/getsettings', {
|
const result = await fetch('/api/settings/get', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
body: JSON.stringify({}),
|
body: JSON.stringify({}),
|
||||||
|
@@ -441,7 +441,7 @@ async function loadWorldInfoData(name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateWorldInfoList() {
|
async function updateWorldInfoList() {
|
||||||
const result = await fetch('/getsettings', {
|
const result = await fetch('/api/settings/get', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: getRequestHeaders(),
|
headers: getRequestHeaders(),
|
||||||
body: JSON.stringify({}),
|
body: JSON.stringify({}),
|
||||||
|
@@ -332,7 +332,7 @@ app.post('/deleteuseravatar', jsonParser, function (request, response) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
app.post('/savesettings', jsonParser, function (request, response) {
|
app.post('/api/settings/save', jsonParser, function (request, response) {
|
||||||
try {
|
try {
|
||||||
writeFileAtomicSync('public/settings.json', JSON.stringify(request.body, null, 4), 'utf8');
|
writeFileAtomicSync('public/settings.json', JSON.stringify(request.body, null, 4), 'utf8');
|
||||||
response.send({ result: 'ok' });
|
response.send({ result: 'ok' });
|
||||||
@@ -394,7 +394,7 @@ function readPresetsFromDirectory(directoryPath, options = {}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Wintermute's code
|
// Wintermute's code
|
||||||
app.post('/getsettings', jsonParser, (request, response) => {
|
app.post('/api/settings/get', jsonParser, (request, response) => {
|
||||||
let settings;
|
let settings;
|
||||||
try {
|
try {
|
||||||
settings = fs.readFileSync('public/settings.json', 'utf8');
|
settings = fs.readFileSync('public/settings.json', 'utf8');
|
||||||
|
Reference in New Issue
Block a user