diff --git a/README.md b/README.md
index 98ae9be72..7493d557d 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ _✨ 易上手的多平台 LLM 聊天机器人及开发框架 ✨_
[](https://wakatime.com/badge/user/915e5316-99c6-4563-a483-ef186cf000c9/project/018e705a-a1a7-409a-a849-3013485e6c8e)
-
+
English |
日本語 |
@@ -46,7 +46,7 @@ AstrBot 是一个松耦合、异步、支持多消息平台部署、具有易用
> [!TIP]
> 管理面板在线体验 Demo: [https://demo.astrbot.app/](https://demo.astrbot.app/)
>
-> 用户名: `astrbot`, 密码: `astrbot`。未配置 LLM,无法在聊天页使用大模型。(不要再修改 demo 的登录密码了 😭)
+> 用户名: `astrbot`, 密码: `astrbot`。未配置 LLM,无法在聊天页使用大模型。
## ✨ 使用方式
diff --git a/astrbot/core/__init__.py b/astrbot/core/__init__.py
index 9749dee24..cfedf92e5 100644
--- a/astrbot/core/__init__.py
+++ b/astrbot/core/__init__.py
@@ -24,3 +24,4 @@ pip_installer = PipInstaller(astrbot_config.get("pip_install_arg", ""))
web_chat_queue = asyncio.Queue(maxsize=32)
web_chat_back_queue = asyncio.Queue(maxsize=32)
WEBUI_SK = "Advanced_System_for_Text_Response_and_Bot_Operations_Tool"
+DEMO_MODE = os.getenv("DEMO_MODE", False)
diff --git a/astrbot/dashboard/routes/auth.py b/astrbot/dashboard/routes/auth.py
index 34ba8fd3f..896bea4e7 100644
--- a/astrbot/dashboard/routes/auth.py
+++ b/astrbot/dashboard/routes/auth.py
@@ -2,7 +2,7 @@ import jwt
import datetime
from .route import Route, Response, RouteContext
from quart import request
-from astrbot.core import WEBUI_SK
+from astrbot.core import WEBUI_SK, DEMO_MODE
from astrbot import logger
@@ -40,6 +40,13 @@ class AuthRoute(Route):
return Response().error("用户名或密码错误").__dict__
async def edit_account(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
password = self.config["dashboard"]["password"]
post_data = await request.json
diff --git a/astrbot/dashboard/routes/plugin.py b/astrbot/dashboard/routes/plugin.py
index 32dc99176..3ffa1c557 100644
--- a/astrbot/dashboard/routes/plugin.py
+++ b/astrbot/dashboard/routes/plugin.py
@@ -15,6 +15,7 @@ from astrbot.core.star.filter.command_group import CommandGroupFilter
from astrbot.core.star.filter.permission import PermissionTypeFilter
from astrbot.core.star.filter.regex import RegexFilter
from astrbot.core.star.star_handler import EventType
+from astrbot.core import DEMO_MODE
class PluginRoute(Route):
@@ -50,6 +51,13 @@ class PluginRoute(Route):
}
async def reload_plugins(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
data = await request.json
plugin_name = data.get("name", None)
try:
@@ -187,6 +195,13 @@ class PluginRoute(Route):
return handlers
async def install_plugin(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
post_data = await request.json
repo_url = post_data["url"]
@@ -205,6 +220,13 @@ class PluginRoute(Route):
return Response().error(str(e)).__dict__
async def install_plugin_upload(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
try:
file = await request.files
file = file["file"]
@@ -220,6 +242,13 @@ class PluginRoute(Route):
return Response().error(str(e)).__dict__
async def uninstall_plugin(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
post_data = await request.json
plugin_name = post_data["name"]
try:
@@ -232,6 +261,13 @@ class PluginRoute(Route):
return Response().error(str(e)).__dict__
async def update_plugin(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
post_data = await request.json
plugin_name = post_data["name"]
proxy: str = post_data.get("proxy", None)
@@ -247,6 +283,13 @@ class PluginRoute(Route):
return Response().error(str(e)).__dict__
async def off_plugin(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
post_data = await request.json
plugin_name = post_data["name"]
try:
@@ -258,6 +301,13 @@ class PluginRoute(Route):
return Response().error(str(e)).__dict__
async def on_plugin(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
post_data = await request.json
plugin_name = post_data["name"]
try:
diff --git a/astrbot/dashboard/routes/stat.py b/astrbot/dashboard/routes/stat.py
index e73c09455..337e544af 100644
--- a/astrbot/dashboard/routes/stat.py
+++ b/astrbot/dashboard/routes/stat.py
@@ -8,6 +8,7 @@ from quart import request
from astrbot.core.core_lifecycle import AstrBotCoreLifecycle
from astrbot.core.db import BaseDatabase
from astrbot.core.config import VERSION
+from astrbot.core import DEMO_MODE
class StatRoute(Route):
@@ -29,6 +30,13 @@ class StatRoute(Route):
self.core_lifecycle = core_lifecycle
async def restart_core(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
await self.core_lifecycle.restart()
return Response().ok().__dict__
diff --git a/astrbot/dashboard/routes/update.py b/astrbot/dashboard/routes/update.py
index e9ada18f5..bd0782088 100644
--- a/astrbot/dashboard/routes/update.py
+++ b/astrbot/dashboard/routes/update.py
@@ -6,6 +6,7 @@ from astrbot.core.updator import AstrBotUpdator
from astrbot.core import logger, pip_installer
from astrbot.core.utils.io import download_dashboard, get_dashboard_version
from astrbot.core.config.default import VERSION
+from astrbot.core import DEMO_MODE
class UpdateRoute(Route):
@@ -126,6 +127,13 @@ class UpdateRoute(Route):
return Response().error(e.__str__()).__dict__
async def install_pip_package(self):
+ if DEMO_MODE:
+ return (
+ Response()
+ .error("You are not permitted to do this operation in demo mode")
+ .__dict__
+ )
+
data = await request.json
package = data.get("package", "")
if not package: