Skip to content

Commit d72476d

Browse files
committed
update metadata, routing, and security configurations
1 parent 0bd76ff commit d72476d

File tree

7 files changed

+178
-25
lines changed

7 files changed

+178
-25
lines changed

.serena/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/cache

.serena/project.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# the name by which the project can be referenced within Serena
2+
project_name: "dory"
3+
4+
5+
# list of languages for which language servers are started; choose from:
6+
# al bash clojure cpp csharp
7+
# csharp_omnisharp dart elixir elm erlang
8+
# fortran fsharp go groovy haskell
9+
# java julia kotlin lua markdown
10+
# matlab nix pascal perl php
11+
# php_phpactor powershell python python_jedi r
12+
# rego ruby ruby_solargraph rust scala
13+
# swift terraform toml typescript typescript_vts
14+
# vue yaml zig
15+
# (This list may be outdated. For the current list, see values of Language enum here:
16+
# https://github.com/oraios/serena/blob/main/src/solidlsp/ls_config.py
17+
# For some languages, there are alternative language servers, e.g. csharp_omnisharp, ruby_solargraph.)
18+
# Note:
19+
# - For C, use cpp
20+
# - For JavaScript, use typescript
21+
# - For Free Pascal/Lazarus, use pascal
22+
# Special requirements:
23+
# Some languages require additional setup/installations.
24+
# See here for details: https://oraios.github.io/serena/01-about/020_programming-languages.html#language-servers
25+
# When using multiple languages, the first language server that supports a given file will be used for that file.
26+
# The first language is the default language and the respective language server will be used as a fallback.
27+
# Note that when using the JetBrains backend, language servers are not used and this list is correspondingly ignored.
28+
languages:
29+
- typescript
30+
31+
# the encoding used by text files in the project
32+
# For a list of possible encodings, see https://docs.python.org/3.11/library/codecs.html#standard-encodings
33+
encoding: "utf-8"
34+
35+
# whether to use project's .gitignore files to ignore files
36+
ignore_all_files_in_gitignore: true
37+
38+
# list of additional paths to ignore in this project.
39+
# Same syntax as gitignore, so you can use * and **.
40+
# Note: global ignored_paths from serena_config.yml are also applied additively.
41+
ignored_paths: []
42+
43+
# whether the project is in read-only mode
44+
# If set to true, all editing tools will be disabled and attempts to use them will result in an error
45+
# Added on 2025-04-18
46+
read_only: false
47+
48+
# list of tool names to exclude. We recommend not excluding any tools, see the readme for more details.
49+
# Below is the complete list of tools for convenience.
50+
# To make sure you have the latest list of tools, and to view their descriptions,
51+
# execute `uv run scripts/print_tool_overview.py`.
52+
#
53+
# * `activate_project`: Activates a project by name.
54+
# * `check_onboarding_performed`: Checks whether project onboarding was already performed.
55+
# * `create_text_file`: Creates/overwrites a file in the project directory.
56+
# * `delete_lines`: Deletes a range of lines within a file.
57+
# * `delete_memory`: Deletes a memory from Serena's project-specific memory store.
58+
# * `execute_shell_command`: Executes a shell command.
59+
# * `find_referencing_code_snippets`: Finds code snippets in which the symbol at the given location is referenced.
60+
# * `find_referencing_symbols`: Finds symbols that reference the symbol at the given location (optionally filtered by type).
61+
# * `find_symbol`: Performs a global (or local) search for symbols with/containing a given name/substring (optionally filtered by type).
62+
# * `get_current_config`: Prints the current configuration of the agent, including the active and available projects, tools, contexts, and modes.
63+
# * `get_symbols_overview`: Gets an overview of the top-level symbols defined in a given file.
64+
# * `initial_instructions`: Gets the initial instructions for the current project.
65+
# Should only be used in settings where the system prompt cannot be set,
66+
# e.g. in clients you have no control over, like Claude Desktop.
67+
# * `insert_after_symbol`: Inserts content after the end of the definition of a given symbol.
68+
# * `insert_at_line`: Inserts content at a given line in a file.
69+
# * `insert_before_symbol`: Inserts content before the beginning of the definition of a given symbol.
70+
# * `list_dir`: Lists files and directories in the given directory (optionally with recursion).
71+
# * `list_memories`: Lists memories in Serena's project-specific memory store.
72+
# * `onboarding`: Performs onboarding (identifying the project structure and essential tasks, e.g. for testing or building).
73+
# * `prepare_for_new_conversation`: Provides instructions for preparing for a new conversation (in order to continue with the necessary context).
74+
# * `read_file`: Reads a file within the project directory.
75+
# * `read_memory`: Reads the memory with the given name from Serena's project-specific memory store.
76+
# * `remove_project`: Removes a project from the Serena configuration.
77+
# * `replace_lines`: Replaces a range of lines within a file with new content.
78+
# * `replace_symbol_body`: Replaces the full definition of a symbol.
79+
# * `restart_language_server`: Restarts the language server, may be necessary when edits not through Serena happen.
80+
# * `search_for_pattern`: Performs a search for a pattern in the project.
81+
# * `summarize_changes`: Provides instructions for summarizing the changes made to the codebase.
82+
# * `switch_modes`: Activates modes by providing a list of their names
83+
# * `think_about_collected_information`: Thinking tool for pondering the completeness of collected information.
84+
# * `think_about_task_adherence`: Thinking tool for determining whether the agent is still on track with the current task.
85+
# * `think_about_whether_you_are_done`: Thinking tool for determining whether the task is truly completed.
86+
# * `write_memory`: Writes a named memory (for future reference) to Serena's project-specific memory store.
87+
excluded_tools: []
88+
89+
# list of tools to include that would otherwise be disabled (particularly optional tools that are disabled by default)
90+
included_optional_tools: []
91+
92+
# fixed set of tools to use as the base tool set (if non-empty), replacing Serena's default set of tools.
93+
# This cannot be combined with non-empty excluded_tools or included_optional_tools.
94+
fixed_tools: []
95+
96+
# list of mode names to that are always to be included in the set of active modes
97+
# The full set of modes to be activated is base_modes + default_modes.
98+
# If the setting is undefined, the base_modes from the global configuration (serena_config.yml) apply.
99+
# Otherwise, this setting overrides the global configuration.
100+
# Set this to [] to disable base modes for this project.
101+
# Set this to a list of mode names to always include the respective modes for this project.
102+
base_modes:
103+
104+
# list of mode names that are to be activated by default.
105+
# The full set of modes to be activated is base_modes + default_modes.
106+
# If the setting is undefined, the default_modes from the global configuration (serena_config.yml) apply.
107+
# Otherwise, this overrides the setting from the global configuration (serena_config.yml).
108+
# This setting can, in turn, be overridden by CLI parameters (--mode).
109+
default_modes:
110+
111+
# initial prompt for the project. It will always be given to the LLM upon activating the project
112+
# (contrary to the memories, which are loaded on demand).
113+
initial_prompt: ""

k8s/config/nginx-default.conf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ server {
88
add_header X-Content-Type-Options "nosniff" always;
99
add_header X-XSS-Protection "1; mode=block" always;
1010
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
11+
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
12+
add_header Permissions-Policy "geolocation=(), microphone=(), camera=()" always;
13+
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://fonts.googleapis.com https://us.i.posthog.com https://us-assets.i.posthog.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' data: https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' https://us.i.posthog.com; frame-ancestors 'self'" always;
1114

1215
location ^~ /docs {
1316
alias /usr/share/docs;

src/components/routes.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,27 @@ export default function Routes() {
4747
useEffect(() => {
4848
setLoading(true);
4949
const loadRoutes = async () => {
50-
// For root path, load the first navigation page
51-
const targetPath = pathname === '/' ? ALL_NAVIGATION[0].groups[0].pages[0].href : pathname;
52-
53-
const entries = await Promise.all(
54-
Object.entries(ALL_PAGES).filter(([path]) => path === targetPath).map(async ([path, loader]) => {
55-
const module = await loader();
56-
const routePath = pathname === '/' ? '/' : pathFromFilename(path);
57-
return {
58-
path: routePath,
59-
component: module.default,
60-
};
61-
})
62-
);
63-
setRoutes(entries);
64-
setLoading(false);
50+
try {
51+
// For root path, load the first navigation page
52+
const targetPath = pathname === '/' ? ALL_NAVIGATION[0].groups[0].pages[0].href : pathname;
53+
54+
const entries = await Promise.all(
55+
Object.entries(ALL_PAGES).filter(([path]) => path === targetPath).map(async ([path, loader]) => {
56+
const module = await loader();
57+
const routePath = pathname === '/' ? '/' : pathFromFilename(path);
58+
return {
59+
path: routePath,
60+
component: module.default,
61+
};
62+
})
63+
);
64+
setRoutes(entries);
65+
} catch (error) {
66+
console.error('Failed to load route:', error);
67+
setRoutes([]);
68+
} finally {
69+
setLoading(false);
70+
}
6571
};
6672

6773
loadRoutes();

src/plugins/html-metadata-injector.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export function htmlMetadataInjector(): Plugin {
2323
const siteName = config.name || 'Documentation';
2424
const defaultTitle = config.title || siteName;
2525
const defaultDescription = config.description || `${siteName} - Technical Documentation`;
26+
const siteUrl = config.url || '';
27+
const siteImage = config.image || './docs/favicon.svg';
2628

2729
// Replace title
2830
html = html.replace(
@@ -54,6 +56,20 @@ export function htmlMetadataInjector(): Plugin {
5456
`<meta property="og:site_name" content="${siteName}" />`
5557
);
5658

59+
// Replace Open Graph image
60+
html = html.replace(
61+
/<meta property="og:image" content=".*?" \/>/,
62+
`<meta property="og:image" content="${siteImage}" />`
63+
);
64+
65+
// Replace Open Graph URL
66+
if (siteUrl) {
67+
html = html.replace(
68+
/<meta property="og:url" content=".*?" \/>/,
69+
`<meta property="og:url" content="${siteUrl}" />`
70+
);
71+
}
72+
5773
// Replace Twitter title
5874
html = html.replace(
5975
/<meta name="twitter:title" content=".*?" \/>/,
@@ -66,6 +82,12 @@ export function htmlMetadataInjector(): Plugin {
6682
`<meta name="twitter:description" content="${defaultDescription}" />`
6783
);
6884

85+
// Replace Twitter image
86+
html = html.replace(
87+
/<meta name="twitter:image" content=".*?" \/>/,
88+
`<meta name="twitter:image" content="${siteImage}" />`
89+
);
90+
6991
return html;
7092
} catch (error) {
7193
console.error('❌ Failed to parse dory.json for metadata injection:', error);

src/types/config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,11 @@ export interface DoryAnalytics {
8787

8888
export interface DoryConfig {
8989
name: string;
90-
favicon: string;
90+
title?: string;
91+
description?: string;
92+
image?: string;
9193
url?: string;
94+
favicon: string;
9295
colors?: DoryColors;
9396
fonts?: DoryFonts;
9497
navigation: DoryNavigation;

src/ui/header.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,20 @@ export function Header({ className }: { className?: string }) {
6969
</div>
7070
<nav className="hidden md:block">
7171
<ul role="list" className="flex items-center gap-8">
72-
{ALL_NAVIGATION.map((tab) => (
73-
<TopLevelNavItem
74-
key={tab.title}
75-
href={tab.groups[0].pages[0].href}
76-
isActive={pathname.startsWith(`/${tab.groups[0].pages[0].href.split('/')[1]}`)}
77-
>
78-
{tab.title}
79-
</TopLevelNavItem>
80-
))}
72+
{ALL_NAVIGATION.map((tab) => {
73+
const isActive = tab.groups.some(group =>
74+
group.pages.some(page => page.href === pathname)
75+
);
76+
return (
77+
<TopLevelNavItem
78+
key={tab.title}
79+
href={tab.groups[0].pages[0].href}
80+
isActive={isActive}
81+
>
82+
{tab.title}
83+
</TopLevelNavItem>
84+
);
85+
})}
8186
</ul>
8287
</nav>
8388
<div className="hidden md:block md:h-5 md:w-px md:bg-zinc-900/10 md:dark:bg-white/15" />

0 commit comments

Comments
 (0)