|
@@ -1,248 +0,0 @@
|
|
|
-<!DOCTYPE html>
|
|
|
|
|
-<html>
|
|
|
|
|
- <head>
|
|
|
|
|
- <meta charset="utf-8" />
|
|
|
|
|
- <meta
|
|
|
|
|
- name="viewport"
|
|
|
|
|
- content="width=device-width,viewport-fit=cover, initial-scale=1.0"
|
|
|
|
|
- />
|
|
|
|
|
- <meta name="renderer" content="webkit" />
|
|
|
|
|
- <meta http-equiv="X-UA-Compatible" content="edge" />
|
|
|
|
|
- <meta http-equiv="Expires" content="0" />
|
|
|
|
|
- <meta http-equiv="Pragma" content="no-cache" />
|
|
|
|
|
- <meta
|
|
|
|
|
- http-equiv="Cache-control"
|
|
|
|
|
- content="no-cache, no-store, must-revalidate"
|
|
|
|
|
- />
|
|
|
|
|
- <meta http-equiv="Cache" content="no-cache" />
|
|
|
|
|
- <link rel="apple-touch-icon" href="https://showdoc-server.cdn.dfyun.com.cn/logo/w_64.png" />
|
|
|
|
|
- <link rel="apple-touch-icon-precomposed" href="https://showdoc-server.cdn.dfyun.com.cn/logo/w_64.png" />
|
|
|
|
|
- <link rel="icon" href="https://showdoc-server.cdn.dfyun.com.cn/favicon.ico" />
|
|
|
|
|
- <title>ShowDoc</title>
|
|
|
|
|
- <meta name="keywords" content="在线API文档 技术文档 数据字典 在线手册" />
|
|
|
|
|
- <meta
|
|
|
|
|
- name="description"
|
|
|
|
|
- content="一个非常适合IT团队的在线API文档、技术文档工具。你可以使用Showdoc来编写在线API文档、技术文档、数据字典、在线手册"
|
|
|
|
|
- />
|
|
|
|
|
- <script src="https://showdoc-server.cdn.dfyun.com.cn/server-cdn-status.js?v=3"></script>
|
|
|
|
|
- <script src="https://showdoc.cdn.dfyun.com.cn/cdn-status.js?v=2"></script>
|
|
|
|
|
- <script type="text/javascript">
|
|
|
|
|
- // ========================================
|
|
|
|
|
- // 环境检测(优先执行)
|
|
|
|
|
- // ========================================
|
|
|
|
|
- var host = window.location.host
|
|
|
|
|
- var port = window.location.port
|
|
|
|
|
-
|
|
|
|
|
- // 开发环境:Vite dev server(端口 8081)
|
|
|
|
|
- var isDevEnv = (host.indexOf('localhost') > -1 || host.indexOf('127.0.0.1') > -1) && port === '8081'
|
|
|
|
|
-
|
|
|
|
|
- // 测试环境:构建后的代码 + 测试域名(不使用 CDN)
|
|
|
|
|
- var isTestEnv = !isDevEnv && (
|
|
|
|
|
- host.indexOf('wu.com') > -1 ||
|
|
|
|
|
- host.indexOf('gaoyixia.com') > -1 ||
|
|
|
|
|
- host.indexOf('test.showdoc') > -1 ||
|
|
|
|
|
- host.indexOf('local.showdoc') > -1 ||
|
|
|
|
|
- host.indexOf('sd.gaoyixia.com') > -1 ||
|
|
|
|
|
- host.indexOf('127.0.0.1') > -1 ||
|
|
|
|
|
- host.indexOf('192.168.') > -1 ||
|
|
|
|
|
- host.indexOf('localhost') > -1
|
|
|
|
|
- )
|
|
|
|
|
-
|
|
|
|
|
- // ========================================
|
|
|
|
|
- // 全局配置
|
|
|
|
|
- // ========================================
|
|
|
|
|
- if (isDevEnv) {
|
|
|
|
|
- // 开发环境
|
|
|
|
|
- window.DocConfig = {
|
|
|
|
|
- server: '/server/index.php?s=',
|
|
|
|
|
- originalServer: '/server/index.php?s=',
|
|
|
|
|
- lang: 'zh-cn',
|
|
|
|
|
- staticPath: '/'
|
|
|
|
|
- }
|
|
|
|
|
- } else if (isTestEnv) {
|
|
|
|
|
- // 测试环境:使用本地资源(根目录)
|
|
|
|
|
- window.DocConfig = {
|
|
|
|
|
- server: '/server/index.php?s=',
|
|
|
|
|
- originalServer: '/server/index.php?s=',
|
|
|
|
|
- lang: 'zh-cn',
|
|
|
|
|
- staticPath: '/'
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- // 生产环境(默认使用 CDN)
|
|
|
|
|
- window.DocConfig = {
|
|
|
|
|
- server: 'https://showdoc-server.cdn.dfyun.com.cn/server/index.php?s=',
|
|
|
|
|
- originalServer: '/server/index.php?s=',
|
|
|
|
|
- lang: 'zh-cn',
|
|
|
|
|
- staticPath: 'https://showdoc.cdn.dfyun.com.cn/'
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 生产环境 CDN 容灾
|
|
|
|
|
- // Server CDN 容灾
|
|
|
|
|
- if (typeof window.SHOWDOC_SERVER_CDN_STASTUS == 'undefined') {
|
|
|
|
|
- window.DocConfig.server = '/server/index.php?s='
|
|
|
|
|
- }
|
|
|
|
|
- // 静态资源 CDN 容灾
|
|
|
|
|
- if (typeof window.SHOWDOC_CDN_STASTUS == 'undefined') {
|
|
|
|
|
- window.DocConfig.staticPath = '/'
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- </script>
|
|
|
|
|
- <script type="module" crossorigin src="https://showdoc.cdn.dfyun.com.cn/assets/index-bf750cc3.js"></script>
|
|
|
|
|
- <link rel="modulepreload" crossorigin href="https://showdoc.cdn.dfyun.com.cn/assets/vendor-775275a9.js">
|
|
|
|
|
- <link rel="modulepreload" crossorigin href="https://showdoc.cdn.dfyun.com.cn/assets/vendor-vue-dc600416.js">
|
|
|
|
|
- <link rel="modulepreload" crossorigin href="https://showdoc.cdn.dfyun.com.cn/assets/components-79c21c71.js">
|
|
|
|
|
- <link rel="modulepreload" crossorigin href="https://showdoc.cdn.dfyun.com.cn/assets/core-9aca1148.js">
|
|
|
|
|
- <link rel="modulepreload" crossorigin href="https://showdoc.cdn.dfyun.com.cn/assets/assets-7d25f5ec.js">
|
|
|
|
|
- <link rel="stylesheet" href="https://showdoc.cdn.dfyun.com.cn/assets/vendor-49dc2278.css">
|
|
|
|
|
- <link rel="stylesheet" href="https://showdoc.cdn.dfyun.com.cn/assets/vendor-vue-e0182f4b.css">
|
|
|
|
|
- <link rel="stylesheet" href="https://showdoc.cdn.dfyun.com.cn/assets/components-2a251b15.css">
|
|
|
|
|
- <link rel="stylesheet" href="https://showdoc.cdn.dfyun.com.cn/assets/assets-c462eb69.css">
|
|
|
|
|
- <link rel="stylesheet" href="https://showdoc.cdn.dfyun.com.cn/assets/index-726c1082.css">
|
|
|
|
|
- </head>
|
|
|
|
|
-
|
|
|
|
|
- <body class="grey-bg">
|
|
|
|
|
- <div class="index-item-block">
|
|
|
|
|
- <div>INDEX_HTML</div>
|
|
|
|
|
- <div>ITEM_HTML</div>
|
|
|
|
|
- </div>
|
|
|
|
|
- <div id="app"></div>
|
|
|
|
|
-
|
|
|
|
|
- <!-- CDN 容灾脚本 -->
|
|
|
|
|
- <script>
|
|
|
|
|
- // CDN 容灾:如果 CDN 不可用,替换所有资源为本地路径
|
|
|
|
|
- if (typeof window.SHOWDOC_CDN_STASTUS == 'undefined') {
|
|
|
|
|
- // 把全局变量中的静态资源路径改为本地
|
|
|
|
|
- window.DocConfig.staticPath = '/'
|
|
|
|
|
- changeCDNToRoot()
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- changeCDNToRoot()
|
|
|
|
|
- }, 500)
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 修改资源路径从 CDN 到本地,并重新加载
|
|
|
|
|
- function changeCDNToRoot() {
|
|
|
|
|
- const loadScript = src => {
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- const scriptTag = document.createElement('script')
|
|
|
|
|
- scriptTag.src = src
|
|
|
|
|
- scriptTag.type = 'module'
|
|
|
|
|
- scriptTag.crossOrigin = 'anonymous'
|
|
|
|
|
- scriptTag.onload = resolve
|
|
|
|
|
- scriptTag.onerror = reject
|
|
|
|
|
- document.head.appendChild(scriptTag)
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const loadStylesheet = href => {
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- const linkTag = document.createElement('link')
|
|
|
|
|
- linkTag.href = href
|
|
|
|
|
- linkTag.rel = 'stylesheet'
|
|
|
|
|
- linkTag.onload = resolve
|
|
|
|
|
- linkTag.onerror = reject
|
|
|
|
|
- document.head.appendChild(linkTag)
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const updateLinkTags = async () => {
|
|
|
|
|
- // 转换为数组,避免 HTMLCollection live 更新问题
|
|
|
|
|
- const links = Array.from(document.getElementsByTagName('link'))
|
|
|
|
|
-
|
|
|
|
|
- for (const linkTag of links) {
|
|
|
|
|
- const href = linkTag.getAttribute('href')
|
|
|
|
|
-
|
|
|
|
|
- if (href && href.includes('dfyun')) {
|
|
|
|
|
- const newHref = href.replace('https://showdoc.cdn.dfyun.com.cn/', '/')
|
|
|
|
|
- await loadStylesheet(newHref)
|
|
|
|
|
-
|
|
|
|
|
- // 检查 parentNode 是否存在
|
|
|
|
|
- if (linkTag.parentNode) {
|
|
|
|
|
- linkTag.parentNode.removeChild(linkTag)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const updateScriptTags = async () => {
|
|
|
|
|
- // 转换为数组,避免 HTMLCollection live 更新问题
|
|
|
|
|
- const scripts = Array.from(document.getElementsByTagName('script'))
|
|
|
|
|
-
|
|
|
|
|
- for (const scriptTag of scripts) {
|
|
|
|
|
- const src = scriptTag.getAttribute('src')
|
|
|
|
|
-
|
|
|
|
|
- if (src && src.includes('dfyun') && !src.includes('showdoc-server')) {
|
|
|
|
|
- const newSrc = src.replace('https://showdoc.cdn.dfyun.com.cn/', '/')
|
|
|
|
|
- await loadScript(newSrc)
|
|
|
|
|
-
|
|
|
|
|
- // 检查 parentNode 是否存在
|
|
|
|
|
- if (scriptTag.parentNode) {
|
|
|
|
|
- scriptTag.parentNode.removeChild(scriptTag)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- const updateImgTags = () => {
|
|
|
|
|
- const imgs = Array.from(document.getElementsByTagName('img'))
|
|
|
|
|
-
|
|
|
|
|
- for (const imgTag of imgs) {
|
|
|
|
|
- let src = imgTag.getAttribute('src')
|
|
|
|
|
-
|
|
|
|
|
- if (src && src.includes('dfyun')) {
|
|
|
|
|
- src = src.replace('https://showdoc.cdn.dfyun.com.cn/', '/')
|
|
|
|
|
- imgTag.setAttribute('src', src)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- updateLinkTags()
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- return updateScriptTags()
|
|
|
|
|
- })
|
|
|
|
|
- .then(() => {
|
|
|
|
|
- console.log('[CDN] 已切换到本地资源')
|
|
|
|
|
- updateImgTags()
|
|
|
|
|
- })
|
|
|
|
|
- .catch(error => {
|
|
|
|
|
- console.error('[CDN] 切换失败:', error)
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- </script>
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- <!-- 防止被镜像站 -->
|
|
|
|
|
- <script language="JavaScript">
|
|
|
|
|
- var host = window.location.host
|
|
|
|
|
- if (
|
|
|
|
|
- host.indexOf('localhost') === -1 &&
|
|
|
|
|
- host.indexOf('wu') === -1 &&
|
|
|
|
|
- host.indexOf('showdoc') === -1 &&
|
|
|
|
|
- host.indexOf('star7th.com') === -1 &&
|
|
|
|
|
- host.indexOf('192.168.') === -1 &&
|
|
|
|
|
- host.indexOf('gaoyixia.com') === -1 &&
|
|
|
|
|
- host.indexOf('dongjingyu.cn') === -1 &&
|
|
|
|
|
- host.indexOf('127.0.0.1') === -1
|
|
|
|
|
- ) {
|
|
|
|
|
- var href = window.location.href
|
|
|
|
|
- var j = href.replace(new RegExp(host, 'g'), 'www.showdoc.com.cn')
|
|
|
|
|
- window.location.href = j
|
|
|
|
|
- }
|
|
|
|
|
- </script>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 百度统计 -->
|
|
|
|
|
- <script>
|
|
|
|
|
- if (window.location.host == 'www.showdoc.com.cn') {
|
|
|
|
|
- var _hmt = _hmt || []
|
|
|
|
|
- ;(function() {
|
|
|
|
|
- var hm = document.createElement('script')
|
|
|
|
|
- hm.src = 'https://hm.baidu.com/hm.js?84e82fa31c8ca8671f6b6f972b7e54fb'
|
|
|
|
|
- var s = document.getElementsByTagName('script')[0]
|
|
|
|
|
- s.parentNode.insertBefore(hm, s)
|
|
|
|
|
- })()
|
|
|
|
|
- }
|
|
|
|
|
- </script>
|
|
|
|
|
-
|
|
|
|
|
- <!-- 主应用入口 -->
|
|
|
|
|
-
|
|
|
|
|
- </body>
|
|
|
|
|
-</html>
|
|
|