Add support for multilingual legal pages with English aliases, dynamic link replacement in headers, and redirections for alias routes. Update tests, configs, and frontend assets accordingly.
This commit is contained in:
1 parent
5f3ff481b4
commit
5305687f98
16 files changed
+150
-38
No files matched your search
@@ -91,7 +91,7 @@ fails if they do not become healthy. Every update is another
|
||||
| `CONTENT_DIR` | asked on the first deploy |
|
||||
| `JOBS_HOST_DIR` | `/srv`, mounted read only into the jobs service |
|
||||
| `SITE_URL` | `https://security-command.org` |
|
||||
| `LEGAL_PAGES` | `impressum:impressum.txt,datenschutz:datenschutz.txt` |
|
||||
| `LEGAL_PAGES` | `impressum/imprint:impressum.md,datenschutz/privacy:datenschutz.md` |
|
||||
| `REGISTRY` | `git.security-command.org/securitycommand` |
|
||||
| `BACKEND_PORT` | `8380`, must match the nginx config |
|
||||
| `ALLOWED_ORIGINS` | `https://security-command.org` |
|
||||
@@ -108,13 +108,14 @@ on the static site after two quiet seconds. Update it in place, for example
|
||||
with `git pull`, instead of replacing the directory, because running
|
||||
containers keep the mount of the old one.
|
||||
|
||||
- `motd` is shown on the boot screen and at login.
|
||||
- The legal pages from `LEGAL_PAGES` are rendered at `/impressum` and
|
||||
`/datenschutz` and linked in the header.
|
||||
`/datenschutz` and linked in the header. The English aliases `/imprint`
|
||||
and `/privacy` redirect to them, and browsers that do not prefer German
|
||||
show those names in the header.
|
||||
- Dotfiles, dot directories and symlinks are skipped.
|
||||
- Top level names used by the site itself (`ws`, `raw`, `ls`, `assets`,
|
||||
`healthz`, `sitemap.xml`, `robots.txt`, the legal routes) are skipped
|
||||
with a warning in the backend log.
|
||||
`healthz`, `sitemap.xml`, `robots.txt`, the legal routes and aliases)
|
||||
are skipped with a warning in the backend log.
|
||||
- Files above 1 MB are listed but not served; the whole index is capped at
|
||||
64 MB and 10 000 entries.
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { mkdtempSync, writeFileSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join } from 'node:path';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { readTheme } from './assets.ts';
|
||||
import { readTheme, setLegalLinks, type Asset } from './assets.ts';
|
||||
|
||||
describe('readTheme', () => {
|
||||
const base = Buffer.from(':root { --text: white; }');
|
||||
@@ -19,3 +19,26 @@ describe('readTheme', () => {
|
||||
expect(await readTheme(undefined, '/nonexistent/theme.css')).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('setLegalLinks', () => {
|
||||
const page = (): Map<string, Asset> =>
|
||||
{
|
||||
const index = { body: Buffer.from('<header><nav><a href="/impressum">impressum</a></nav></header>'), type: 'text/html', immutable: false };
|
||||
return new Map([['/index.html', index], ['/', index]]);
|
||||
};
|
||||
|
||||
it('links only the configured legal pages, with their English names', () => {
|
||||
const assets = page();
|
||||
setLegalLinks(assets, [{ route: 'datenschutz', aliases: ['privacy'], file: 'datenschutz.md' }]);
|
||||
|
||||
expect(assets.get('/')?.body.toString()).toBe('<header><nav><a href="/datenschutz" data-en="privacy">datenschutz</a></nav></header>');
|
||||
expect(assets.get('/index.html')).toBe(assets.get('/'));
|
||||
});
|
||||
|
||||
it('leaves the header empty without legal pages', () => {
|
||||
const assets = page();
|
||||
setLegalLinks(assets, []);
|
||||
|
||||
expect(assets.get('/')?.body.toString()).toBe('<header><nav></nav></header>');
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,7 @@
|
||||
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { extname, join, relative, sep } from 'node:path';
|
||||
import type { Font } from '@homepage/indexer';
|
||||
import { escapeHtml, type Font, type LegalPage } from '@homepage/indexer';
|
||||
|
||||
export type Asset = {
|
||||
body: Buffer;
|
||||
@@ -53,6 +53,27 @@ export function loadAssets(directory: string): Map<string, Asset>
|
||||
return assets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes the configured legal pages into the header of the terminal page,
|
||||
* which the frontend build cannot know. Without legal pages the header has no links.
|
||||
*/
|
||||
export function setLegalLinks(assets: Map<string, Asset>, legal: LegalPage[]): void
|
||||
{
|
||||
const index = assets.get('/index.html');
|
||||
if (!index) return;
|
||||
|
||||
const links = legal.map((page) =>
|
||||
{
|
||||
const english = page.aliases[0] ? ` data-en="${escapeHtml(page.aliases[0])}"` : '';
|
||||
return `<a href="/${escapeHtml(page.route)}"${english}>${escapeHtml(page.route)}</a>`;
|
||||
});
|
||||
|
||||
const html = index.body.toString('utf8').replace(/<nav>[\s\S]*?<\/nav>/, `<nav>${links.join('<span aria-hidden="true">·</span>')}</nav>`);
|
||||
const asset = { ...index, body: Buffer.from(html) };
|
||||
assets.set('/index.html', asset);
|
||||
assets.set('/', asset);
|
||||
}
|
||||
|
||||
const FONT = /^\/assets\/jetbrains-mono-latin-(400|700)-normal-[^/]+\.woff2$/;
|
||||
|
||||
/** The Latin JetBrains Mono files of the frontend, so the static pages use the same font. */
|
||||
|
||||
@@ -27,7 +27,7 @@ function setup()
|
||||
contentDir: content,
|
||||
statusDir: status,
|
||||
siteUrl: 'https://security-command.org',
|
||||
legalPages: new Map([['impressum', 'impressum.txt']]),
|
||||
legalPages: [{ route: 'impressum', aliases: ['imprint'], file: 'impressum.txt' }],
|
||||
build: 'abc1234',
|
||||
} as BackendConfig;
|
||||
|
||||
|
||||
+14
-10
@@ -1,3 +1,5 @@
|
||||
import type { LegalPage } from '@homepage/indexer';
|
||||
|
||||
export type BackendConfig = {
|
||||
host: string;
|
||||
port: number;
|
||||
@@ -13,8 +15,8 @@ export type BackendConfig = {
|
||||
themeFile: string;
|
||||
/** Absolute URL of the site, for the sitemap. */
|
||||
siteUrl: string;
|
||||
/** Route name to content file, from LEGAL_PAGES like "impressum:impressum.txt". */
|
||||
legalPages: Map<string, string>;
|
||||
/** From LEGAL_PAGES like "impressum/imprint:impressum.md": the German route, English aliases and the content file. */
|
||||
legalPages: LegalPage[];
|
||||
/** Directory for the status file shown in sandboxes; empty disables it. */
|
||||
statusDir: string;
|
||||
build: string;
|
||||
@@ -41,16 +43,18 @@ function list(value: string | undefined): string[] {
|
||||
return (value ?? '').split(',').map((entry) => entry.trim()).filter(Boolean);
|
||||
}
|
||||
|
||||
function legalPages(value: string): Map<string, string>
|
||||
function legalPages(value: string): LegalPage[]
|
||||
{
|
||||
const pages = new Map<string, string>();
|
||||
for (const pair of list(value))
|
||||
return list(value).map((entry) =>
|
||||
{
|
||||
const [route = '', file = ''] = pair.split(':');
|
||||
if (!/^[a-z0-9-]+$/.test(route) || !file) throw new Error(`LEGAL_PAGES entry "${pair}" must look like route:file`);
|
||||
pages.set(route, file);
|
||||
const [routes = '', file = ''] = entry.split(':');
|
||||
const [route = '', ...aliases] = routes.split('/');
|
||||
if (![route, ...aliases].every((name) => /^[a-z0-9-]+$/.test(name)) || !file)
|
||||
{
|
||||
throw new Error(`LEGAL_PAGES entry "${entry}" must look like route/alias:file`);
|
||||
}
|
||||
return pages;
|
||||
return { route, aliases, file };
|
||||
});
|
||||
}
|
||||
|
||||
export function loadConfig(env: NodeJS.ProcessEnv): BackendConfig
|
||||
@@ -66,7 +70,7 @@ export function loadConfig(env: NodeJS.ProcessEnv): BackendConfig
|
||||
triggerDir: env.TRIGGER_DIR ?? '',
|
||||
themeFile: env.THEME_FILE ?? '/config/theme.css',
|
||||
siteUrl: env.SITE_URL ?? 'https://security-command.org',
|
||||
legalPages: legalPages(env.LEGAL_PAGES ?? 'impressum:impressum.txt,datenschutz:datenschutz.txt'),
|
||||
legalPages: legalPages(env.LEGAL_PAGES ?? 'impressum/imprint:impressum.md,datenschutz/privacy:datenschutz.md'),
|
||||
statusDir: env.STATUS_DIR ?? '',
|
||||
build: env.BUILD_SHA ?? 'dev',
|
||||
allowedOrigins: list(env.ALLOWED_ORIGINS),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Site } from '@homepage/indexer';
|
||||
import { watchTree, watchTriggers } from '@homepage/jobs';
|
||||
import { SpawnerClient } from '@homepage/protocol';
|
||||
import { loadAssets, readTheme, siteFonts } from './assets.ts';
|
||||
import { loadAssets, readTheme, setLegalLinks, siteFonts } from './assets.ts';
|
||||
import { createBuiltins } from './builtins.ts';
|
||||
import { loadConfig } from './config.ts';
|
||||
import { SessionHub } from './hub.ts';
|
||||
@@ -18,6 +18,7 @@ const spawner = new SpawnerClient(config.spawnerSocket);
|
||||
|
||||
const assets = loadAssets(config.frontendDir);
|
||||
if (assets.size === 0) log(`no frontend found in ${config.frontendDir}`);
|
||||
setLegalLinks(assets, config.legalPages);
|
||||
|
||||
let site: Site | undefined;
|
||||
let jobs: BackendJobs | undefined;
|
||||
|
||||
@@ -21,6 +21,7 @@ const SITE: Site = {
|
||||
['/ls', { body: Buffer.from('<p>listing</p>'), type: 'text/html; charset=utf-8', headers: {} }],
|
||||
['/spaced name.txt', { body: Buffer.from('<p>page</p>'), type: 'text/html; charset=utf-8', headers: {} }],
|
||||
['/raw/page.html', { body: Buffer.from('<script>'), type: 'text/plain; charset=utf-8', headers: { 'Content-Security-Policy': 'sandbox' } }],
|
||||
['/imprint', { body: Buffer.alloc(0), type: 'text/plain; charset=utf-8', headers: { Location: '/impressum' }, status: 301 }],
|
||||
]),
|
||||
};
|
||||
|
||||
@@ -93,7 +94,7 @@ describe('backend', () => {
|
||||
triggerDir: '',
|
||||
themeFile: '',
|
||||
siteUrl: 'https://security-command.org',
|
||||
legalPages: new Map(),
|
||||
legalPages: [],
|
||||
statusDir: '',
|
||||
build: 'test',
|
||||
allowedOrigins: ['https://security-command.org'],
|
||||
@@ -422,6 +423,12 @@ describe('backend', () => {
|
||||
expect((await http('/%E0%A4%A')).status).toBe(404);
|
||||
});
|
||||
|
||||
it('redirects aliases of legal pages', async () => {
|
||||
const response = await fetch(url.replace('ws://', 'http://').replace('/ws', '/imprint'), { redirect: 'manual' });
|
||||
expect(response.status).toBe(301);
|
||||
expect(response.headers.get('location')).toBe('/impressum');
|
||||
});
|
||||
|
||||
it('serves the theme without caching it', async () => {
|
||||
const response = await http('/theme.css');
|
||||
expect(await response.text()).toBe(':root { --text: red; }');
|
||||
|
||||
@@ -95,6 +95,7 @@ export function createBackend(config: BackendConfig, hub: SessionHub, options: B
|
||||
|
||||
const current = site();
|
||||
const page = current && current.pages.get(sitePath(path) ?? '');
|
||||
if (page?.status) return send(response, page.status, page.type, page.body, page.headers, head);
|
||||
if (current && page)
|
||||
{
|
||||
// Every page changes together with the content, so the content hash is a valid ETag for all of them.
|
||||
|
||||
@@ -10,14 +10,15 @@
|
||||
<link rel="icon" href="/icon-192.png" sizes="192x192" type="image/png" />
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
||||
<link rel="stylesheet" href="/theme.css" />
|
||||
<script src="/labels.js" defer></script>
|
||||
</head>
|
||||
<body>
|
||||
<header class="bar">
|
||||
<span class="site">security-command.org</span>
|
||||
<nav>
|
||||
<a href="/impressum">impressum</a>
|
||||
<a href="/impressum" data-en="imprint">impressum</a>
|
||||
<span aria-hidden="true">·</span>
|
||||
<a href="/datenschutz">datenschutz</a>
|
||||
<a href="/datenschutz" data-en="privacy">datenschutz</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div id="notice" class="notice" role="status" aria-live="polite" hidden></div>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
// The legal pages keep their German names for German visitors. Everyone else
|
||||
// sees the English names that data-en holds; the links stay the same.
|
||||
const language = (navigator.languages && navigator.languages[0]) || navigator.language || 'en';
|
||||
|
||||
if (!/^de\b/i.test(language))
|
||||
{
|
||||
for (const link of document.querySelectorAll('a[data-en]')) link.textContent = link.dataset.en;
|
||||
}
|
||||
+1
-1
@@ -49,7 +49,7 @@ services:
|
||||
JOBS_FILE: /config/jobs.toml
|
||||
TRIGGER_DIR: /run/jobs/triggers
|
||||
SITE_URL: ${SITE_URL:-https://security-command.org}
|
||||
LEGAL_PAGES: ${LEGAL_PAGES:-impressum:impressum.txt,datenschutz:datenschutz.txt}
|
||||
LEGAL_PAGES: ${LEGAL_PAGES-impressum/imprint:impressum.md,datenschutz/privacy:datenschutz.md}
|
||||
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-https://security-command.org}
|
||||
MAX_SESSIONS: ${MAX_SESSIONS:-12}
|
||||
MAX_QUEUE: ${MAX_QUEUE:-20}
|
||||
|
||||
+4
-2
@@ -9,8 +9,10 @@ JOBS_HOST_DIR=/srv
|
||||
# Public address of the site, used by the sitemap.
|
||||
SITE_URL=https://security-command.org
|
||||
|
||||
# Legal pages as route:file pairs; the files live in the content directory.
|
||||
LEGAL_PAGES=impressum:impressum.txt,datenschutz:datenschutz.txt
|
||||
# Legal pages as route/alias:file entries; the files live in the content
|
||||
# directory. The German route is canonical, English aliases redirect to it.
|
||||
# Entries can be left out, and an empty value means no legal pages at all.
|
||||
LEGAL_PAGES=impressum/imprint:impressum.md,datenschutz/privacy:datenschutz.md
|
||||
|
||||
# Container registry of the SecurityCommand organization.
|
||||
REGISTRY=git.security-command.org/securitycommand
|
||||
|
||||
@@ -6,7 +6,7 @@ import { renderMarkdown, renderText } from './render.ts';
|
||||
import { buildSite, reservedNames, type Site } from './site.ts';
|
||||
import { buildIndex, type WalkOptions } from './walk.ts';
|
||||
|
||||
const LEGAL = new Map([['impressum', 'impressum.txt']]);
|
||||
const LEGAL = [{ route: 'impressum', aliases: ['imprint'], file: 'impressum.txt' }];
|
||||
|
||||
function options(overrides: Partial<WalkOptions> = {}): WalkOptions {
|
||||
return { maxFileBytes: 1024, maxTotalBytes: 4096, maxEntries: 100, reserved: reservedNames(LEGAL), ...overrides };
|
||||
@@ -149,6 +149,28 @@ describe('buildSite', () => {
|
||||
expect(text(site, '/impressum')).toContain('Max Mustermann');
|
||||
});
|
||||
|
||||
it('redirects English aliases to the German legal pages and labels links for both', () => {
|
||||
expect(site.pages.get('/imprint')).toMatchObject({ status: 301, headers: { Location: '/impressum' } });
|
||||
expect(text(site, '/ls')).toContain('<a href="/impressum" data-en="imprint">impressum</a>');
|
||||
expect(text(site, '/sitemap.xml')).not.toContain('/imprint');
|
||||
});
|
||||
|
||||
it('renders markdown legal pages and leaves out pages that are not configured', async () => {
|
||||
const root = mkdtempSync(join(tmpdir(), 'legal-'));
|
||||
write(root, { 'datenschutz.md': '# Datenschutz\n\nKeine Cookies.', 'impressum.md': 'unused' });
|
||||
const legal = [{ route: 'datenschutz', aliases: ['privacy'], file: 'datenschutz.md' }];
|
||||
const only = buildSite(await buildIndex(root, options({ reserved: reservedNames(legal) })), { siteUrl: 'https://a.example', legal });
|
||||
|
||||
expect(text(only, '/datenschutz')).toContain('<h1>Datenschutz</h1>');
|
||||
expect(only.pages.has('/impressum')).toBe(false);
|
||||
expect(only.pages.has('/imprint')).toBe(false);
|
||||
expect(text(only, '/ls')).not.toContain('href="/impressum"');
|
||||
});
|
||||
|
||||
it('reserves the aliases in the content', () => {
|
||||
expect(reservedNames(LEGAL).has('imprint')).toBe(true);
|
||||
});
|
||||
|
||||
it('lists every page in the sitemap and points robots.txt at it', () => {
|
||||
const sitemap = text(site, '/sitemap.xml')!;
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { Marked, type Tokens } from 'marked';
|
||||
import type { Entry } from './walk.ts';
|
||||
|
||||
export type Link = { label: string; href: string };
|
||||
/** A link; english is the label for visitors whose browser does not prefer German. */
|
||||
export type Link = { label: string; href: string; english?: string };
|
||||
|
||||
/** A woff2 file of JetBrains Mono from the frontend build, whose file names carry a hash. */
|
||||
export type Font = { url: string; weight: number };
|
||||
@@ -133,7 +134,11 @@ function fontFaces(fonts: Font[]): string
|
||||
export function renderPage(options: PageOptions): string
|
||||
{
|
||||
const crumbs = options.crumbs.map((crumb) => `<a href="${crumb.href}">${escapeHtml(crumb.label)}</a>`).join(' / ');
|
||||
const nav = options.nav.map((link) => `<a href="${link.href}">${escapeHtml(link.label)}</a>`).join('');
|
||||
const nav = options.nav.map((link) =>
|
||||
{
|
||||
const english = link.english ? ` data-en="${escapeHtml(link.english)}"` : '';
|
||||
return `<a href="${link.href}"${english}>${escapeHtml(link.label)}</a>`;
|
||||
}).join('');
|
||||
|
||||
return `<!doctype html>
|
||||
<html lang="en">
|
||||
@@ -149,6 +154,7 @@ export function renderPage(options: PageOptions): string
|
||||
<link rel="icon" href="/icon-192.png" sizes="192x192" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<link rel="stylesheet" href="/theme.css">
|
||||
<script src="/labels.js" defer></script>
|
||||
<style>${fontFaces(options.fonts ?? [])}${STYLE}</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -5,6 +5,15 @@ export type SitePage = {
|
||||
body: Buffer;
|
||||
type: string;
|
||||
headers: Record<string, string>;
|
||||
/** Set for redirects; pages without it are served with 200. */
|
||||
status?: number;
|
||||
};
|
||||
|
||||
/** A legal page under its German route, with English aliases that redirect to it. */
|
||||
export type LegalPage = {
|
||||
route: string;
|
||||
aliases: string[];
|
||||
file: string;
|
||||
};
|
||||
|
||||
export type Site = {
|
||||
@@ -15,19 +24,18 @@ export type Site = {
|
||||
export type SiteOptions = {
|
||||
/** Absolute URL of the site, used by the sitemap. */
|
||||
siteUrl: string;
|
||||
/** Route name to content file, for example impressum to impressum.txt. */
|
||||
legal: Map<string, string>;
|
||||
legal: LegalPage[];
|
||||
fonts?: Font[];
|
||||
};
|
||||
|
||||
const RESERVED = [
|
||||
'ws', 'raw', 'ls', 'healthz', 'assets', 'index.html', 'sitemap.xml', 'robots.txt',
|
||||
'theme.css', 'favicon.ico', 'icon-192.png', 'apple-touch-icon.png',
|
||||
'theme.css', 'labels.js', 'favicon.ico', 'icon-192.png', 'apple-touch-icon.png',
|
||||
];
|
||||
|
||||
/** Route names the content cannot use at its top level, including the legal pages. */
|
||||
export function reservedNames(legal: Map<string, string>): Set<string> {
|
||||
return new Set([...RESERVED, ...legal.keys()]);
|
||||
/** Route names the content cannot use at its top level, including the legal pages and their aliases. */
|
||||
export function reservedNames(legal: LegalPage[]): Set<string> {
|
||||
return new Set([...RESERVED, ...legal.flatMap((page) => [page.route, ...page.aliases])]);
|
||||
}
|
||||
|
||||
const RAW_TYPES: [RegExp, string][] = [
|
||||
@@ -82,7 +90,7 @@ export function buildSite(index: ContentIndex, options: SiteOptions): Site
|
||||
const pages = new Map<string, SitePage>();
|
||||
const nav: Link[] = [
|
||||
{ label: 'ls', href: '/ls' },
|
||||
...[...options.legal.keys()].map((route) => ({ label: route, href: `/${route}` })),
|
||||
...options.legal.map((page) => ({ label: page.route, href: `/${page.route}`, english: page.aliases[0] })),
|
||||
];
|
||||
|
||||
const html = (title: string, description: string, entryCrumbs: Link[], body: string): SitePage => ({
|
||||
@@ -107,20 +115,25 @@ export function buildSite(index: ContentIndex, options: SiteOptions): Site
|
||||
if (entry.content) pages.set(`/raw/${entry.path}`, rawPage(entry as Entry & { content: Buffer }));
|
||||
}
|
||||
|
||||
for (const [routeName, file] of options.legal)
|
||||
for (const { route, aliases, file } of options.legal)
|
||||
{
|
||||
const entry = index.entries.get(file);
|
||||
const body = entry?.kind === 'file'
|
||||
? renderFile(entry)
|
||||
: `<p class="muted">${escapeHtml(file)} is missing from the content directory.</p>`;
|
||||
pages.set(`/${routeName}`, html(`${routeName} · security-command.org`, `${routeName} of security-command.org.`, [], body));
|
||||
pages.set(`/${route}`, html(`${route} · security-command.org`, `${route} of security-command.org.`, [], body));
|
||||
|
||||
for (const alias of aliases)
|
||||
{
|
||||
pages.set(`/${alias}`, { body: Buffer.alloc(0), type: 'text/plain; charset=utf-8', headers: { Location: `/${route}` }, status: 301 });
|
||||
}
|
||||
}
|
||||
|
||||
const base = options.siteUrl.replace(/\/$/, '');
|
||||
const urls: [string, Date | undefined][] = [
|
||||
['/', undefined],
|
||||
...[...index.entries.values()].map((entry): [string, Date] => [entry.path ? `/${urlPath(entry.path)}` : '/ls', entry.modified]),
|
||||
...[...options.legal].map(([route, file]): [string, Date | undefined] => [`/${route}`, index.entries.get(file)?.modified]),
|
||||
...options.legal.map(({ route, file }): [string, Date | undefined] => [`/${route}`, index.entries.get(file)?.modified]),
|
||||
];
|
||||
|
||||
const sitemap = [
|
||||
|
||||
@@ -9,7 +9,9 @@ HISTFILE=/tmp/.bash_history
|
||||
export LESSHISTFILE=-
|
||||
export XDG_CONFIG_HOME=/tmp/.config
|
||||
export XDG_CACHE_HOME=/tmp/.cache
|
||||
export XDG_DATA_HOME=/tmp/.local/share
|
||||
export XDG_STATE_HOME=/tmp/.local/state
|
||||
mkdir -p "$XDG_CONFIG_HOME" "$XDG_CACHE_HOME" "$XDG_DATA_HOME" "$XDG_STATE_HOME"
|
||||
|
||||
PS1='\[\e[1;31m\]\u@\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ '
|
||||
|
||||
|
||||
Reference in new issue
Block a user