Logo
Shiro 主题

额外功能

Shiro 主题的额外功能配置

额外功能

扩展的 Markdown 语法

参考 https://shiro.innei.in/#/markdown

对于 LinkCard 的解析,某些需要你填写 API Key,以下的键值都是填写在 .env 环境变量中

  • GitHub,默认直接用浏览器访问,可能受到 rate limit,可以填写 GH_TOKEN 以保证 API 可达性。
  • TMDB,必须填写 TMDB_API_KEY 才可以正确解析 tmdb 的链接。参考 https://post.smzdm.com/p/a5op4w33/ 这里获取 TOKEN

我的动态

Shiro 主题中,有一个可以在顶部显示博主当前正在做的事情的功能,这个功能是通过云函数和 ProcessReporter 软件实现的。

非常感谢 Innei, timochan, TNXG 的贡献,目前 ProcessReporter 已支持全平台!

配置云函数

进入后台,点击左侧菜单栏的「其他 -> 配置与云函数」,然后点击新建按钮,在选项卡中填入以下信息:

  • 名称:update
  • 引用:ps
  • 数据类型:Function
  • 请求方式:POST

这个地方还需要设置一个密钥,在 Secret 中填入 key,在 Value 中填入你自己的密钥。

这个密钥将用于验证你的软件是否有权限更新博主的动态,所以请务必设置一个复杂的密钥。

密钥在后面的步骤中还需要用到,所以请务必记住。

上方没有提到的选项都不需要填写,然后在右侧的代码编辑器中填入下面链接中的代码:

点击保存按钮,云函数就配置完成了。

请关注此代码的更新,它可能会随时变化,你需要及时更新它们

配置主题配置

继续在「配置与云函数」页面,找到「theme -> shiro」配置,点击编辑,进入编辑页面,在代码中找到 module,加入 activity 配置,如下:(高亮部分)

{
  "module": {
    "donate": {
      "enable": false,
      "link": "https://afdian.net/@Innei",
      "qrcode": [
        "https://cdn.jsdelivr.net/gh/Innei/img-bed@master/20191211132347.png",
        "https://cdn.innei.ren/bed/2023/0424213144.png"
      ]
    },
    "bilibili": {
      "liveId": 1434499
    },
    "activity": {
      "enable": true,
      "endpoint": "/fn/ps/update"
    }
  }
}

配置软件

前往对应着你的电脑系统的软件的 GitHub 仓库,下载并打开 ProcessReporter。

由于不同平台有不同的使用方法,不同的软件我们会在下方具体讲述。

ProcessReporter Mac

打开软件后,你会发现你的系统菜单栏中多了一个图标,点击图标,然后点击「设置」,在弹出的窗口中填入你的信息:

  • Endpoint:{你的API地址}/fn/ps/update (请将 {你的API地址} 替换为你的 API 地址,如:https://api.example.com/api/v2
  • API Key:填入你刚刚在云函数中设置的密钥

如果你希望软件在开机时自动启动,可以勾选「Launch at login」选项。

接着关闭窗口,再次点击菜单栏中的图标,点击「Enable」即可。如果一切正常,刷新一下你的博客就可以在博客顶部看到你的动态了。

ProcessReporter Windows

Windows 版本的使用问题,请前往 TNXG/ProcessReporterWinpy 查看。

使用 GUI 版本

Releases 页面下载 ProcessReporterWinpy_Launcher.exe ,配置好 config.yml 文件,然后运行 ProcessReporterWinpy_Launcher.exe 即可。

config.yml 配置具体配置项以及说明请参考 TNXG/ProcessReporterWinpy

使用预编译的二进制文件

Releases 页面下载 ProcessReporterWinpy.exe,配置好 config.yml 文件后,在终端运行即可,示例如下

processforwinpy.exe --path "运行目录的路径"

config.yml 配置具体配置项以及说明请参考 TNXG/ProcessReporterWinpy

使用源代码

下载代码后,修改 config.yml 文件,填入你的信息:

  • api_url:{你的API地址}/fn/ps/update (请将 {你的API地址} 替换为你的 API 地址,如:https://api.example.com/api/v2
  • api_key:填入你刚刚在云函数中设置的密钥
  • report_time: 上报间隔(单位:秒)

接着运行程序即可。如果一切正常,刷新一下你的博客你就可以在博客顶部看到你的动态了。

ProcessReporter Linux

在仓库的 Releases 页面下载对应的二进制包,解压运行即可,具体请参照项目的 README 进行配置运行。

安装完成后,新建 .env.process 文件,填入你的信息:

# 你的 key
API_KEY=your_key
# 你的云函数地址
API_URL={你的API地址}/fn/ps/update
# 上报时间间隔,单位为秒
REPORT_TIME=30
# 是否开启媒体状态上报
MEDIA_ENABLE=true
# 是否打印日志
LOG_ENABLE=true

然后执行程序即可。如果一切正常,刷新一下你的博客你就可以在博客顶部看到你的动态了。

如果有什么疑问,可以去阅读该项目的 README

个人状态展示

设置当前的状态。

配置云函数

进入后台,点击左侧菜单栏的「其他 -> 配置与云函数」,然后点击新建按钮,在选项卡中填入以下信息:

  • 名称:status
  • 引用:shiro
  • 数据类型:Function
  • 请求方式:ALL

这个地方还需要设置一个密钥,在 Secret 中填入 key,在 Value 中填入你自己的密钥。

这个密钥将用于验证你的软件是否有权限更新当前状态,所以请务必设置一个复杂的密钥。

密钥在后面的步骤中还需要用到,所以请务必记住。

上方没有提到的选项都不需要填写,然后在右侧的代码编辑器中填入下面链接中的代码:

点击保存按钮,云函数就配置完成了。

请关注此代码的更新,它可能会随时变化,你需要及时更新它们

设置状态

在主页登录之后,你可以点击此头像的右下方设置状态。

签名动画

此特性为闭源版本特有

在「配置与云函数」页面,找到「theme -> shiro」配置,进入编辑页面,在代码中找到 module,加入 signature 配置,如下(高亮部分):

其中 svg 后填生成的 svg 代码,可通过 此网站 进行生成。

受限于 Json 语法规则,此处 svg 代码需替换所有的 "\",否则会报错。

{
  "module": {
    "donate": {
      "enable": false,
      "link": "https://afdian.net/@Innei",
      "qrcode": [
        "https://cdn.jsdelivr.net/gh/Innei/img-bed@master/20191211132347.png",
        "https://cdn.innei.ren/bed/2023/0424213144.png"
      ]
    },
    "bilibili": {
      "liveId": 1434499
    },
    "activity": {
      "enable": true,
      "endpoint": "/fn/ps/update"
    },
    "signature": {
      "svg": "<svg width=\"177.006\" height=\"84.901\" viewBox=\"0 0 177.006 84.901\" xmlns=\"http://www.w3.org/2000/svg\"><g id=\"svgGroup\" stroke-linecap=\"round\" fill-rule=\"evenodd\" font-size=\"9pt\" stroke=\"#000\" stroke-width=\"0.25mm\" fill=\"#000\" style=\"stroke:#000;stroke-width:0.25mm;fill:#000\"><path d=\"M 65.906 67.201 L 66.906 66.501 A 5.892 5.892 0 0 1 67.229 66.328 Q 67.536 66.177 67.756 66.126 A 0.897 0.897 0 0 1 67.956 66.101 A 0.505 0.505 0 0 1 68.206 66.174 Q 68.446 66.31 68.706 66.701 Q 69.106 67.301 69.106 68.001 A 0.901 0.901 0 0 1 68.938 68.504 Q 68.638 68.952 67.806 69.401 A 25.273 25.273 0 0 1 63.748 72.455 Q 59.243 75.254 51.998 77.916 A 132.862 132.862 0 0 1 46.156 79.901 A 120.782 120.782 0 0 1 33.098 83.274 Q 26.377 84.592 20.307 84.842 A 68.148 68.148 0 0 1 17.506 84.901 A 44.877 44.877 0 0 1 11.558 84.542 Q 0.006 82.988 0.006 74.701 A 2.27 2.27 0 0 1 0.217 73.812 Q 0.746 72.588 2.595 70.792 A 28.322 28.322 0 0 1 3.006 70.401 A 89.197 89.197 0 0 1 4.573 69 Q 7.479 66.47 8.426 66.227 A 0.73 0.73 0 0 1 8.606 66.201 Q 9.578 66.201 13.484 68.566 A 85.654 85.654 0 0 1 13.706 68.701 Q 17.806 71.201 24.006 73.701 A 34.364 34.364 0 0 0 32.1 75.905 A 30.279 30.279 0 0 0 36.306 76.201 A 15.624 15.624 0 0 0 40.123 75.762 A 10.427 10.427 0 0 0 45.656 72.401 A 15.647 15.647 0 0 0 47.604 69.583 Q 48.906 67.132 48.906 64.601 A 9.083 9.083 0 0 0 46.918 58.951 A 13.021 13.021 0 0 0 45.506 57.401 A 32.004 32.004 0 0 0 40.723 53.715 A 40.462 40.462 0 0 0 37.256 51.751 Q 32.406 49.301 27.506 46.701 A 32.315 32.315 0 0 1 21.72 42.814 A 28.085 28.085 0 0 1 19.206 40.401 A 13.9 13.9 0 0 1 16.973 37.217 A 10.864 10.864 0 0 1 15.806 32.301 A 14.878 14.878 0 0 1 17.264 26.07 Q 19.2 21.849 23.706 17.401 Q 31.606 9.601 41.806 4.801 Q 52.006 0.001 59.206 0.001 Q 68.206 0.001 68.206 6.001 A 8.195 8.195 0 0 1 66.88 10.415 Q 66.177 11.538 65.101 12.608 A 15.61 15.61 0 0 1 64.956 12.751 A 20.953 20.953 0 0 1 63.443 14.092 Q 61.173 15.901 59.506 15.901 Q 58.806 15.901 58.356 15.451 Q 57.906 15.001 57.906 14.501 Q 57.906 14.001 58.406 13.101 A 4.523 4.523 0 0 0 58.725 12.399 Q 58.87 11.983 58.899 11.59 A 2.623 2.623 0 0 0 58.906 11.401 Q 58.906 9.519 57.333 8.474 A 5.332 5.332 0 0 0 56.556 8.051 Q 54.206 7.001 51.706 7.001 Q 44.793 7.001 37.314 11.363 A 44.499 44.499 0 0 0 36.256 12.001 Q 28.206 17.001 26.806 24.001 Q 27.306 28.201 30.956 31.851 A 37.249 37.249 0 0 0 38.81 37.815 A 41.639 41.639 0 0 0 39.406 38.151 Q 44.206 40.801 48.906 43.501 A 31.929 31.929 0 0 1 54.421 47.468 A 27.584 27.584 0 0 1 56.806 49.901 A 15.405 15.405 0 0 1 58.692 52.579 Q 59.749 54.514 59.956 56.489 A 9.24 9.24 0 0 1 60.006 57.451 A 11.14 11.14 0 0 1 58.742 62.534 A 15.439 15.439 0 0 1 57.206 64.951 A 55.116 55.116 0 0 1 54.505 68.217 Q 53.096 69.787 51.7 71.06 A 33.797 33.797 0 0 1 51.656 71.101 A 205.983 205.983 0 0 0 51.011 71.689 Q 48.906 73.619 48.906 73.751 Q 48.906 73.884 49.142 73.899 A 1.01 1.01 0 0 0 49.206 73.901 Q 54.217 73.901 62.264 69.379 A 82.093 82.093 0 0 0 65.906 67.201 Z M 69.506 72.301 A 0.987 0.987 0 0 0 70.014 72.069 Q 71.149 71.248 73.954 67.529 A 132.541 132.541 0 0 0 75.306 65.701 Q 79.713 59.64 81.17 59.103 A 0.775 0.775 0 0 1 81.406 59.051 Q 82.706 59.001 84.006 61.201 A 54.753 54.753 0 0 1 85.611 64.126 A 67.176 67.176 0 0 1 86.556 66.051 A 12.326 12.326 0 0 0 88.452 68.905 A 16.993 16.993 0 0 0 90.606 70.951 A 11.991 11.991 0 0 0 92.618 72.277 Q 94.412 73.201 96.206 73.201 A 31.123 31.123 0 0 0 97.178 73.187 Q 98.66 73.14 99.295 72.939 A 1.243 1.243 0 0 0 99.606 72.801 Q 100.076 72.487 100.393 72.419 A 0.781 0.781 0 0 1 100.556 72.401 Q 100.906 72.401 100.906 73.201 A 3.658 3.658 0 0 1 100.55 74.534 Q 99.837 76.091 97.706 78.051 A 10.531 10.531 0 0 1 92.637 80.594 A 15.195 15.195 0 0 1 89.506 80.901 Q 81.279 80.901 77.811 71.841 A 25.688 25.688 0 0 1 77.506 71.001 Q 77.206 70.401 76.956 70.401 A 0.479 0.479 0 0 0 76.805 70.429 Q 76.573 70.507 76.206 70.801 A 3.392 3.392 0 0 0 75.979 71.003 Q 75.451 71.513 74.307 72.863 A 91.945 91.945 0 0 0 74.106 73.101 Q 72.506 75.001 70.856 77.001 A 197.786 197.786 0 0 1 70.281 77.694 Q 69.222 78.966 68.862 79.343 A 3.57 3.57 0 0 1 68.806 79.401 Q 68.406 79.801 67.306 79.801 Q 66.206 79.801 66.106 78.601 A 183.587 183.587 0 0 1 65.262 64.622 A 208.746 208.746 0 0 1 65.206 59.751 Q 65.206 49.901 65.456 44.501 Q 65.679 39.67 66.343 32.359 A 534.64 534.64 0 0 1 66.506 30.601 A 78.338 78.338 0 0 1 67.242 24.892 Q 68.042 20.16 69.356 16.701 A 17.553 17.553 0 0 1 70.294 14.613 Q 72.078 11.301 74.506 11.301 A 6.455 6.455 0 0 1 77.639 12.015 Q 81.006 13.851 81.006 20.401 A 37.83 37.83 0 0 1 80.509 26.242 Q 79.562 32.274 76.806 40.051 A 191.929 191.929 0 0 1 74.21 46.973 Q 71.387 54.057 68.706 58.801 Q 69.106 72.301 69.506 72.301 Z M 122.306 64.101 L 119.606 64.301 Q 117.806 64.301 117.806 63.401 A 2.1 2.1 0 0 1 117.988 62.635 Q 118.61 61.106 121.356 58.051 Q 124.215 54.87 126.587 54.25 A 4.42 4.42 0 0 1 127.706 54.101 Q 128.906 54.101 129.856 54.801 A 3.012 3.012 0 0 1 130.429 55.342 A 2.169 2.169 0 0 1 130.906 56.501 L 131.406 61.001 Q 131.677 61.362 131.948 61.397 A 0.453 0.453 0 0 0 132.006 61.401 Q 132.274 61.401 133.343 60.12 A 31.495 31.495 0 0 0 133.606 59.801 A 25.896 25.896 0 0 1 135.587 57.715 Q 138.605 54.901 141.106 54.901 Q 142.032 54.901 142.705 55.104 A 3.165 3.165 0 0 1 143.206 55.301 A 3.828 3.828 0 0 1 143.73 55.624 Q 144.334 56.06 145.056 56.851 Q 146.106 58.001 146.206 58.101 A 3.678 3.678 0 0 1 147.168 57.83 A 3.292 3.292 0 0 1 147.606 57.801 A 1.265 1.265 0 0 1 148.087 57.885 Q 148.636 58.109 148.698 58.931 A 2.915 2.915 0 0 1 148.706 59.151 A 1.769 1.769 0 0 1 148.505 59.88 Q 147.987 60.979 146.124 62.87 A 45.46 45.46 0 0 1 144.806 64.151 A 34.145 34.145 0 0 1 143.202 65.567 Q 140.799 67.547 139.359 67.772 A 2.293 2.293 0 0 1 139.006 67.801 A 3.754 3.754 0 0 1 136.205 66.568 A 5.495 5.495 0 0 1 135.806 66.101 Q 134.765 64.739 134.173 64.468 A 0.65 0.65 0 0 0 133.906 64.401 Q 132.071 64.401 131.7 65.927 A 3.704 3.704 0 0 0 131.606 66.801 Q 131.606 68.601 133.256 72.901 A 115.615 115.615 0 0 1 133.816 74.39 Q 134.79 77.035 134.893 77.836 A 1.309 1.309 0 0 1 134.906 78.001 A 3.258 3.258 0 0 1 133.654 80.607 A 5.263 5.263 0 0 1 132.856 81.151 Q 130.806 82.301 128.356 82.301 A 12.266 12.266 0 0 1 126.784 82.206 Q 125.39 82.026 124.406 81.501 A 3.622 3.622 0 0 1 123.664 80.988 A 2.199 2.199 0 0 1 122.906 79.301 L 125.706 67.201 Q 125.706 64.101 122.306 64.101 Z M 157.506 57.301 L 157.506 56.901 A 5.233 5.233 0 0 1 157.763 55.224 A 4.355 4.355 0 0 1 159.006 53.351 A 5.222 5.222 0 0 1 162.233 52.017 A 6.816 6.816 0 0 1 162.706 52.001 A 8.59 8.59 0 0 1 167.909 53.587 Q 170.619 55.563 172.006 60.001 Q 172.306 60.901 172.756 60.901 Q 173.173 60.901 174.149 60.428 A 13.954 13.954 0 0 0 174.306 60.351 A 6.925 6.925 0 0 1 174.964 60.061 Q 175.31 59.931 175.62 59.866 A 2.863 2.863 0 0 1 176.206 59.801 Q 176.927 59.801 176.998 60.614 A 2.155 2.155 0 0 1 177.006 60.801 Q 177.006 61.674 175.367 63.537 A 24.981 24.981 0 0 1 174.856 64.101 A 14.156 14.156 0 0 1 173.884 65.052 Q 172.872 65.944 172.027 66.246 A 2.442 2.442 0 0 1 171.206 66.401 Q 169.106 72.101 164.256 76.951 Q 159.406 81.801 154.306 81.801 A 9.063 9.063 0 0 1 151.194 81.284 A 7.986 7.986 0 0 1 148.306 79.451 Q 146.187 77.376 145.939 73.588 A 15.85 15.85 0 0 1 145.906 72.551 Q 145.906 68.96 148.272 64.872 A 28.479 28.479 0 0 1 149.706 62.651 Q 153.227 57.692 156.921 57.329 A 5.974 5.974 0 0 1 157.506 57.301 Z M 121.652 67.514 A 5.27 5.27 0 0 0 121.106 67.901 A 18.636 18.636 0 0 1 120.715 68.209 Q 119.348 69.258 117.975 69.898 A 10.143 10.143 0 0 1 113.656 70.901 Q 109.906 70.901 107.556 68.351 A 14.958 14.958 0 0 1 105.971 66.32 A 11.08 11.08 0 0 1 104.506 63.001 A 29.113 29.113 0 0 1 104.484 62.913 Q 103.806 60.164 103.806 57.851 A 11.86 11.86 0 0 0 103.797 57.39 Q 103.751 56.198 103.451 55.718 A 0.614 0.614 0 0 0 103.006 55.401 A 1.377 1.377 0 0 0 102.362 55.569 Q 100.984 56.291 99.606 60.101 Q 97.906 64.801 97.906 69.851 A 20.344 20.344 0 0 0 97.906 69.912 Q 97.912 71.851 98.288 73.516 A 11.422 11.422 0 0 0 100.406 78.101 A 7.936 7.936 0 0 0 104.319 80.853 A 10.114 10.114 0 0 0 107.406 81.301 A 8.75 8.75 0 0 0 108.409 81.241 Q 111.302 80.908 114.842 78.688 A 35.475 35.475 0 0 0 118.106 76.351 A 54.78 54.78 0 0 0 119.623 75.096 Q 124.306 71.073 124.306 68.901 A 3.896 3.896 0 0 0 124.288 68.515 Q 124.188 67.512 123.534 67.22 A 1.531 1.531 0 0 0 122.906 67.101 A 1.609 1.609 0 0 0 122.88 67.101 Q 122.316 67.11 121.652 67.514 Z M 68.506 47.601 L 68.506 53.601 A 137.704 137.704 0 0 0 71.32 45.733 A 174.522 174.522 0 0 0 73.356 39.001 Q 74.82 33.794 75.331 29.752 A 32.048 32.048 0 0 0 75.606 25.751 Q 75.606 22.408 74.39 21.194 A 2.417 2.417 0 0 0 72.606 20.501 Q 69.057 20.501 68.58 40.807 A 290.473 290.473 0 0 0 68.506 47.601 Z M 160.706 64.301 A 8.395 8.395 0 0 0 161.834 65.145 Q 164.321 66.701 168.106 66.701 A 2.65 2.65 0 0 1 167.869 67.768 Q 167.519 68.567 166.656 69.401 A 4.357 4.357 0 0 1 165.717 70.088 Q 165.001 70.481 164.084 70.657 A 8.638 8.638 0 0 1 162.456 70.801 A 5.254 5.254 0 0 1 159.302 69.795 A 6.856 6.856 0 0 1 157.856 68.351 A 9.02 9.02 0 0 1 156.658 66.228 A 9.633 9.633 0 0 1 156.006 62.651 A 12.991 12.991 0 0 1 156.006 62.54 Q 156.021 60.787 156.512 59.643 A 3.461 3.461 0 0 1 157.606 58.201 Q 158.006 61.901 160.706 64.301 Z M 100.356 46.101 Q 98.806 44.401 98.806 41.901 A 6.661 6.661 0 0 1 99.146 39.733 A 5.751 5.751 0 0 1 100.356 37.701 A 4.979 4.979 0 0 1 103.974 36.005 A 6.074 6.074 0 0 1 104.206 36.001 A 4.979 4.979 0 0 1 107.896 37.532 A 6.078 6.078 0 0 1 108.056 37.701 Q 109.606 39.401 109.606 41.901 A 6.661 6.661 0 0 1 109.265 44.069 A 5.751 5.751 0 0 1 108.056 46.101 A 4.979 4.979 0 0 1 104.437 47.796 A 6.074 6.074 0 0 1 104.206 47.801 A 4.979 4.979 0 0 1 100.515 46.269 A 6.078 6.078 0 0 1 100.356 46.101 Z\" vector-effect=\"non-scaling-stroke\"/></g></svg>"
    }
  }
}
Edit on GitHub

Last updated on

On this page