Allow read-only installation

Fix #3453.

Thanks to #3499, #3500 and #3521, most of the obstacles to read-only installation have been resolved. This PR addresses the final piece, ensuring that SillyTavern no longer changes directories to `serverDirectory` and outputs files there. Instead, it outputs or copies necessary files to the directory where it is being run. Now, `serverDirectory` is read-only for SillyTavern (i.e., SillyTavern will not attempt to modify `serverDirectory`). Additionally, this PR sets the permissions for copied `default-user` files to be writable, so even if SillyTavern is installed as read-only, the copied `default-user` folder can still be modified.
This commit is contained in:
wrvsrx
2025-04-15 20:20:35 +08:00
parent 5510e6da31
commit bf97686dfc
9 changed files with 55 additions and 73 deletions

View File

@ -1,6 +1,7 @@
import process from 'node:process';
import path from 'node:path';
import isDocker from 'is-docker';
import { serverDirectory } from './src/server-directory.js';
/**
* Get the Webpack configuration for the public/lib.js file.
@ -40,7 +41,7 @@ export default function getPublicLibConfig(forceDist = false) {
return {
mode: 'production',
entry: './public/lib.js',
entry: path.join(serverDirectory, 'public/lib.js'),
cache: {
type: 'filesystem',
cacheDirectory: cacheDirectory,