<?xml version="1.0" encoding="utf-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><title>Ant.Master&#039;s Blog</title><link>https://iant.work/</link><description>Your business expert</description><item><title>rocky linux 自动更新系统时间</title><link>https://iant.work/post/900.html</link><description>&lt;div style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;在 Rocky Linux 中，&lt;span style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-weight: 700; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;chrony&lt;/span&gt; 是官方推荐的时间同步工具，配置后可实现系统时间自动校准、开机自启、长期稳定同步。下面是完整的自动更新时间配置步骤。&lt;/div&gt;&lt;h3 style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; font-weight: 400; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;&lt;strong&gt;一、安装 chrony（如已安装可跳过）&lt;/strong&gt;&lt;/h3&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;安装&amp;nbsp;chrony
sudo&amp;nbsp;dnf&amp;nbsp;install&amp;nbsp;-y&amp;nbsp;chrony&lt;/pre&gt;&lt;p&gt;二、设置时区（先确保时区正确）&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;查看当前时区
timedatectl

#&amp;nbsp;设置为中国上海时区（推荐）
sudo&amp;nbsp;timedatectl&amp;nbsp;set-timezone&amp;nbsp;Asia/Shanghai&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; white-space-collapse: preserve;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; font-weight: 400; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;&lt;strong&gt;三、配置 NTP 时间源（国内推荐阿里云）&lt;/strong&gt;&lt;/h3&gt;&lt;div style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;编辑配置文件 &lt;code style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;/etc/chrony.conf&lt;/code&gt;：&lt;/div&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sudo&amp;nbsp;vi&amp;nbsp;/etc/chrony.conf&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; white-space-collapse: preserve;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; font-weight: 700; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;推荐配置（替换原有 pool/server 行）&lt;/span&gt;：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;注释掉默认的&amp;nbsp;Rocky&amp;nbsp;NTP&amp;nbsp;池
#&amp;nbsp;pool&amp;nbsp;2.rocky.pool.ntp.org&amp;nbsp;iburst

#&amp;nbsp;添加国内稳定&amp;nbsp;NTP&amp;nbsp;服务器
server&amp;nbsp;ntp.aliyun.com&amp;nbsp;iburst
server&amp;nbsp;ntp1.aliyun.com&amp;nbsp;iburst
server&amp;nbsp;ntp2.aliyun.com&amp;nbsp;iburst

#&amp;nbsp;允许本地时间作为&amp;nbsp;fallback（外网断连时仍可提供时间服务）
local&amp;nbsp;stratum&amp;nbsp;10

#&amp;nbsp;允许所有网段同步（可选，仅当本机作为&amp;nbsp;NTP&amp;nbsp;服务器时需要）
#&amp;nbsp;allow&amp;nbsp;0.0.0.0/0&lt;/pre&gt;&lt;ul class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;iburst&lt;/code&gt;：启动时快速同步，提升首次同步速度。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;code style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;local stratum 10&lt;/code&gt;：无外网时，本机可作为时间源供内网使用。&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;四、启动并设置开机自启&lt;/strong&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;启动&amp;nbsp;chronyd&amp;nbsp;服务
sudo&amp;nbsp;systemctl&amp;nbsp;start&amp;nbsp;chronyd

#&amp;nbsp;设置开机自启
sudo&amp;nbsp;systemctl&amp;nbsp;enable&amp;nbsp;chronyd

#&amp;nbsp;重启服务使配置生效
sudo&amp;nbsp;systemctl&amp;nbsp;restart&amp;nbsp;chronyd&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;五、立即强制同步（可选）&lt;/strong&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;立即校正时间（跳过平滑过渡，适合时间偏差大时）
sudo&amp;nbsp;chronyc&amp;nbsp;makestep&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;六、验证同步状态&lt;/strong&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;查看同步跟踪信息
chronyc&amp;nbsp;tracking

#&amp;nbsp;查看当前使用的&amp;nbsp;NTP&amp;nbsp;源（^*&amp;nbsp;表示当前主同步源）
chronyc&amp;nbsp;sources&amp;nbsp;-v

#&amp;nbsp;查看系统时间状态
timedatectl&amp;nbsp;status&lt;/pre&gt;&lt;div style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;正常输出中，&lt;code style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;System clock synchronized: yes&lt;/code&gt; 表示已自动同步。&lt;/div&gt;&lt;h3 style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; font-weight: 400; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;&lt;strong&gt;七、防火墙放行（如开启防火墙）&lt;/strong&gt;&lt;/h3&gt;&lt;p style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;chrony 默认使用 &lt;span style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-weight: 700; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;UDP 123&lt;/span&gt; 端口：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;sudo&amp;nbsp;firewall-cmd&amp;nbsp;--add-service=ntp&amp;nbsp;--permanent
sudo&amp;nbsp;firewall-cmd&amp;nbsp;--reload&lt;/pre&gt;&lt;h3 style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; font-weight: 400; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;&lt;strong&gt;总结&lt;/strong&gt;&lt;/h3&gt;&lt;ol style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-sans-serif, system-ui, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;, &amp;quot;Noto Color Emoji&amp;quot;; font-size: 16px; line-height: 24px; text-wrap-mode: wrap; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot; class=&quot; list-paddingleft-2&quot;&gt;&lt;li&gt;&lt;p&gt;安装 &lt;code style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace; line-height: 24px; display: inline; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;chrony&lt;/code&gt; → 设置时区 → 配置国内 NTP 源 → 启动并自启 → 验证同步。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;配置完成后，系统会&lt;span style=&quot;font-variant-numeric: normal; font-variant-east-asian: normal; font-variant-alternates: normal; font-size-adjust: none; font-language-override: normal; font-kerning: auto; font-optical-sizing: auto; font-feature-settings: normal; font-variation-settings: normal; font-variant-position: normal; font-variant-emoji: normal; font-stretch: normal; font-weight: 700; line-height: 24px; flex: 0 1 auto; flex-direction: row; justify-content: normal; align-items: normal; padding: 0px; margin: 0px; background-image: none; background-position: 0% 0%; background-size: auto; background-repeat: repeat; background-attachment: scroll; background-origin: padding-box; background-clip: border-box;&quot;&gt;自动在后台持续校准时间&lt;/span&gt;，无需手动干预。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;国内优先使用阿里云 NTP，同步更稳定、延迟更低。&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Fri, 13 Mar 2026 15:02:46 +0800</pubDate></item><item><title>Calibre-Web修复跨域问题</title><link>https://iant.work/post/899.html</link><description>&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: decimal;&quot;&gt;&lt;li&gt;&lt;p&gt;修改D:\calibre-web-master\cps\web.py文件&lt;/p&gt;&lt;p&gt;原来代码&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-python&quot;&gt;def&amp;nbsp;add_security_headers(resp):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default_src&amp;nbsp;=&amp;nbsp;([host.strip()&amp;nbsp;for&amp;nbsp;host&amp;nbsp;in&amp;nbsp;config.config_trustedhosts.split(&amp;#39;,&amp;#39;)&amp;nbsp;if&amp;nbsp;host]&amp;nbsp;+
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&amp;quot;&amp;#39;self&amp;#39;&amp;quot;,&amp;nbsp;&amp;quot;&amp;#39;unsafe-inline&amp;#39;&amp;quot;,&amp;nbsp;&amp;quot;&amp;#39;unsafe-eval&amp;#39;&amp;quot;])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;=&amp;nbsp;&amp;quot;default-src&amp;nbsp;&amp;quot;&amp;nbsp;+&amp;nbsp;&amp;#39;&amp;nbsp;&amp;#39;.join(default_src)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;&amp;nbsp;and&amp;nbsp;config.config_use_google_drive:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;quot;&amp;nbsp;blob:&amp;nbsp;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;;&amp;nbsp;font-src&amp;nbsp;&amp;#39;self&amp;#39;&amp;nbsp;data:&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;blob:&amp;nbsp;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;;&amp;nbsp;img-src&amp;nbsp;&amp;#39;self&amp;#39;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.path.startswith(&amp;quot;/author/&amp;quot;)&amp;nbsp;and&amp;nbsp;config.config_use_goodreads:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;images.gr-assets.com&amp;nbsp;i.gr-assets.com&amp;nbsp;s.gr-assets.com&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;data:&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;edit-book.show_edit_book&amp;quot;&amp;nbsp;or&amp;nbsp;config.config_use_google_drive:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;*&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;blob:&amp;nbsp;;&amp;nbsp;style-src-elem&amp;nbsp;&amp;#39;self&amp;#39;&amp;nbsp;blob:&amp;nbsp;&amp;#39;unsafe-inline&amp;#39;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;;&amp;nbsp;object-src&amp;nbsp;&amp;#39;none&amp;#39;;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;Content-Security-Policy&amp;#39;]&amp;nbsp;=&amp;nbsp;csp
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;X-Content-Type-Options&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;nosniff&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;X-Frame-Options&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;SAMEORIGIN&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;X-XSS-Protection&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;1;&amp;nbsp;mode=block&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;Strict-Transport-Security&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;max-age=31536000&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;resp&lt;/pre&gt;&lt;p&gt;修改为以下代码&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-python&quot;&gt;def&amp;nbsp;add_security_headers(resp):
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;default_src&amp;nbsp;=&amp;nbsp;([host.strip()&amp;nbsp;for&amp;nbsp;host&amp;nbsp;in&amp;nbsp;config.config_trustedhosts.split(&amp;#39;,&amp;#39;)&amp;nbsp;if&amp;nbsp;host]&amp;nbsp;+
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&amp;quot;&amp;#39;self&amp;#39;&amp;quot;,&amp;nbsp;&amp;quot;&amp;#39;unsafe-inline&amp;#39;&amp;quot;,&amp;nbsp;&amp;quot;&amp;#39;unsafe-eval&amp;#39;&amp;quot;])
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;=&amp;nbsp;&amp;quot;default-src&amp;nbsp;&amp;quot;&amp;nbsp;+&amp;nbsp;&amp;#39;&amp;nbsp;&amp;#39;.join(default_src)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;&amp;nbsp;and&amp;nbsp;config.config_use_google_drive:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;quot;&amp;nbsp;blob:&amp;nbsp;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;;&amp;nbsp;font-src&amp;nbsp;&amp;#39;self&amp;#39;&amp;nbsp;data:&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;blob:&amp;nbsp;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;;&amp;nbsp;img-src&amp;nbsp;&amp;#39;self&amp;#39;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;https:&amp;nbsp;http:&amp;nbsp;blob:&amp;quot;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.path.startswith(&amp;quot;/author/&amp;quot;)&amp;nbsp;and&amp;nbsp;config.config_use_goodreads:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;images.gr-assets.com&amp;nbsp;i.gr-assets.com&amp;nbsp;s.gr-assets.com&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;data:&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;edit-book.show_edit_book&amp;quot;&amp;nbsp;or&amp;nbsp;config.config_use_google_drive:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;*&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;if&amp;nbsp;request.endpoint&amp;nbsp;==&amp;nbsp;&amp;quot;web.read_book&amp;quot;:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;&amp;nbsp;;&amp;nbsp;style-src-elem&amp;nbsp;&amp;#39;self&amp;#39;&amp;nbsp;blob:&amp;nbsp;&amp;#39;unsafe-inline&amp;#39;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;csp&amp;nbsp;+=&amp;nbsp;&amp;quot;;&amp;nbsp;object-src&amp;nbsp;&amp;#39;none&amp;#39;;&amp;quot;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;Content-Security-Policy&amp;#39;]&amp;nbsp;=&amp;nbsp;csp
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;X-Content-Type-Options&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;nosniff&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;X-Frame-Options&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;SAMEORIGIN&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;X-XSS-Protection&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;1;&amp;nbsp;mode=block&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;resp.headers[&amp;#39;Strict-Transport-Security&amp;#39;]&amp;nbsp;=&amp;nbsp;&amp;#39;max-age=31536000&amp;#39;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return&amp;nbsp;resp&lt;/pre&gt;&lt;p&gt;cps增加http:和https:，支持外部图片资源&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;修复JS报错：D:\calibre-web-master\cps\static\js\libs\reader.min.js&lt;/p&gt;&lt;p&gt;将原来&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-javascript&quot;&gt;this.rendition=c.renderTo(&amp;quot;viewer&amp;quot;,{ignoreClass:&amp;quot;annotator-hl&amp;quot;,width:&amp;quot;100%&amp;quot;,height:&amp;quot;100%&amp;quot;})&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;修改为&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-javascript&quot;&gt;this.rendition=c.renderTo(&amp;quot;viewer&amp;quot;,{ignoreClass:&amp;quot;annotator-hl&amp;quot;,width:&amp;quot;100%&amp;quot;,height:&amp;quot;100%&amp;quot;,allowScriptedContent:true})&lt;/pre&gt;&lt;p&gt;增加 allowScriptedContent:true 参数&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;</description><pubDate>Tue, 20 Jan 2026 11:48:04 +0800</pubDate></item><item><title>acme.sh自动续期ssl证书</title><link>https://iant.work/post/898.html</link><description>&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;1.&amp;nbsp;安装acme.sh&amp;nbsp;+&amp;nbsp;自动注册Let&amp;#39;s&amp;nbsp;Encrypt（替换成你的任意邮箱，QQ/163都可以）
curl&amp;nbsp;https://get.acme.sh&amp;nbsp;|&amp;nbsp;sh&amp;nbsp;-s&amp;nbsp;email=你的邮箱@qq.com
source&amp;nbsp;~/.bashrc

#&amp;nbsp;2.&amp;nbsp;配置DNSPod的ID和Token（核心替换，粘贴你复制的内容即可）
echo&amp;nbsp;DP_Id=&amp;quot;你的DNSPod纯数字ID&amp;quot;&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/profile
echo&amp;nbsp;DP_Key=&amp;quot;你的DNSPod-Token字符串&amp;quot;&amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;/etc/profile
source&amp;nbsp;/etc/profile

#&amp;nbsp;3.&amp;nbsp;一键签发证书（唯一改动：--dns&amp;nbsp;dns_dp&amp;nbsp;适配DNSPod，其他不变）
acme.sh&amp;nbsp;--issue&amp;nbsp;-d&amp;nbsp;*.xxx.cn&amp;nbsp;-d&amp;nbsp;*.frp.xxx.cn&amp;nbsp;-d&amp;nbsp;xxx.work&amp;nbsp;--dns&amp;nbsp;dns_dp&amp;nbsp;--server&amp;nbsp;letsencrypt&amp;nbsp;-k&amp;nbsp;ec-256&amp;nbsp;--dnssleep&amp;nbsp;120

#&amp;nbsp;4.&amp;nbsp;部署证书到标准目录&amp;nbsp;+&amp;nbsp;自动重启nginx服务（完全不变，直接用）一张证书包含&amp;nbsp;3&amp;nbsp;个域名
acme.sh&amp;nbsp;--install-cert&amp;nbsp;-d&amp;nbsp;*.xxx.cn&amp;nbsp;\
--key-file&amp;nbsp;/mnt/sdb1/xxx/nginx-1.16.1/cert/xxx.cn.key&amp;nbsp;\
--fullchain-file&amp;nbsp;/mnt/sdb1/xxxx/nginx-1.16.1/cert/xxx.cn.pem&amp;nbsp;\
--reloadcmd&amp;nbsp;&amp;quot;systemctl&amp;nbsp;reload&amp;nbsp;nginx&amp;quot;&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Sat, 17 Jan 2026 02:18:19 +0800</pubDate></item><item><title>Token快过期了怎么办？三种续期方案，我选Refresh Token！</title><link>https://iant.work/post/897.html</link><description>&lt;p&gt;“&lt;strong&gt;同学，我们系统用的是Token认证，用户反馈说经常需要重新登录，体验很差。你有什么好的续期方案吗？顺便说说Token该怎么选型？&lt;/strong&gt;”&lt;/p&gt;&lt;p&gt;上面这段对话，是不是感觉下一秒就会发生在你的面试中？&lt;/p&gt;&lt;p&gt;别怕，这其实是一道“送分题”。它不仅考验你对用户认证体系的理解深度，更能体现你对系统设计中&lt;strong&gt;安全性&lt;/strong&gt;与&lt;strong&gt;用户体验&lt;/strong&gt;这对“欢喜冤家”的平衡能力。&lt;/p&gt;&lt;p&gt;今天，我们就把Token续期和选型这点事，一次性讲得明明白白。&lt;/p&gt;&lt;h2&gt;一、为什么需要续期？不让Token永不过期不就行了？&lt;/h2&gt;&lt;p&gt;在回答“怎么办”之前，我们必须先弄清楚“为什么”。&lt;/p&gt;&lt;p&gt;把Token设置成永不过期？听起来似乎一劳永逸，但这是一个极其危险的想法。Token本质上是一张进入你家小区的“临时门禁卡”，如果这张卡永不失效，一旦丢失（被黑客窃取），后果不堪设想。&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2025/09/202509234426_373.png&quot; title=&quot;1.png&quot; alt=&quot;1.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;所以，&lt;strong&gt;Token必须有有效期！&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;但有效期太短，用户正用得爽呢，突然就被强制下线，要求重新登录，那体验简直是灾难。为了解决这个矛盾，“续期”机制应运而生。它的核心目标是：&lt;strong&gt;在保障安全的前提下，让用户感觉不到Token的存在，实现“无感”续期。&lt;/strong&gt;&lt;/p&gt;&lt;h2&gt;&lt;strong&gt;二、续期三大主流方案，你Pick哪一个？&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;目前业界主流的续期方案有三种，我们逐一分析。&lt;/p&gt;&lt;h3&gt;方案一：滑动窗口续期 (Sliding Session)&lt;/h3&gt;&lt;p&gt;这是一种“在你无知无觉中，就帮你把事办了”的方案。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;工作方式&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;系统为每个Token设置一个过期时间（比如30分钟）。当用户带着Token来访问时，如果Token有效，服务端在返回数据的同时，会自动给用户换发一个拥有新的30分钟过期时间的新Token。&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2025/09/202509238017_1902.png&quot; title=&quot;2.png&quot; alt=&quot;2.png&quot;/&gt;&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;优点&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;实现简单，逻辑清晰，只要用户在规定时间内持续活跃，就能一直在线。&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;缺点&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol class=&quot;js_darkmode__text__60 list-paddingleft-2&quot; style=&quot;list-style-type: none;&quot;&gt;&lt;ol class=&quot;js_darkmode__text__61 list-paddingleft-2&quot; style=&quot;list-style-type: lower-alpha;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;安全风险&lt;/strong&gt;&lt;/p&gt;&lt;section&gt;如果一个Token被盗，攻击者也可以通过高频访问来让这个Token“永生”。&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;并发问题&lt;/strong&gt;&lt;/p&gt;&lt;section&gt;如果用户同时发了多个请求，可能会瞬间收到好几个新Token，客户端会感到困惑：“我到底该用哪一个？”&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;IO压力&lt;/strong&gt;&lt;/p&gt;&lt;section&gt;对于需要将Token信息存储在服务端的普通Token（下文会讲），每次续期都意味着一次写操作，会增加服务端IO压力。&lt;/section&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/ol&gt;&lt;p&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;ne-clipboard source=&quot;https%3A%2F%2Fwww.yuque.com%2Fu12222632%2Fas5rgl%2Fvnhdi61x7w1p4z9b&quot; data-pm-slice=&quot;0 0 []&quot;&gt;&lt;/ne-clipboard&gt;&lt;/p&gt;&lt;h3&gt;方案二：刷新令牌机制 (Refresh Token) -&amp;nbsp;⭐⭐⭐⭐⭐（强烈推荐）&lt;/h3&gt;&lt;p&gt;这是目前&lt;strong&gt;最主流、最安全、最推荐&lt;/strong&gt;的方案，也是你面试时最应该拿出来详谈的方案。&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #1F497D;&quot;&gt;核心逻辑：双令牌解耦（Access Token=访问权，Refresh Token=续期权）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;ne-clipboard source=&quot;https%3A%2F%2Fwww.yuque.com%2Fu12222632%2Fas5rgl%2Fvnhdi61x7w1p4z9b&quot; data-pm-slice=&quot;0 0 []&quot;&gt;&lt;/ne-clipboard&gt;&lt;/p&gt;&lt;p&gt;它引入了“双令牌”的概念，把“访问权限”和“续期权限”解耦。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;工作方式&lt;/strong&gt;&lt;/p&gt;&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: lower-alpha;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;首次登录&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;用户登录成功，服务器返回两个Token：&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;font-family: monospace;&quot;&gt;Access Token&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;访问令牌，&lt;/strong&gt;生命周期很短（如1小时），用于API请求时的身份验证。&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;Refresh Token&lt;/span&gt;&lt;/p&gt;&lt;section&gt;&lt;strong&gt;刷新令牌，&lt;/strong&gt;生命周期很长（如7天），专门用来获取新的&lt;code&gt;Access Token&lt;/code&gt;。&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;section&gt;&lt;strong&gt;日常访问&lt;/strong&gt;&lt;/section&gt;&lt;section&gt;客户端每次请求API，都只带上&lt;code&gt;Access Token&lt;/code&gt;。&lt;/section&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;Access Token过期&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;当&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;Access Token&lt;/code&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;过期，服务器返回&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;401 Unauthorized&lt;/code&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;。&lt;/span&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;静默刷新&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;客户端的请求拦截器捕获到401后，&lt;strong&gt;自动&lt;/strong&gt;携带&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;Refresh Token&lt;/code&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;去请求一个专门的刷新接口（如&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;/refresh&lt;/code&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;）。&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;获取新生&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;服务器验证&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;Refresh Token&lt;/code&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;有效后，签发一个&lt;/span&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;全新的&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;Access Token&lt;/code&gt;&lt;/strong&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;，返回给客户端。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;无感重试&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;客户端拿到新的&lt;/span&gt;&lt;code style=&quot;text-wrap-mode: wrap;&quot;&gt;Access Token&lt;/code&gt;&lt;span style=&quot;text-wrap-mode: wrap;&quot;&gt;后，重新执行刚才失败的API请求。整个过程对用户完全透明。&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2025/09/202509235005_9395.png&quot; title=&quot;3.png&quot; alt=&quot;3.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;优点&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;极致安全&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;Access Token寿命极短，即使泄露，攻击者也只能猖獗一小会儿。而用于续命的Refresh Token只在刷新时才露面，且服务端可以将其加入黑名单，强制某些用户下线。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;体验与控制兼备&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;完美解决了用户体验与服务端控制权的平衡问题。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;方案三：服务端自动续期&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;这是一种“爱操心”的服务端策略。&lt;/span&gt;&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;工作方式&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;客户端正常请求，服务端在验证Token的同时，会检查其剩余有效期。如果发现有效期不足某个阈值（比如只剩5分钟了），就在这次请求的响应头里，主动塞一个新的Token给客户端。客户端需要检查响应头，如果发现有新Token，就替换掉本地的旧Token。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2025/09/202509234017_7241.png&quot; title=&quot;4.png&quot; alt=&quot;4.png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;优点&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;续期时机由服务端掌握，客户端逻辑相对简单。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;缺点&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;属于“被动”续期，如果用户在Token即将过期的几分钟内恰好没有任何操作，那么Token还是会过期。此外，每次响应都可能需要额外的数据传输。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;三、灵魂拷问：JWT还是普通Token，到底该怎么选？&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;聊完了续期，我们必须面对另一个核心问题：你手里的Token，到底是什么类型的？这直接决定了你的系统架构。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;table class=&quot;js_darkmode__16&quot; width=&quot;572&quot;&gt;&lt;tbody style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; height: 33px;&quot; class=&quot;firstRow&quot;&gt;&lt;td data-colwidth=&quot;119&quot; width=&quot;250&quot; class=&quot;js_darkmode__17&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;特性维度&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;250&quot; width=&quot;250&quot; class=&quot;js_darkmode__18&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;JWT (JSON Web Token) - “身份证”&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;203&quot; width=&quot;250&quot; class=&quot;js_darkmode__19&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;普通 Token - “储物柜钥匙”&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; height: 33px;&quot;&gt;&lt;td data-colwidth=&quot;119&quot; width=&quot;250&quot; class=&quot;js_darkmode__20&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;核心机制&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;250&quot; width=&quot;250&quot; class=&quot;js_darkmode__21&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;无状态 (Stateless)&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;Token自身包含所有用户信息，服务端无需保存。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;203&quot; width=&quot;250&quot; class=&quot;js_darkmode__22&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;有状态 (Stateful)&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;Token只是一个引用ID，用户信息存在于服务端（如Redis）。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; height: 33px;&quot;&gt;&lt;td data-colwidth=&quot;119&quot; width=&quot;250&quot; class=&quot;js_darkmode__23&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;性能/扩展性&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;250&quot; width=&quot;250&quot; class=&quot;js_darkmode__24&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;✅&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;高&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;服务端验证签名即可，&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;无需查库/缓存&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;203&quot; width=&quot;250&quot; class=&quot;js_darkmode__25&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;❌&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;低&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;每次请求都需&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;查询一次DB/缓存&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;，有I/O开销。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; height: 33px;&quot;&gt;&lt;td data-colwidth=&quot;119&quot; width=&quot;250&quot; class=&quot;js_darkmode__26&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;安全性&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;250&quot; width=&quot;250&quot; class=&quot;js_darkmode__27&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;⚠️&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;中&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;Payload部分是明文，&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;严禁存放敏感信息&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;203&quot; width=&quot;250&quot; class=&quot;js_darkmode__28&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;✅&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;高&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;Token本身无任何意义，信息不外泄。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; height: 33px;&quot;&gt;&lt;td data-colwidth=&quot;119&quot; width=&quot;250&quot; class=&quot;js_darkmode__29&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;吊销/注销&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;250&quot; width=&quot;250&quot; class=&quot;js_darkmode__30&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;❌&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;难&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;过期前始终有效。想让其提前失效，需引入黑名单。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;203&quot; width=&quot;250&quot; class=&quot;js_darkmode__31&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;✅&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;易&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;只需从Redis中&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;删除Token记录&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;，即可立即失效。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; height: 33px;&quot;&gt;&lt;td data-colwidth=&quot;119&quot; width=&quot;250&quot; class=&quot;js_darkmode__32&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;微服务&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;250&quot; width=&quot;250&quot; class=&quot;js_darkmode__33&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;✅&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;极佳&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;天然适合微服务。任何服务只要有密钥，就能独立验证。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;td data-colwidth=&quot;203&quot; width=&quot;250&quot; class=&quot;js_darkmode__34&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; outline: 0px; word-break: break-all; hyphens: auto; border-color: rgb(217, 217, 217); max-width: 100%; overflow-wrap: break-word !important; box-sizing: border-box !important;&quot;&gt;&lt;p style=&quot;-webkit-tap-highlight-color: transparent; outline: 0px; max-width: 100%; clear: both; min-height: 24px; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;❌&lt;/span&gt;&lt;strong style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;差&lt;/strong&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;&lt;br style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;/&gt;&lt;/span&gt;&lt;span leaf=&quot;&quot; style=&quot;-webkit-tap-highlight-color: transparent; margin: 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important;&quot;&gt;所有服务都需访问同一个中心化的会话存储，增加耦合。&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;选型结论：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;单体应用 &amp;amp; 强管理需求&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;如果你的系统是传统的单体应用，或者需要频繁地进行“强制用户下线”、“后台踢人”等强力管控操作，那么普通Token（配合Redis）是你的不二之选。它的控制力无与伦比。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;微服务架构 &amp;amp; 无状态API&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;/strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;如果你的系统是微服务架构，或者追求无状态、可无限水平扩展的API，那么请果断拥抱JWT。它为解耦而生。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;四、最佳实践：Refresh Token + JWT&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;看到这里，你可能会想，有没有一种方案能集各家之所长？&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;当然有！那就是 Refresh Token机制 + JWT 的黄金组合。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2025/09/202509234436_7014.png&quot; title=&quot;5.png&quot; alt=&quot;5.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;这套组合拳的打法是：&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: decimal;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;Access Token 使用JWT格式&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;充分利用JWT的无状态、适合微服务的特性。同时，将其生命周期设置得极短（比如15分钟到1小时），即使泄露，风险也极低。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;Refresh Token 使用普通Token格式&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;它只是一个无意义的随机字符串，存储在服务端（比如Redis或数据库中），并与用户ID关联。这样服务端就拥有了对续期权限的绝对控制，可以随时让某个Refresh Token失效。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;这个组合，既享受了JWT在业务请求中的高性能，又通过Refresh Token弥补了JWT难以吊销的短板，同时保证了优秀的用户体验。堪称完美！&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2025/09/202509237614_409.png&quot; title=&quot;6.png&quot; alt=&quot;6.png&quot;/&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;总结&lt;/span&gt;&lt;/strong&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;回到开头的面试题，现在你可以自信地给出答案了：&lt;/span&gt;&lt;/p&gt;&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: decimal;&quot;&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;阐述续期的必要性&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;平衡安全与体验。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;列举三种续期方案&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;滑动窗口、Refresh Token（重点讲解）、服务端自动续期。表明你对Refresh Token方案的青睐，并详细阐述其“双令牌”工作流程和优势。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;分析Token选型&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;清晰对比JWT和普通Token的优劣，并给出在单体应用和微服务架构下的选型建议。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;给出最佳实践&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;抛出Refresh Token + JWT的黄金组合，并解释它如何取长补短，成为现代应用的事实标准。&lt;/span&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;搞懂了这些，下次面试官再问起Token，你就可以把这篇文章的要点娓娓道来。相信我，这绝对会成为你面试中的高光时刻。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Tue, 23 Sep 2025 10:35:15 +0800</pubDate></item><item><title>如何降低创业和副业的焦虑感？</title><link>https://iant.work/post/896.html</link><description>&lt;p&gt;1/ 我从没见过一个持续在做事且完全不焦虑的人，谁说自己完全不焦虑，要么他不是真在做事，要么他在骗你。&lt;/p&gt;&lt;p&gt;2/ 焦虑是常态，对未来感觉到迷茫也是常态，我也会有焦虑，习惯它，与之共处。放弃完美主义，承认我们在生产的都是垃圾，包括这篇小灯塔。&lt;/p&gt;&lt;p&gt;3/ 当焦虑来临时，提醒自己，去做一件具体的事情：写作，运动，与别人交流，看书，剪视频，做任何事情都有意义，唯独在焦虑的状态里面什么都不做没有意义。&lt;/p&gt;&lt;p&gt;4/ 每一种情绪都有积极意义，焦虑也是。焦虑的本质是不知道该如何面对不确定性。而感觉到不确定的核心是我们不知道自己在焦虑什么，所以，打开备忘录，把自己在焦虑的点123罗列下来，找到具体在焦虑的问题是什么，当你知道自己想解决的问题是什么时，这个问题已经基本解决了一大半，尤其是有ai的帮助下。&lt;/p&gt;&lt;p&gt;5/ 给解决问题留足够长的时间。我在前两年对投资感觉到很焦虑，花了几年时间才真正找到适合自己的方法，中间和很多人聊，进了一些圈子，做了各种尝试，最终发现匹配我的可能就是买入btc，tsl这样的股票，然后长期持有，大道至简。经历过这个过程，我发现要留给真正重要的议题足够长的时间，然后慢慢的耐心的去解决。&lt;/p&gt;&lt;p&gt;6/ 永远不要担心错过好东西，这个世界的好东西，永远留足了时间，让你慢慢思考和决策，告诉你再不上车就晚了的，不要理会他。这个世界永远有非常充足的时间让你慢慢上车，比如btc，即使现在已经10万美金一个，10年后回头看，仍然不晚。此处不构成投资建议，如果你想买，请为自己的决策负责任。&lt;/p&gt;&lt;p&gt;7/ 所有的焦虑，最终其实都是死亡焦虑，我们觉得时间不够了。花点时间，看见一下死亡，死亡对我们到底真正意味着什么？然后向死而生。如果对于死都不会感觉到焦虑，还会对什么感觉到焦虑？&lt;/p&gt;&lt;p&gt;8/ 不要急着去追热点，也不要被各种热点裹挟进去，比如deepseek，绝大多数流量毫无意义，稳固的去建立自己的基本盘，才能守正出奇，知道自己有什么，才不会对没有的感觉到焦虑。&lt;/p&gt;&lt;p&gt;9/ 回归自己，回归健康，回归家人，增加一些生活中的小确幸。小财靠拼，大财靠命。当时代在转变时，给所有人都留足了非常长的非常大的时间窗口，你只需要在场即可。在生财有术，就是在场，在生财有术，你的信息前沿度和知识储备量已经超越了 99%的中国人。&lt;/p&gt;&lt;p&gt;10/ 知足常乐，生活在这个时代真幸运。&lt;/p&gt;</description><pubDate>Thu, 06 Feb 2025 09:09:14 +0800</pubDate></item><item><title>nul文件删除方法</title><link>https://iant.work/post/895.html</link><description>&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: decimal;&quot;&gt;&lt;li&gt;&lt;p&gt;在nul文件当前目录建立一个bat文件，内容如下：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;DEL&amp;nbsp;/F&amp;nbsp;/A&amp;nbsp;/Q&amp;nbsp;\\?\%1
RD&amp;nbsp;/S&amp;nbsp;/Q&amp;nbsp;\\?\%1&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;用鼠标将nul文件拖到bat图标上，即可删除nul文件。&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;</description><pubDate>Thu, 16 Jan 2025 01:07:28 +0800</pubDate></item><item><title>Html2Image在Linux中文方块乱码问题</title><link>https://iant.work/post/894.html</link><description>&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;第一步&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;安装fontconfig&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;yum&amp;nbsp;-y&amp;nbsp;install&amp;nbsp;fontconfig第二步&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;查看/usr/share/目录下是否有fontconfig 和 fonts这两个目录&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cd&amp;nbsp;/usr/share/&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;第三步&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;在本地C:\Windows\Fonts找文件【simhei.ttf】和【simsun.ttc】并上传到【/usr/share/fonts/】目录。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;如果你不想找或找不到，请联系我。目前不让上传&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;第四步&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;在/usr/share/fonts/目录创建一个文件夹chinese&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cd&amp;nbsp;/usr/shared/fonts
mkdir&amp;nbsp;chinese&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;第五步&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;进入$JAVA_HOME/jre/lib/fonts并新建【fallback】文件夹。将那两个字体文件复制进去。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;cd&amp;nbsp;$JAVA_HOME/jre/lib/fonts
mkdir&amp;nbsp;fallback&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;第六步&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;刷新缓存，并查看是否安装成功。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;fc-cache&amp;nbsp;-fv
fc-list&amp;nbsp;:lang=zh&lt;/pre&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;[root@cws-hw-0006&amp;nbsp;~]#&amp;nbsp;fc-list&amp;nbsp;:lang=zh
/usr/share/fonts/msyh/msyhbd.ttc:&amp;nbsp;Microsoft&amp;nbsp;YaHei&amp;nbsp;UI:style=Bold,Negreta,tučné,fed,Fett,Έντονα,Negrita,Lihavoitu,Gras,Félkövér,Grassetto,Vet,Halvfet,Pogrubiony,Negrito,Полужирный,Fet,Kalın,Krepko,Lodia
/usr/share/fonts/google-noto-cjk/NotoSansCJK-DemiLight.ttc:&amp;nbsp;Noto&amp;nbsp;Sans&amp;nbsp;CJK&amp;nbsp;TC,Noto&amp;nbsp;Sans&amp;nbsp;CJK&amp;nbsp;TC&amp;nbsp;DemiLight:style=DemiLight,Regular
/usr/share/fonts/google-noto-cjk/NotoSerifCJK-Black.ttc:&amp;nbsp;Noto&amp;nbsp;Serif&amp;nbsp;CJK&amp;nbsp;SC,Noto&amp;nbsp;Serif&amp;nbsp;CJK&amp;nbsp;SC&amp;nbsp;Black:style=Black,Regular
/usr/share/fonts/msyh/msyhl.ttc:&amp;nbsp;Microsoft&amp;nbsp;YaHei&amp;nbsp;UI,Microsoft&amp;nbsp;YaHei&amp;nbsp;UI&amp;nbsp;Light:style=Light,Regular&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;第七步&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;重启应用即可。无需重启服务器&lt;/p&gt;</description><pubDate>Wed, 18 Dec 2024 15:00:22 +0800</pubDate></item><item><title>HTTPS证书终于挥下了无情的镰刀-HTTPS证书自动续签方案</title><link>https://iant.work/post/893.html</link><description>&lt;p&gt;&lt;strong&gt;现在网站基本都上了 HTTPS 证书&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;阿里云 SSL 产品日前发布公告，公告显示自 2023 年 11 月 14 日开始生效厂商策略，对于免费提供的 SSL 证书签发后证书有效期统一为 3 个月，不再免费提供 1 年版免费证书。想要 1 年的需要购买 68 块一年。终于 HTTPS 证书也开始收割了。&lt;span style=&quot;text-decoration: line-through;&quot;&gt;有钱的可以去支持下，毕竟不能一直靠爱发电。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;继而腾讯云等相关证书厂商也都更改了策略，一时间 HTTPS 证书哀嚎遍野。 腾讯云可以申请 1 年的的，但是数量只有 10 个。&lt;/p&gt;&lt;p&gt;之前是免费 1 年的，数量也够用，也就懒得折腾了。到期再换，本来也想看证书自动续期的方案，正好借此机会研究下。&lt;/p&gt;&lt;p&gt;&lt;strong&gt;使用 acme.sh 自动签发 ZeroSSL 的 ECC 证书&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;安装 acme.sh&lt;/strong&gt;&lt;/p&gt;&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: decimal;&quot;&gt;&lt;li&gt;&lt;p&gt;先安装好 curl，然后执行脚本：&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;在线安装
&amp;nbsp;
使用如下命令，邮箱设置为你接受通知的邮箱号
&amp;nbsp;
curl&amp;nbsp;https://get.acme.sh&amp;nbsp;|&amp;nbsp;sh&amp;nbsp;-s&amp;nbsp;email=my@example.com
或者
&amp;nbsp;
wget&amp;nbsp;-O&amp;nbsp;-&amp;nbsp;&amp;nbsp;https://get.acme.sh&amp;nbsp;|&amp;nbsp;sh&amp;nbsp;-s&amp;nbsp;email=my@example.com
&amp;nbsp;
&amp;nbsp;
git方式
&amp;nbsp;
国内服务器使用
git&amp;nbsp;clone&amp;nbsp;https://gitee.com/neilpang/acme.sh.git
&amp;nbsp;
&amp;nbsp;
git&amp;nbsp;clone&amp;nbsp;https://github.com/acmesh-official/acme.sh.git
&amp;nbsp;
cd&amp;nbsp;./acme.sh
./acme.sh&amp;nbsp;--install&amp;nbsp;-m&amp;nbsp;my@example.com&lt;/pre&gt;&lt;p&gt;请注意替换 my@example.com.com 为你自己的邮箱,方便证书到期或者签发等结果通知。&lt;/p&gt;&lt;p&gt;安装完成后重新加载 Bash：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;source&amp;nbsp;~/.bashrc&lt;/pre&gt;&lt;p&gt;然后开启自动更新：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;acme.sh&amp;nbsp;--upgrade&amp;nbsp;--auto-upgrade&lt;/pre&gt;&lt;p&gt;目前 acme.sh 支持 5 个正式环境 CA，分别是&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;Let&amp;#39;s Encrypt&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Buypass&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;ZeroSSL&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;SSL.com&lt;/p&gt;&lt;/li&gt;&lt;li&gt;&lt;p&gt;Google Public CA，&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;默认使用 ZeroSSL，如果需要更换可以使用如下命令：&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;切换&amp;nbsp;Let&amp;#39;s&amp;nbsp;Encrypt
acme.sh&amp;nbsp;--set-default-ca&amp;nbsp;--server&amp;nbsp;letsencrypt
切换&amp;nbsp;Buypass
acme.sh&amp;nbsp;--set-default-ca&amp;nbsp;--server&amp;nbsp;buypass
切换&amp;nbsp;ZeroSSL
acme.sh&amp;nbsp;--set-default-ca&amp;nbsp;--server&amp;nbsp;zerossl
切换&amp;nbsp;SSL.com
acme.sh&amp;nbsp;--set-default-ca&amp;nbsp;--server&amp;nbsp;ssl.com
切换&amp;nbsp;Google&amp;nbsp;Public&amp;nbsp;CA
acme.sh&amp;nbsp;--set-default-ca&amp;nbsp;--server&amp;nbsp;google&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;配置 zerossl 的泛域名证书&lt;/strong&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;如果没有 zerossl 账户也是可以生成的，但是建议注册个账户方便以后通过 api 管理你申请的证书。&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;注册后进入 developer 界面&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411209054_145.png&quot; title=&quot;1.png&quot; alt=&quot;1.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;如图上面是 API key，下面是 EAB&lt;/p&gt;&lt;p&gt;将 acme.sh 的注册服务器改为 ZeroSSL&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;acme.sh&amp;nbsp;--register-account&amp;nbsp;--server&amp;nbsp;zerossl&amp;nbsp;\
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;--eab-kid&amp;nbsp;xxxxxxxxxxxx&amp;nbsp;&amp;nbsp;\
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;--eab-hmac-key&amp;nbsp;xxxxxxxxx&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;获取 eab-kid 和 eab-hmac-key&lt;/strong&gt;&lt;/p&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;方式 1 通过 API Key 获取&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;curl&amp;nbsp;-s&amp;nbsp;-X&amp;nbsp;POST&amp;nbsp;&amp;quot;https://api.zerossl.com/acme/eab-credentials?access_key=c3xxxxxx&amp;quot;
{
&amp;quot;success&amp;quot;:&amp;nbsp;true,
&amp;quot;eab_kid&amp;quot;:&amp;nbsp;&amp;quot;EWxxxxxxxx&amp;quot;,
&amp;quot;eab_hmac_key&amp;quot;:&amp;nbsp;&amp;quot;KPeQJxxxxxxxxx&amp;quot;
}&lt;/pre&gt;&lt;ul class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: disc;&quot;&gt;&lt;li&gt;&lt;p&gt;方式 2 直接生成 eab&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411208682_6947.png&quot; title=&quot;2.png&quot; alt=&quot;2.png&quot;/&gt;保存后执行上面的命令 将 acme.sh 的注册服务器改为 ZeroSSL，然后返回注册成功信息&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411203212_4250.png&quot; title=&quot;3.png&quot; alt=&quot;3.png&quot;/&gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;使用 Dns Api 注册正式&lt;/strong&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;可以申请泛域名证书。 比如 *.abc.com 可以自动检测更新。&lt;/p&gt;&lt;/blockquote&gt;&lt;p&gt;有多种方式可以申请证书，但是 如果使用泛域名，只能使用 DNS API 模式，且会自动更新，推荐这种方式：&lt;/p&gt;&lt;p&gt;为了保证安全 创建一个用户 单独申请 DNS 管理权限&lt;/p&gt;&lt;ol class=&quot; list-paddingleft-2&quot; style=&quot;list-style-type: decimal;&quot;&gt;&lt;li&gt;&lt;p&gt;打开 RAM 访问控制--&amp;gt;身份管理--&amp;gt;创建用户”，输入 用户名、备注; 选择 OpenAPI 调用访问 启用 AccessKey ID 和 AccessKey Secret， 支持通过 API 或其他开发工具访问&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;点击右边的“添加权限”按钮，打开授权窗口。&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411207563_14.png&quot; title=&quot;4.png&quot; alt=&quot;4.png&quot;/&gt;有了 key 和 secret 然后执行命令创建&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;先添加阿里云Aliyun的DNS&amp;nbsp;api密钥到临时环境变量
export&amp;nbsp;Ali_Key=&amp;quot;AccessKeyId&amp;quot;
export&amp;nbsp;Ali_Secret=&amp;quot;AccessKeySecret&amp;quot;&lt;/pre&gt;&lt;p&gt;执行注册命令 （可以进行单域名、多域名、泛域名进行颁发。）&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;#&amp;nbsp;上面的临时变量，在添加证书后，会保存在account.conf中，后续不需要再指定
acme.sh&amp;nbsp;--issue&amp;nbsp;--dns&amp;nbsp;dns_ali&amp;nbsp;-d&amp;nbsp;abc.com&amp;nbsp;-d&amp;nbsp;*.abc.com&amp;nbsp;--keylength&amp;nbsp;ec-256
&amp;nbsp;
#查看命令帮助
acme.sh&amp;nbsp;-h&lt;/pre&gt;&lt;p&gt;--dns 指定 DNS 服务商，dns_dp 代表 DNSPod，还有 dns_cf 代表 CloudFlare，更多的字段见 https://github.com/acmesh-official/acme.sh/tree/master/dnsapi&lt;/p&gt;&lt;p&gt;-d *.abc.com 表示签发泛域名证书 如果 shell 工具不行视情况加*转义&lt;/p&gt;&lt;p&gt;--keylength ec-256 表示签发 ECC 证书，不添加则签发 RSA 证书，可选参数还有 ec-384 和 ec-521&lt;/p&gt;&lt;p&gt;这里会进行域名的 DNS 验证，中间会等待 若干 秒来验证正确性，验证成功后会有成功标记。&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411203148_6593.png&quot; title=&quot;5.png&quot; alt=&quot;5.png&quot;/&gt;成功后会显示证书目录信息&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411203435_2140.png&quot; title=&quot;6.png&quot; alt=&quot;6.png&quot;/&gt;&lt;strong&gt;腾讯云 同理。&lt;/strong&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;export&amp;nbsp;DP_Id=&amp;quot;API&amp;nbsp;Token&amp;nbsp;的&amp;nbsp;ID&amp;quot;
export&amp;nbsp;DP_Key=&amp;quot;API&amp;nbsp;Token&amp;quot;&lt;/pre&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;acme.sh&amp;nbsp;--issue&amp;nbsp;--dns&amp;nbsp;dns_dp&amp;nbsp;-d&amp;nbsp;abc.com&amp;nbsp;-d&amp;nbsp;*.abc.com&amp;nbsp;--keylength&amp;nbsp;ec-256&lt;/pre&gt;&lt;p&gt;要停止续签某域名的话，手动执行 然后删除证书目录&lt;br/&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;acme.sh&amp;nbsp;--remove&amp;nbsp;-d&amp;nbsp;abc.com&lt;/pre&gt;&lt;p&gt;&lt;strong&gt;其他&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;ECC 证书：ECC 证书是基于 ECC 算法的 SSL 证书，ECC 证书中文名称为椭圆加密算法，新一代算法趋势主流，一般采用 256 位加密长度，加密速度快，效率更高，对服务器资源消耗低，而且最重要的是更安全，抗攻击型更强。&lt;/p&gt;&lt;p&gt;RSA 证书：RSA 证书是基于 RSA 算法的 SSL 证书，RSA 算法是国际标准算法，应用较早，最为普及，比 ECC 算法的适用范围更广，兼容性更好，一般采用 2048 位的加密长度，但是对服务端性能消耗高。&lt;/p&gt;&lt;blockquote&gt;&lt;p&gt;acme 的 github 地址(https://github.com/acmesh-official/acme.sh?tab=readme-ov-file)&lt;/p&gt;&lt;/blockquote&gt;</description><pubDate>Wed, 20 Nov 2024 00:00:33 +0800</pubDate></item><item><title>星际争霸2秘籍大全</title><link>https://iant.work/post/892.html</link><description>&lt;p&gt;&lt;/p&gt;&lt;p&gt;WhatIsBestInLife：立刻获胜。&lt;/p&gt;&lt;p&gt;LetsJustBugOutAndCallItEven：立刻失败。&lt;/p&gt;&lt;p&gt;TookTheRedPill：取消战争迷雾。&amp;nbsp;&lt;/p&gt;&lt;p&gt;Bunker55AliveInside：无限人口。&amp;nbsp;&lt;/p&gt;&lt;p&gt;TerribleTerribleDamage：开启无敌模式。&lt;/p&gt;&lt;p&gt;SpectralTiger：增加5000晶矿。&lt;/p&gt;&lt;p&gt;RealMenDrillDeep：增加5000气矿。&amp;nbsp;&lt;/p&gt;&lt;p&gt;WhoRunBartertown：增加5000晶矿+气矿。&lt;/p&gt;&lt;p&gt;SoSayWeAll：取消科技的要求。&lt;/p&gt;&lt;p&gt;IAmIronMan：立刻获得所有升级。&amp;nbsp;&lt;/p&gt;&lt;p&gt;CatFoodForPrawnGuns：开启快速建造和升级。&amp;nbsp;&lt;/p&gt;&lt;p&gt;HanShotFirst：取消技能冷却时间。&lt;/p&gt;&lt;p&gt;TyuHasLeftTheGame：取消胜利条件，可以无限游戏下去。&lt;/p&gt;&lt;p&gt;NeverGiveUpNeverSurrender：允许战败后继续游戏。&lt;/p&gt;&lt;p&gt;ImADoctorNotARoachJim：开启单位快速治愈。&lt;/p&gt;&lt;p&gt;MoreDotsMoreDots：取消所有单位和建筑费用。&amp;nbsp;&lt;/p&gt;&lt;p&gt;WhySoSerious：获得500万资金。&amp;nbsp;&lt;/p&gt;&lt;p&gt;LeaveYourSleep：解锁所有剧情任务。&lt;/p&gt;&lt;p&gt;EyeOfSauron：解锁所有剧情影片。&lt;/p&gt;&lt;p&gt;StayClassyMarSara：解锁所有UNN新闻播报。&amp;nbsp;&lt;/p&gt;&lt;p&gt;HoradricCube：解锁所有获得研究科技。&lt;/p&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Sun, 10 Nov 2024 00:25:05 +0800</pubDate></item><item><title>解决`SQLyog Trial`试用到期的问题（提供一个脚本解决方案）</title><link>https://iant.work/post/891.html</link><description>&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;本文将总结SQLyog Trial试用到期的问题。&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;其实解决起来很简单，就是将SQLyog相关注册表删掉即可&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;一、要删除的注册表项&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;Win+R打开运行，输入regedit回车，打开注册表&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;在HKEY_CURRENT_USER\SOFTWARE路径下，找到{d58cb4b1-47f3-45cb-a209-f298d0c3f756} 这个一串字符串的项&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;（不确定大家的是否都一样，自己找找，找到包含InD110、InU值的）&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;img class=&quot;ue-image&quot; src=&quot;https://upload.iant.work/blog/2024/11/202411042534_7456.png&quot; title=&quot;d7f3c3d11cec011f1c817d0b048d15e9.png&quot; alt=&quot;d7f3c3d11cec011f1c817d0b048d15e9.png&quot;/&gt;&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif; font-variant-ligatures: no-common-ligatures; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;&gt;删除这个项，即可解决问题&lt;/p&gt;&lt;h2&gt;&lt;a name=&quot;t2&quot; style=&quot;box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); font-synthesis-style: auto; overflow-wrap: break-word;&quot;&gt;&lt;/a&gt;&lt;a id=&quot;_15&quot; style=&quot;box-sizing: border-box; outline: none; margin: 0px; padding: 0px; font-weight: normal; cursor: pointer; background-color: transparent; color: rgb(78, 161, 219); font-synthesis-style: auto; overflow-wrap: break-word;&quot;&gt;&lt;/a&gt;二、写了个脚本干这个事儿&lt;/h2&gt;&lt;p style=&quot;box-sizing: border-box; outline: 0px; margin-top: 0px; margin-bottom: 16px; padding: 0px; --el-button-hover-bg-color: #6d5ffd; --el-button-hover-border-color: #6d5ffd; --el-button-active-bg-color: #6d5ffd; --el-button-active-border-color: #6d5ffd; font-size: 16px; color: rgb(77, 77, 77); line-height: 26px; overflow: auto hidden; font-synthesis-style: auto; overflow-wrap: break-word; font-family: -apple-system, &amp;quot;SF UI Text&amp;quot;, Arial, &amp;quot;PingFang SC&amp;quot;, &amp;quot;Hiragino Sans GB&amp;quot;, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;WenQuanYi Micro Hei&amp;quot;, sans-serif; font-variant-ligatures: no-common-ligatures; text-wrap-mode: wrap; background-color: rgb(255, 255, 255);&quot;&gt;每过14天都要手动删除一下这个，好像也还能接受，但我还是写了一个脚本来完成这项工作。&lt;br style=&quot;box-sizing: border-box; outline: 0px; font-synthesis-style: auto; overflow-wrap: break-word;&quot;/&gt;直接上脚本内容(bat脚本)&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;@echo&amp;nbsp;off

title&amp;nbsp;batch&amp;nbsp;script&amp;nbsp;for&amp;nbsp;SQLyog

REM&amp;nbsp;以管理员身份运行（开启后每次运行该脚本生成的快捷方式都会闪一下）
REM&amp;nbsp;%1&amp;nbsp;mshta&amp;nbsp;vbscript:CreateObject(&amp;quot;Shell.Application&amp;quot;).ShellExecute(&amp;quot;cmd.exe&amp;quot;,&amp;quot;/c&amp;nbsp;&amp;quot;^&amp;amp;chr(34)^&amp;amp;&amp;quot;%~0&amp;quot;^&amp;amp;chr(34)^&amp;amp;&amp;quot;&amp;nbsp;::&amp;quot;,&amp;quot;%cd%&amp;quot;,&amp;quot;runas&amp;quot;,1)(window.close)&amp;amp;&amp;amp;exit


REM&amp;nbsp;请改为你本地SQLyog安装位置
set&amp;nbsp;sqlyog_dir=E:\Program&amp;nbsp;Files\SQLyog&amp;nbsp;Trial
set&amp;nbsp;sqlyog_app=%sqlyog_dir%\SQLyog.exe

REM&amp;nbsp;SQLyog注册表key，可能跟你的不一样，如果不一样，请替换为你的
set&amp;nbsp;sqlyog_reg_key=HKEY_CURRENT_USER\SOFTWARE\{d58cb4b1-47f3-45cb-a209-f298d0c3f756}

if&amp;nbsp;&amp;quot;%1&amp;quot;==&amp;quot;shortcut&amp;quot;&amp;nbsp;(
	call&amp;nbsp;:delete_reg_key
	call&amp;nbsp;:start_sqlyog
)&amp;nbsp;else&amp;nbsp;(
	call&amp;nbsp;:create_shortcut
)
&amp;nbsp;
exit&amp;nbsp;/b


:delete_reg_key

	REM&amp;nbsp;判断注册表是否存在，如果存在删除注册表项
	reg&amp;nbsp;query&amp;nbsp;%sqlyog_reg_key%
	if&amp;nbsp;%errorlevel%==0&amp;nbsp;(
	&amp;nbsp;&amp;nbsp;reg&amp;nbsp;delete&amp;nbsp;%sqlyog_reg_key%&amp;nbsp;/f
	)
	goto&amp;nbsp;:EOF


:create_shortcut

	REM&amp;nbsp;快捷方式信息
	set&amp;nbsp;shortcut_name=SQLyog.lnk
	set&amp;nbsp;shortcut_folder=%UserProfile%\Desktop
	set&amp;nbsp;shortcut_path=%shortcut_folder%\%shortcut_name%
	set&amp;nbsp;shortcut_description=This&amp;nbsp;is&amp;nbsp;a&amp;nbsp;shortcut&amp;nbsp;created&amp;nbsp;for&amp;nbsp;the&amp;nbsp;bat&amp;nbsp;script,&amp;nbsp;the&amp;nbsp;script&amp;nbsp;is&amp;nbsp;mainly&amp;nbsp;to&amp;nbsp;delete&amp;nbsp;the&amp;nbsp;registry&amp;nbsp;key&amp;nbsp;about&amp;nbsp;the&amp;nbsp;trial&amp;nbsp;period.

	REM&amp;nbsp;判断快捷方式是否存在，如果不存在则创建之，存在则不创建
	for&amp;nbsp;%%I&amp;nbsp;in&amp;nbsp;(&amp;quot;%shortcut_path%&amp;quot;)&amp;nbsp;do&amp;nbsp;(set&amp;nbsp;existing_shortcut=%%~fI)

	if&amp;nbsp;exist&amp;nbsp;&amp;quot;%existing_shortcut%&amp;quot;&amp;nbsp;(
		goto&amp;nbsp;:EOF
	)

	REM&amp;nbsp;通过SQLyog.exe获取SQLyog的icon
	set&amp;nbsp;icon_file=%sqlyog_app%
	set&amp;nbsp;icon_index=0
	set&amp;nbsp;working_dir=%sqlyog_dir%
	set&amp;nbsp;the_scene=shortcut

	REM&amp;nbsp;获取当前脚本的绝对路径
	set&amp;nbsp;script_path=%~f0

	REM&amp;nbsp;开始菜单路径
	set&amp;nbsp;start_menu_dir=%ProgramData%\Microsoft\Windows\Start&amp;nbsp;Menu\Programs

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;REM&amp;nbsp;为当前脚本创建快捷方式（为了便于设别，且美观，设置快捷方式的图标为SQLyog的icon）
	powershell&amp;nbsp;-Command&amp;nbsp;&amp;quot;$WshShell&amp;nbsp;=&amp;nbsp;New-Object&amp;nbsp;-ComObject&amp;nbsp;WScript.Shell;&amp;nbsp;$Shortcut&amp;nbsp;=&amp;nbsp;$WshShell.CreateShortcut(&amp;#39;%shortcut_path%&amp;#39;);&amp;nbsp;$Shortcut.TargetPath&amp;nbsp;=&amp;nbsp;&amp;#39;%script_path%&amp;#39;;&amp;nbsp;$Shortcut.WorkingDirectory&amp;nbsp;=&amp;nbsp;&amp;#39;%working_dir%&amp;#39;;&amp;nbsp;$Shortcut.Arguments&amp;nbsp;=&amp;nbsp;&amp;#39;%the_scene%&amp;#39;&amp;nbsp;;&amp;nbsp;$Shortcut.IconLocation&amp;nbsp;=&amp;nbsp;&amp;#39;%icon_file%,%icon_index%&amp;#39;;&amp;nbsp;$Shortcut.Description&amp;nbsp;=&amp;nbsp;&amp;#39;%shortcut_description%&amp;#39;;&amp;nbsp;$Shortcut.Save()&amp;quot;

	REM&amp;nbsp;将创建的快捷方式，copy一份到开始菜单（需要管理员权限运行才能成功copy）
	echo&amp;nbsp;F&amp;nbsp;|&amp;nbsp;xcopy&amp;nbsp;&amp;quot;%shortcut_path%&amp;quot;&amp;nbsp;&amp;quot;%start_menu_dir%\%shortcut_name%&amp;quot;&amp;nbsp;/y
	
	goto&amp;nbsp;:EOF

	
:start_sqlyog

	REM&amp;nbsp;启动应用程序并退出脚本
	start&amp;nbsp;&amp;quot;&amp;quot;&amp;nbsp;&amp;quot;%sqlyog_app%&amp;quot;
	
	goto&amp;nbsp;:EOF	&lt;/pre&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;解释说明：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;1）理论上脚本放在任何位置都行，但建议放到SQLyog安装目录下；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;2）脚本有两处需要修改的地方：&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;SQLyog安装路径set sqlyog_dir=E:\Program Files\SQLyog Trial，修改为你自己的；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;注册表keyset sqlyog_reg_key=HKEY_CURRENT_USER\SOFTWARE\{d58cb4b1-47f3-45cb-a209-f298d0c3f756}，如果跟我的不一样，修改为你自己的；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;3）脚本首次运行，会在当前用户桌面创建一个快捷方式，该快捷方式是链接到该脚本的，只是快捷方式的icon使用了SQLyog的icon。另外，如果你需要在【开始-菜单】也创建快捷方式，你需要以管理员的身份运行该脚本，否则可能创建不成功；&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;4）快捷方式创建完成后，每次打开快捷方式，都会先去删除SQLyog的注册表项，然后再启动SQLyog程序，所以每次打开SQLyog程序，都是14天的试用期。&lt;/span&gt;&lt;/p&gt;&lt;h2&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;三、最后&lt;/span&gt;&lt;/h2&gt;&lt;p&gt;&lt;span style=&quot;text-wrap-mode: nowrap;&quot;&gt;其实也可以仅写一个删除注册表的脚本，然后配置到【任务计划程序】中，定期执行删除任务&lt;/span&gt;&lt;/p&gt;&lt;pre class=&quot;prism-highlight prism-language-bash&quot;&gt;@echo&amp;nbsp;off

REM&amp;nbsp;SQLyog注册表key，可能跟你的不一样，如果不一样，请替换为你的
set&amp;nbsp;sqlyog_reg_key=HKEY_CURRENT_USER\SOFTWARE\{d58cb4b1-47f3-45cb-a209-f298d0c3f756}

REM&amp;nbsp;判断注册表是否存在，如果存在删除注册表项
reg&amp;nbsp;query&amp;nbsp;%sqlyog_reg_key%
if&amp;nbsp;%errorlevel%==0&amp;nbsp;(
&amp;nbsp;&amp;nbsp;reg&amp;nbsp;delete&amp;nbsp;%sqlyog_reg_key%&amp;nbsp;/f
)&lt;/pre&gt;&lt;p&gt;&lt;br/&gt;&lt;/p&gt;</description><pubDate>Mon, 04 Nov 2024 13:44:10 +0800</pubDate></item></channel></rss>