Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OneBot] Add Configure Schema #739

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lagrange.OneBot/Resources/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"$schema": "https://raw.githubusercontent.com/LagrangeDev/Lagrange.Core/master/Lagrange.OneBot/Resources/appsettings_schema.json",
"Logging": {
"LogLevel": {
"Default": "Information",
Expand Down
392 changes: 392 additions & 0 deletions Lagrange.OneBot/Resources/appsettings_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,392 @@
{
"$schema": "https://json-schema.org/draft-07/hyper-schema#",
"allOf": [
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"properties": {
"Logging": {
"$ref": "#/definitions/logging"
}
}
},
{
"type": "object",
"properties": {
"Account": {
"type": "object",
"properties": {
"Uin": {
"type": "integer",
"minimum": 0,
"description": "Uin, Only used to create lagrange-{uin}.db and qr-{uin}.png",
"default": 0
},
"Protocol": {
"type": "string",
"enum": [
"Linux",
"Windows",
"MacOs"
],
"description": "Protocol Platform",
"default": "Linux"
},
"AutoReconnect": {
"type": "boolean",
"description": "Whether to auto reconnect",
"default": true
},
"UseIPv6Network": {
"type": "boolean",
"description": "Whether to use IPv6, IPv6 implementation has an exception",
"default": false
},
"GetOptimumServer": {
"type": "boolean",
"description": "Whether to get optimum server",
"default": true
},
"AutoReLogin": {
"type": "boolean",
"description": "Whether to auto relogin",
"default": true
}
}
},
"ConfigPath": {
"type": "object",
"properties": {
"Keystore": {
"type": "string",
"description": "Keystore file location",
"default": "keystore.json"
},
"DeviceInfo": {
"type": "string",
"description": "device file location",
"default": "device.json"
},
"Database": {
"type": "string",
"description": "database file location",
"default": "lagrange.db"
},
"AppInfo": {
"type": "string",
"description": "appinfo file location",
"default": "appinfo.db"
}
}
},
"MusicSignServerUrl": {
"type": "string",
"description": "Music signer url",
"default": ""
},
"SignServerUrl": {
"type": "string",
"description": "Signer url",
"default": ""
},
"SignProxyUrl": {
"type": "string",
"description": "Signer proxy url, only support HTTP proxy",
"default": ""
},
"Message": {
"type": "object",
"properties": {
"IgnoreSelf": {
"type": "boolean",
"description": "Whether to ignore self",
"default": false
},
"StringPost": {
"type": "boolean",
"description": "Whether to post by string",
"default": false
}
}
},
"QrCode": {
"type": "object",
"properties": {
"ConsoleCompatibilityMode": {
"type": "boolean",
"description": "Whether to show compatibility qrcode",
"default": false
}
}
},
"Implementations": {
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": [
"ReverseWebSocket"
],
"description": "Implementation type"
},
"Host": {
"type": "string",
"description": "WS connect host"
},
"Port": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"Suffix": {
"type": "string",
"description": "WS path"
},
"ReconnectInterval": {
"type": "integer",
"minimum": 0,
"description": "Reconnect interval"
},
"HeartBeatInterval": {
"type": "integer",
"minimum": 0,
"description": "Heart beat interval, 0 to disable"
},
"HeartBeatEnable": {
"type": "boolean",
"description": "Whether to send heart beat"
},
"AccessToken": {
"type": "string",
"description": "Access token"
}
},
"description": "Implementation"
},
{
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": [
"ForwardWebSocket"
],
"description": "Implementation type"
},
"Host": {
"type": "string",
"description": "WS bind host"
},
"Port": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"HeartBeatInterval": {
"type": "integer",
"minimum": 0,
"description": "Heart beat interval, 0 to disable"
},
"HeartBeatEnable": {
"type": "boolean",
"description": "Whether to send heart beat"
},
"AccessToken": {
"type": "string",
"description": "Access token"
}
},
"description": "Implementation"
},
{
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": [
"HttpPost"
],
"description": "Implementation type"
},
"Host": {
"type": "string",
"description": "Http connect host"
},
"Port": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"Suffix": {
"type": "string",
"description": "Http path"
},
"HeartBeatInterval": {
"type": "integer",
"minimum": 0,
"description": "Heart beat interval, 0 to disable"
},
"HeartBeatEnable": {
"type": "boolean",
"description": "Whether to send heart beat"
},
"AccessToken": {
"type": "string",
"description": "Access token"
}
},
"description": "Implementation"
},
{
"type": "object",
"properties": {
"Type": {
"type": "string",
"enum": [
"Http"
],
"description": "Implementation type"
},
"Host": {
"type": "string",
"description": "Http bind host"
},
"Port": {
"type": "integer",
"minimum": 0,
"maximum": 65535
},
"AccessToken": {
"type": "string",
"description": "Access token"
}
},
"description": "Implementation"
}
]
},
"description": "Implementation to use"
}
}
}
],
"definitions": {
"logging": {
"title": "logging options",
"type": "object",
"description": "Configuration for Microsoft.Extensions.Logging.",
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
},
"Console": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
},
"FormatterName": {
"description": "Name of the log message formatter to use. Defaults to 'simple'.",
"type": "string",
"default": "simple"
},
"FormatterOptions": {
"title": "formatter options",
"description": "Log message formatter options. Additional properties are available on the options depending on the configured formatter. The formatter is specified by FormatterName.",
"type": "object",
"properties": {
"IncludeScopes": {
"description": "Include scopes when true. Defaults to false.",
"type": "boolean",
"default": false
},
"TimestampFormat": {
"description": "Format string used to format timestamp in logging messages. Defaults to null.",
"type": "string"
},
"UseUtcTimestamp": {
"description": "Indication whether or not UTC timezone should be used to for timestamps in logging messages. Defaults to false.",
"type": "boolean",
"default": false
}
}
},
"LogToStandardErrorThreshold": {
"$ref": "#/definitions/logLevelThreshold",
"description": "The minimum level of messages are written to Console.Error."
}
}
},
"EventSource": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
},
"Debug": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
},
"EventLog": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
},
"ElmahIo": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
},
"ElmahIoBreadcrumbs": {
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
}
},
"additionalProperties": {
"title": "provider logging settings",
"type": "object",
"description": "Logging configuration for a provider. The provider name must match the configuration's JSON property property name.",
"properties": {
"LogLevel": {
"$ref": "#/definitions/logLevel"
}
}
}
},
"logLevel": {
"title": "logging level options",
"description": "Log level configurations used when creating logs. Only logs that exceeds its matching log level will be enabled. Each log level configuration has a category specified by its JSON property name. For more information about configuring log levels, see https://docs.microsoft.com/aspnet/core/fundamentals/logging/#configure-logging.",
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/logLevelThreshold"
}
},
"logLevelThreshold": {
"description": "Log level threshold.",
"type": "string",
"enum": [
"Trace",
"Debug",
"Information",
"Warning",
"Error",
"Critical",
"None"
]
}
}
}
Loading