docs: update cdn link (#698)

Signed-off-by: Carson Yang <yangchuansheng33@gmail.com>
This commit is contained in:
Carson Yang
2024-01-05 22:31:17 +08:00
committed by GitHub
parent 8d17f96600
commit 9329ddeac5
11 changed files with 89 additions and 10 deletions

4
.github/sync_imgs.yml vendored Normal file
View File

@@ -0,0 +1,4 @@
yangchuansheng/fastgpt-imgs:
- source: docSite/assets/imgs/
dest: imgs/
deleteOrphaned: true

View File

@@ -45,6 +45,10 @@ jobs:
- 'docSite/content/docs/**' - 'docSite/content/docs/**'
base: main base: main
- name: Add cdn for images
run: |
sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.us/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/docs)
# Step 3 - Install Hugo (specific version) # Step 3 - Install Hugo (specific version)
- name: Install Hugo - name: Install Hugo
uses: peaceiris/actions-hugo@v2 uses: peaceiris/actions-hugo@v2

View File

@@ -45,6 +45,10 @@ jobs:
- 'docSite/content/docs/**' - 'docSite/content/docs/**'
base: main base: main
- name: Add cdn for images
run: |
sed -i "s#\](/imgs/#\](https://cdn.jsdelivr.us/gh/yangchuansheng/fastgpt-imgs@main/imgs/#g" $(grep -rl "\](/imgs/" docSite/content/docs)
# Step 3 - Install Hugo (specific version) # Step 3 - Install Hugo (specific version)
- name: Install Hugo - name: Install Hugo
uses: peaceiris/actions-hugo@v2 uses: peaceiris/actions-hugo@v2

35
.github/workflows/sync_imgs.yml vendored Normal file
View File

@@ -0,0 +1,35 @@
name: Sync images
on:
pull_request_target:
branches:
- main
paths:
- docSite/assets/imgs/**
push:
branches:
- main
paths:
- docSite/assets/imgs/**
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
if: ${{ (github.event_name == 'pull_request_target') }}
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Checkout
uses: actions/checkout@v3
- name: Run GitHub File Sync
uses: BetaHuhn/repo-file-sync-action@v1.21.0
with:
GH_PAT: ${{ secrets.IMG_GH_PAT }}
CONFIG_PATH: .github/sync_imgs.yml
ORIGINAL_MESSAGE: true
SKIP_PR: true
COMMIT_EACH_FILE: false

View File

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 148 KiB

View File

@@ -93,4 +93,4 @@ FastGPT 商业版软件根据不同的部署方式,分为 3 类收费模式。
Sealos 云服务属于按量计费,下面是它的价格表: Sealos 云服务属于按量计费,下面是它的价格表:
![](/imgs/sealos_price.png) ![](/imgs/sealos_price.jpg)

View File

@@ -25,13 +25,13 @@ curl https://doc.fastgpt.in/docs/intro/
### 1. 新建知识库,选择 Web 站点同步 ### 1. 新建知识库,选择 Web 站点同步
![](/imgs/webSync2.jpg) ![](/imgs/webSync2.png)
![](/imgs/webSync3.jpg) ![](/imgs/webSync3.png)
### 2. 点击配置站点信息 ### 2. 点击配置站点信息
![](/imgs/webSync4.jpg) ![](/imgs/webSync4.png)
### 3. 填写网址和选择器 ### 3. 填写网址和选择器

View File

@@ -0,0 +1,32 @@
{{ $dest := .Destination }}
{{ $text := .PlainText }}
{{ $url := urls.Parse $dest }}
{{ if .Title }}
<figure>
{{ if eq $url.Scheme "" }}
{{ with $image := resources.Get $dest }}
{{ if eq $image.MediaType.SubType "svg" }}
{{ $image.Content | safeHTML }}
{{ else }}
<img src="{{ $image.RelPermalink | safeURL }}" alt="{{ $text }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy">
{{ end }}
{{ end }}
{{ else }}
<img src="{{ $dest | safeURL }}" alt="{{ $text }}" loading="lazy">
{{ end }}
<figcaption>{{ .Title | markdownify }}</figcaption>
</figure>
{{ else }}
{{ if eq $url.Scheme "" }}
{{ with $image := resources.Get $dest }}
{{ if eq $image.MediaType.SubType "svg" }}
{{ $image.Content | safeHTML }}
{{ else }}
<img src="{{ $image.RelPermalink | safeURL }}" alt="{{ $text }}" width="{{ $image.Width }}" height="{{ $image.Height }}" loading="lazy">
{{ end }}
{{ end }}
{{ else }}
<img src="{{ $dest | safeURL }}" alt="{{ $text }}" loading="lazy">
{{ end }}
{{ end }}

View File

@@ -58,7 +58,7 @@
<!-- change --> <!-- change -->
<script <script
src="https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js" src="https://cdn.jsdelivr.us/npm/medium-zoom/dist/medium-zoom.min.js"
crossorigin="anonymous" crossorigin="anonymous"
referrerpolicy="no-referrer" referrerpolicy="no-referrer"
></script> ></script>

View File

@@ -106,5 +106,5 @@
{{- end -}} {{- end -}}
<!-- change --> <!-- change -->
<script defer type="text/javascript" src="{{ "js/jsdelivr-auto-fallback.js" | absURL }}"></script> <script defer type="text/javascript" src="{{ "js/jsdelivr-auto-fallback.js" | absURL }}"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/lxgw-wenkai-screen-webfont@1.1.0/style.css" /> <link rel="stylesheet" href="https://cdn.jsdelivr.us/npm/lxgw-wenkai-screen-webfont@1.1.0/style.css" />
</head> </head>

View File

@@ -4,17 +4,17 @@
let failed; let failed;
let isRunning; let isRunning;
const DEST_LIST = [ const DEST_LIST = [
'cdn.jsdelivr.net',
'jsd.cdn.zzko.cn',
'cdn.jsdelivr.us', 'cdn.jsdelivr.us',
'jsd.cdn.zzko.cn',
'jsd.onmicrosoft.cn', 'jsd.onmicrosoft.cn',
'fastly.jsdelivr.net', 'fastly.jsdelivr.net',
'gcore.jsdelivr.net' 'gcore.jsdelivr.net',
'cdn.jsdelivr.net',
]; ];
const PREFIX = '//'; const PREFIX = '//';
const SOURCE = DEST_LIST[0]; const SOURCE = DEST_LIST[0];
const starTime = Date.now(); const starTime = Date.now();
const TIMEOUT = 2000; const TIMEOUT = 1000;
const STORE_KEY = 'jsdelivr-auto-fallback'; const STORE_KEY = 'jsdelivr-auto-fallback';
const TEST_PATH = '/gh/PipecraftNet/jsdelivr-auto-fallback@main/empty.css?'; const TEST_PATH = '/gh/PipecraftNet/jsdelivr-auto-fallback@main/empty.css?';
const shouldReplace = (text) => text && text.includes(PREFIX + SOURCE); const shouldReplace = (text) => text && text.includes(PREFIX + SOURCE);