MENU

h5ai安装小计

March 14, 2022 • 已被 310 位童鞋围观过 • 教程文章

最近闲逛发现了一个工具网站,甚是小清新,简约且实用性较强,查看代码发现是h5ai,一款HTTP Web 服务器索引工具。自己本地搭建了一个demo,以下记录一些踩过的坑。
首先是下载,如果直接在Github上下载下来的是没有经过编译的版本,无法直接安装,需要编译之后才能安装。直接安装的话请到官网下载最新版本
Github地址: https://github.com/lrsjng/h5ai
官网地址: https://larsjung.de/h5ai/
下载地址: https://release.larsjung.de/h5ai/
第二坑是安装的坑,h5ai的压缩包解压后 只有一个目录 _h5ai 这个文件要放到网站的根目录 也就是实际运行目录 。将文件夹复制_h5ai到 Web 服务器的文档根目录:WEB_ROOT/_h5ai.
设置网站的默认文档 添加 /_h5ai/public/index.php 并将其作为最高级别。
下面是一些选项设置
路径地址: /_h5ai/private/conf/options.json
开启filter功能,过滤功能

    /*
    Allow filtering the displayed files and folders in current folder.
    Checks for substrings.

    If advanced is enabled it checks entries for right order of characters,
    i.e. "ab" matches "ab", "axb", "xaxbx" but not "ba". Space separated
    sequences get OR-ed. Searches will be treated as JavaScript regular
    expressions if you prefix them with "re:".

    - advanced: boolean, use advanced pattern parsing
    - debounceTime: number, debounce wait time in milliseconds
    - ignorecase: boolean, ignore case
    */
    "filter": {
        "enabled": true,
        "advanced": true,
        "debounceTime": 100,
        "ignorecase": true
    },

开启自定义头部和尾部

    /*
    Allow customized header and footer files.
    First checks for files "_h5ai.header.html" and "_h5ai.footer.html" in the current directory.
    If not successful it checks all parent directories (starting in the current directory) for
    files "_h5ai.headers.html" and "_h5ai.footers.html".
    Note the different filenames: "header" (only current) - "headers" (current and sub directories)!
    The file's content will be placed inside a <div/> tag above/below the main content.
    If a file's extension is ".md" instead of ".html" its content will be interpreted as markdown.

    - stopSearchingAtRoot: boolean, only search for header and footer files until the web root
        directory. if `false`, will search for header/footer up the entire directory structure,
        even above the web root
    */
    "custom": {
        "enabled": true,
        "stopSearchingAtRoot": true
    },

开启搜索

    /*
    Allow searching files and folders in and below current folder.
    Checks for substrings.

    If advanced is enabled it checks entries for right order of characters,
    i.e. "ab" matches "ab", "axb", "xaxbx" but not "ba". Space separated
    sequences get OR-ed. Searches will be treated as JavaScript regular
    expressions if you prefix them with "re:".

    - advanced: boolean, use advanced pattern parsing
    - debounceTime: number, debounce wait time in milliseconds
    - ignorecase: boolean, ignore case
    */
    "search": {
        "enabled": true,
        "advanced": true,
        "debounceTime": 300,
        "ignorecase": true
    },
Last Modified: September 28, 2023