Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

8.4 KB
Raw Blame
<!DOCTYPE html>
<html>
<head>
    <title>Error - SiYuan</title>
    <meta charset="UTF-8">
    <meta name="color-scheme" content="light dark">
    <style>
        body {
            margin: 0;
            background-color: #fff;
            color: #222;
            font-family: BlinkMacSystemFont, Helvetica, "PingFang SC", "Luxi Sans", "DejaVu Sans", arial, "Microsoft Yahei", "Hiragino Sans GB", "Source Han Sans SC", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Twemoji Mozilla", "Android Emoji", "EmojiSymbols";
            font-size: 16px;
        }

        .fn__flex-column {
            display: flex;
            flex-direction: column;
            width: 100%;
            min-height: calc(100vh - 32px);
            box-sizing: border-box;
            padding: 0 max(16px, calc((100vw - 608px) / 2));
        }

        .fn__flex-1 {
            flex: 1;
            min-height: 16px;
            flex-shrink: 0;
        }

        a {
            text-decoration: none;
            color: #3575f0;
        }

        a:hover {
            text-decoration: underline;
        }

        .topbar {
            background: #fff;
            position: sticky;
            top: 0;
            width: 100%;
            left: 0;
            display: flex;
            box-sizing: border-box;
            line-height: 32px;
            padding-left: 8px;
        }

        .svg {
            right: 32px;
            top: 0;
            width: 13px;
            fill: rgba(0, 0, 0, .6);
            padding: 9.5px;
            cursor: pointer;
            z-index: 1;
        }

        .svg:hover {
            background: #dfe0e1;
            fill: #222;
        }

        #close {
            width: 10px;
            padding: 11px 11px;
        }

        #close:hover {
            background-color: #d23f31;
            fill: #fff;
        }

        .topbar img {
            height: 32px;
            width: 32px;
            float: left;
            margin-right: 8px;
        }

        .drag {
            -webkit-app-region: drag;
            flex: 1;
        }

        .title-container {
            display: flex;
        }

        .title-container h2 {
            margin: 8px 0;
        }

        .title-emoji {
            font-size: 48px;
            align-self: center;
            margin: 0 24px 0 8px;
        }

        #content div {
            line-height: 1.6;
            margin-top: 16px;
        }

        hr {
            border: 1px solid #e0e0e0;
            margin: 16px 0;
        }

        .info-section {
            font-size: 14px;
            color: rgba(0, 0, 0, .6);
        }

        .info-section div:not(:last-child) {
            margin-bottom: 8px;
        }

        .feedback {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 16px;
            font-size: 14px;
            text-align: center;
        }

        .darwin #min,
        .darwin #close {
            display: none;
        }

        .darwin .topbar {
            padding-left: 80px;
        }

        @media (prefers-color-scheme: dark) {
            body {
                background-color: #1e1e1e;
                color: #dadada;
            }

            .topbar {
                background-color: #1e1e1e;
            }

            hr {
                border: 1px solid #363636;
            }

            .info-section {
                color: #9aa0a6;
            }

            a {
                color: #3573f0;
            }

            .svg {
                fill: #9aa0a6;
            }

            .svg:hover {
                background: rgba(255, 255, 255, .075);
                fill: #dadada;
            }
        }
    </style>
</head>
<body>
<div class="topbar">
    <div id="icon"></div>
    <div class="drag"></div>
    <svg class="svg" id="min" viewBox="0 0 32 32">
        <path d="M1.333 14.667h29.333q1.333 0 1.333 1.333v0q0 1.333-1.333 1.333h-29.333q-1.333 0-1.333-1.333v0q0-1.333 1.333-1.333z"></path>
    </svg>
    <svg class="svg" id="close" viewBox="0 0 32 32">
        <path d="M32 3.221l-12.779 12.779 12.779 12.779-3.221 3.221-12.779-12.779-12.779 12.779-3.221-3.221 12.779-12.779-12.779-12.779 3.221-3.221 12.779 12.779 12.779-12.779z"></path>
    </svg>
</div>
<div class="fn__flex-column">
    <div class="fn__flex-1"></div>
    <div class="title-container">
        <span class="title-emoji" id="titleEmoji"></span>
        <div id="titleText"></div>
    </div>
    <div id="content"></div>
    <hr>
    <div class="info-section">
        <div id="time"></div>
        <div id="systemInfo"></div>
    </div>
    <div class="fn__flex-1"></div>
    <div class="feedback">
        <a href="https://ld246.com/article/1649901726096" target="_blank">求助反馈建议</a>
        <a href="https://b3log.org/siyuan/download.html" target="_blank">下载最新版</a>
        <a href="https://liuyun.io/article/1686530886208" target="_blank">Feedback and support</a>
        <a href="https://b3log.org/siyuan/en/download.html" target="_blank">Download the latest version</a>
    </div>
    <div class="fn__flex-1"></div>
</div>
<script>
    'use strict';
    const params = new URLSearchParams(window.location.search);

    // 窗口控制按钮
    if (process.platform === 'darwin') {
        document.body.classList.add('darwin');
    }
    document.getElementById('close').addEventListener('click', () => {
        const {ipcRenderer} = require('electron');
        ipcRenderer.send("siyuan-cmd", "destroy");
    });
    document.getElementById('min').addEventListener('click', () => {
        const {ipcRenderer} = require('electron');
        ipcRenderer.send("siyuan-cmd", "minimize");
    });

    // LOGO和版本号
    const version = 'SiYuan v' + params.get('v') || '';
    document.querySelector('#icon').innerHTML = `<img src="${params.get('icon') || ''}" alt="SiYuan LOGO"> ${version}`;

    // 标题
    document.getElementById('titleEmoji').textContent = params.get('emoji');
    document.getElementById('titleText').innerHTML = params.get('title') || '';

    // 内容
    document.getElementById('content').innerHTML = params.get('content') || '';
    document.querySelectorAll('[data-log-path]').forEach((element) => {
        element.addEventListener('click', (event) => {
            event.preventDefault();
            const logPath = params.get('logPath');
            if (!logPath) {
                return;
            }
            const fs = require('fs');
            const path = require('path');
            const {ipcRenderer} = require('electron');
            if (fs.existsSync(logPath)) {
                ipcRenderer.send("siyuan-cmd", {cmd: "showItemInFolder", filePath: logPath});
                return;
            }
            let existingDirectory = path.dirname(logPath);
            while (!fs.existsSync(existingDirectory)) {
                const parentDirectory = path.dirname(existingDirectory);
                if (parentDirectory === existingDirectory) {
                    return;
                }
                existingDirectory = parentDirectory;
            }
            ipcRenderer.send("siyuan-cmd", {cmd: "openPath", filePath: existingDirectory});
        });
    });

    // 时间信息
    const date = new Date();
    document.getElementById('time').innerHTML = `${date.getFullYear()}/${String(date.getMonth() + 1).padStart(2, '0')}/${String(date.getDate()).padStart(2, '0')} ${String(date.getHours()).padStart(2, '0')}:${String(date.getMinutes()).padStart(2, '0')}:${String(date.getSeconds()).padStart(2, '0')}`;

    // 系统信息
    const os = require('os');
    let platformName = {
        'darwin': 'macOS',
        'win32': 'Windows',
        'linux': 'Linux'
    }[process.platform] || process.platform;
    const release = typeof process.getSystemVersion === 'function'
        ? process.getSystemVersion() // Electron 提供,系统版本
        : os.release(); // Node.js 提供,内核版本
    // Windows 系统版本判断
    if (process.platform === 'win32') {
        const versionParts = release.split('.'); // 10.0.22000
        if (versionParts.length >= 3) {
            const buildNumber = parseInt(versionParts[2], 10);
            if (buildNumber >= 22000) {
                platformName = 'Windows 11';
            } else {
                platformName = 'Windows 10';
            }
        }
    }

    document.getElementById('systemInfo').innerHTML = `${version} · ${platformName} (${release}) · ${os.arch()} · ${os.cpus()[0]?.model || ''}`;
</script>
</body>
</html>