mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-11-29 11:57:32 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0cf98d94c4 | ||
|
|
5117a3f81c | ||
|
|
b4e5548dab |
No files matched your search
@@ -1 +0,0 @@
|
||||
Improve timeout-related code for federation and URL previews. Contributed by @Jade
|
||||
@@ -1 +0,0 @@
|
||||
Improve the display of nested configuration with the `!admin server show-config` command. Contributed by @Jade
|
||||
@@ -1759,6 +1759,10 @@
|
||||
#
|
||||
#config_reload_signal = true
|
||||
|
||||
# This item is undocumented. Please contribute documentation for it.
|
||||
#
|
||||
#ldap = false
|
||||
|
||||
[global.tls]
|
||||
|
||||
# Path to a valid TLS certificate file.
|
||||
@@ -1926,8 +1930,6 @@
|
||||
#
|
||||
#admin_filter = ""
|
||||
|
||||
[global.antispam]
|
||||
|
||||
[global.antispam.meowlnir]
|
||||
|
||||
# The base URL on which to contact Meowlnir (before /_meowlnir/antispam).
|
||||
|
||||
Generated
+250
-1256
File diff suppressed because it is too large.
Load diff
+3
-4
@@ -22,10 +22,9 @@
|
||||
"license": "ISC",
|
||||
"type": "commonjs",
|
||||
"devDependencies": {
|
||||
"@rspress/core": "^2.0.0-rc.1",
|
||||
"@rspress/plugin-client-redirects": "^2.0.0-alpha.12",
|
||||
"@rspress/plugin-preview": "^2.0.0-beta.35",
|
||||
"@rspress/plugin-sitemap": "^2.0.0-beta.23",
|
||||
"@rspress/core": "^2.0.0-rc.5",
|
||||
"@rspress/plugin-client-redirects": "^2.0.0-rc.5",
|
||||
"@rspress/plugin-sitemap": "^2.0.0-rc.5",
|
||||
"typescript": "^5.9.3"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1 @@
|
||||
tag-message = "chore: Release v{{version}}"
|
||||
tag-prefix = ""
|
||||
shared-version = true
|
||||
|
||||
publish = false
|
||||
|
||||
sign-commit = true
|
||||
sign-tag = true
|
||||
+18
-17
@@ -1,5 +1,4 @@
|
||||
import { defineConfig } from '@rspress/core';
|
||||
import { pluginPreview } from '@rspress/plugin-preview';
|
||||
import { pluginSitemap } from '@rspress/plugin-sitemap';
|
||||
import { pluginClientRedirects } from '@rspress/plugin-client-redirects';
|
||||
|
||||
@@ -41,20 +40,22 @@ export default defineConfig({
|
||||
},
|
||||
},
|
||||
|
||||
plugins: [pluginPreview(), pluginSitemap({
|
||||
siteUrl: 'https://continuwuity.org', // TODO: Set automatically in build pipeline
|
||||
}),
|
||||
pluginClientRedirects({
|
||||
redirects: [{
|
||||
from: '/configuration/examples',
|
||||
to: '/reference/config'
|
||||
}, {
|
||||
from: '/admin_reference',
|
||||
to: '/reference/admin'
|
||||
}, {
|
||||
from: '/server_reference',
|
||||
to: '/reference/server'
|
||||
}
|
||||
]
|
||||
})],
|
||||
plugins: [
|
||||
pluginSitemap({
|
||||
siteUrl: 'https://continuwuity.org', // TODO: Set automatically in build pipeline
|
||||
}),
|
||||
pluginClientRedirects({
|
||||
redirects: [{
|
||||
from: '/configuration/examples',
|
||||
to: '/reference/config'
|
||||
}, {
|
||||
from: '/admin_reference',
|
||||
to: '/reference/admin'
|
||||
}, {
|
||||
from: '/server_reference',
|
||||
to: '/reference/server'
|
||||
}
|
||||
]
|
||||
})
|
||||
],
|
||||
});
|
||||
+6
-11
@@ -53,7 +53,8 @@ use crate::{Result, err, error::Error, utils::sys};
|
||||
### For more information, see:
|
||||
### https://continuwuity.org/configuration.html
|
||||
"#,
|
||||
ignore = "config_paths catchall"
|
||||
ignore = "config_paths catchall well_known tls blurhashing \
|
||||
allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure antispam"
|
||||
)]
|
||||
pub struct Config {
|
||||
// Paths to config file(s). Not supposed to be set manually in the config file,
|
||||
@@ -104,7 +105,7 @@ pub struct Config {
|
||||
#[serde(default = "default_port")]
|
||||
port: ListeningPort,
|
||||
|
||||
/// display: nested
|
||||
// external structure; separate section
|
||||
#[serde(default)]
|
||||
pub tls: TlsConfig,
|
||||
|
||||
@@ -723,7 +724,7 @@ pub struct Config {
|
||||
#[serde(default = "default_default_room_version")]
|
||||
pub default_room_version: RoomVersionId,
|
||||
|
||||
/// display: nested
|
||||
// external structure; separate section
|
||||
#[serde(default)]
|
||||
pub well_known: WellKnownConfig,
|
||||
|
||||
@@ -2029,22 +2030,19 @@ pub struct Config {
|
||||
/// etc. This is a hidden argument that should NOT be used in production as
|
||||
/// it is highly insecure and I will personally yell at you if I catch you
|
||||
/// using this.
|
||||
///
|
||||
/// display: hidden
|
||||
#[serde(default)]
|
||||
pub allow_invalid_tls_certificates_yes_i_know_what_the_fuck_i_am_doing_with_this_and_i_know_this_is_insecure:
|
||||
bool,
|
||||
|
||||
/// display: nested
|
||||
// external structure; separate section
|
||||
#[serde(default)]
|
||||
pub ldap: LdapConfig,
|
||||
|
||||
/// Configuration for antispam support
|
||||
/// display: nested
|
||||
#[serde(default)]
|
||||
pub antispam: Option<Antispam>,
|
||||
|
||||
/// display: nested
|
||||
// external structure; separate section
|
||||
#[serde(default)]
|
||||
pub blurhashing: BlurhashConfig,
|
||||
#[serde(flatten)]
|
||||
@@ -2261,11 +2259,8 @@ struct ListeningAddr {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[config_example_generator(filename = "conduwuit-example.toml", section = "global.antispam")]
|
||||
pub struct Antispam {
|
||||
/// display: nested
|
||||
pub meowlnir: Option<MeowlnirConfig>,
|
||||
/// display: nested
|
||||
pub draupnir: Option<DraupnirConfig>,
|
||||
}
|
||||
|
||||
|
||||
+35
-69
@@ -78,8 +78,6 @@ fn generate_example(input: &ItemStruct, args: &[Meta], write: bool) -> Result<To
|
||||
}
|
||||
|
||||
let mut summary: Vec<TokenStream2> = Vec::new();
|
||||
let mut nested_displays: Vec<TokenStream2> = Vec::new();
|
||||
|
||||
if let Fields::Named(FieldsNamed { named, .. }) = &input.fields {
|
||||
for field in named {
|
||||
let Some(ident) = &field.ident else {
|
||||
@@ -94,6 +92,35 @@ fn generate_example(input: &ItemStruct, args: &[Meta], write: bool) -> Result<To
|
||||
continue;
|
||||
};
|
||||
|
||||
let doc = get_doc_comment(field)
|
||||
.unwrap_or_else(|| undocumented.into())
|
||||
.trim_end()
|
||||
.to_owned();
|
||||
|
||||
let doc = if doc.ends_with('#') {
|
||||
format!("{doc}\n")
|
||||
} else {
|
||||
format!("{doc}\n#\n")
|
||||
};
|
||||
|
||||
let default = get_doc_comment_line(field, "default")
|
||||
.or_else(|| get_default(field))
|
||||
.unwrap_or_default();
|
||||
|
||||
let default = if !default.is_empty() {
|
||||
format!(" {default}")
|
||||
} else {
|
||||
default
|
||||
};
|
||||
|
||||
if let Some(file) = file.as_mut() {
|
||||
file.write_fmt(format_args!("\n{doc}"))
|
||||
.expect("written to config file");
|
||||
|
||||
file.write_fmt(format_args!("#{ident} ={default}\n"))
|
||||
.expect("written to config file");
|
||||
}
|
||||
|
||||
let display = get_doc_comment_line(field, "display");
|
||||
let display_directive = |key| {
|
||||
display
|
||||
@@ -102,77 +129,17 @@ fn generate_example(input: &ItemStruct, args: &[Meta], write: bool) -> Result<To
|
||||
.flat_map(|display| display.split(' '))
|
||||
.any(|directive| directive == key)
|
||||
};
|
||||
let is_nested = display_directive("nested");
|
||||
let is_hidden = display_directive("hidden");
|
||||
|
||||
// Only generate config file entries for non-nested, visible types
|
||||
if !is_nested && !is_hidden {
|
||||
let doc = get_doc_comment(field)
|
||||
.unwrap_or_else(|| undocumented.into())
|
||||
.trim_end()
|
||||
.to_owned();
|
||||
|
||||
let doc = if doc.ends_with('#') {
|
||||
format!("{doc}\n")
|
||||
if !display_directive("hidden") {
|
||||
let value = if display_directive("sensitive") {
|
||||
quote! { "***********" }
|
||||
} else {
|
||||
format!("{doc}\n#\n")
|
||||
quote! { format_args!("{:?}", self.#ident) }
|
||||
};
|
||||
|
||||
let default = get_doc_comment_line(field, "default")
|
||||
.or_else(|| get_default(field))
|
||||
.unwrap_or_default();
|
||||
|
||||
let default = if !default.is_empty() {
|
||||
format!(" {default}")
|
||||
} else {
|
||||
default
|
||||
};
|
||||
|
||||
if let Some(file) = file.as_mut() {
|
||||
file.write_fmt(format_args!("\n{doc}"))
|
||||
.expect("written to config file");
|
||||
|
||||
file.write_fmt(format_args!("#{ident} ={default}\n"))
|
||||
.expect("written to config file");
|
||||
}
|
||||
}
|
||||
|
||||
// Generate Display implementation for all fields
|
||||
let name = ident.to_string();
|
||||
|
||||
if display_directive("sensitive") {
|
||||
let name = ident.to_string();
|
||||
summary.push(quote! {
|
||||
writeln!(out, "| {} | {} |", #name, "***********")?;
|
||||
});
|
||||
} else if is_nested {
|
||||
let is_option = matches!(type_name.as_str(), "Option");
|
||||
if is_option {
|
||||
summary.push(quote! {
|
||||
writeln!(out, "| {} | {} |", #name,
|
||||
if self.#ident.is_some() { "[configured]" } else { "None" })?;
|
||||
});
|
||||
|
||||
nested_displays.push(quote! {
|
||||
if let Some(nested) = &self.#ident {
|
||||
writeln!(out)?;
|
||||
writeln!(out, "## {}", #name)?;
|
||||
write!(out, "{}", nested)?;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
summary.push(quote! {
|
||||
writeln!(out, "| {} | [configured] |", #name)?;
|
||||
});
|
||||
|
||||
nested_displays.push(quote! {
|
||||
writeln!(out)?;
|
||||
writeln!(out, "## {}", #name)?;
|
||||
write!(out, "{}", &self.#ident)?;
|
||||
});
|
||||
}
|
||||
} else {
|
||||
summary.push(quote! {
|
||||
writeln!(out, "| {} | {:?} |", #name, self.#ident)?;
|
||||
writeln!(out, "| {} | {} |", #name, #value)?;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -192,7 +159,6 @@ fn generate_example(input: &ItemStruct, args: &[Meta], write: bool) -> Result<To
|
||||
writeln!(out, "| name | value |")?;
|
||||
writeln!(out, "| :--- | :--- |")?;
|
||||
#( #summary )*
|
||||
#( #nested_displays )*
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
+3
-5
@@ -1,4 +1,5 @@
|
||||
import { HomeLayout as BasicHomeLayout, DocContent } from "@rspress/core/theme";
|
||||
import "./index.css";
|
||||
import { HomeLayout as BasicHomeLayout, DocContent } from "@rspress/core/theme-original";
|
||||
|
||||
import { useFrontmatter } from '@rspress/core/runtime';
|
||||
interface HomeLayoutProps {
|
||||
@@ -6,8 +7,6 @@ interface HomeLayoutProps {
|
||||
}
|
||||
|
||||
function HomeLayout(props: HomeLayoutProps) {
|
||||
console.log(props)
|
||||
|
||||
const { frontmatter } = useFrontmatter();
|
||||
|
||||
return (
|
||||
@@ -25,5 +24,4 @@ function HomeLayout(props: HomeLayoutProps) {
|
||||
);
|
||||
}
|
||||
export { HomeLayout };
|
||||
export * from "@rspress/core/theme";
|
||||
import "./index.css";
|
||||
export * from "@rspress/core/theme-original";
|
||||
Reference in new issue
Block a user