forked from Gitlink/gitlink_help_center
Compare commits
9 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
211f20eef4 | |
|
|
a074a9c25c | |
|
|
a094f464ec | |
|
|
3422b32669 | |
|
|
b74b92f66e | |
|
|
96231da6fe | |
|
|
8b39d43460 | |
|
|
75ce405ca7 | |
|
|
4f085a23e2 |
|
|
@ -84,7 +84,8 @@
|
||||||

|

|
||||||
|
|
||||||
```
|
```
|
||||||
|
初始化项目
|
||||||
|
node v20.x npm install --force
|
||||||
## 前端build成中文 (i18n中可编辑对应中文内容)
|
## 前端build成中文 (i18n中可编辑对应中文内容)
|
||||||
```
|
```
|
||||||
npm run build -- --locale zh-CN
|
npm run build -- --locale zh-CN
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
const lightCodeTheme = require('prism-react-renderer/themes/github');
|
||||||
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
const darkCodeTheme = require('prism-react-renderer/themes/dracula');
|
||||||
|
//Docusaurus v3写法
|
||||||
|
// const { themes } = require('prism-react-renderer');
|
||||||
|
// import { themes } from 'prism-react-renderer';
|
||||||
import("@easyops-cn/docusaurus-search-local").PluginOptions;
|
import("@easyops-cn/docusaurus-search-local").PluginOptions;
|
||||||
|
|
||||||
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
/** @type {import('@docusaurus/types').DocusaurusConfig} */
|
||||||
|
|
@ -8,15 +11,14 @@ module.exports = {
|
||||||
tagline:'gitlink帮助中心',
|
tagline:'gitlink帮助中心',
|
||||||
url: 'https://help.gitlink.org.cn/',
|
url: 'https://help.gitlink.org.cn/',
|
||||||
baseUrl: '/',
|
baseUrl: '/',
|
||||||
onBrokenLinks: 'ignore',
|
onBrokenLinks: 'warn',
|
||||||
onBrokenMarkdownLinks: 'ignore',
|
onBrokenMarkdownLinks: 'warn',
|
||||||
favicon: 'img/icon.ico',
|
favicon: 'img/icon.ico',
|
||||||
organizationName: 'luffyZh', // Usually your GitHub org/user name.
|
organizationName: 'luffyZh', // Usually your GitHub org/user name.
|
||||||
projectName: 'docusaurus-luffyzh-website', // Usually your repo name.
|
projectName: 'docusaurus-luffyzh-website', // Usually your repo name.
|
||||||
scripts: [],
|
scripts: [],
|
||||||
// stylesheets: ['styles/dark-mode.css'],
|
// stylesheets: ['styles/dark-mode.css'],
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
|
|
||||||
docs:{
|
docs:{
|
||||||
sidebar:{
|
sidebar:{
|
||||||
hideable:true,
|
hideable:true,
|
||||||
|
|
@ -29,7 +31,7 @@ module.exports = {
|
||||||
{property:"og:image:alt",content:"GitLink(确实开源)是中国计算机学会CCF官方指定的开源创新服务平台 - Gitlink/forgeplus:GitLink(确实开源)是中国计算机学会CCF官方指定的开源创新服务平台 for gitlink Gitlink/forgeplus for git"}
|
{property:"og:image:alt",content:"GitLink(确实开源)是中国计算机学会CCF官方指定的开源创新服务平台 - Gitlink/forgeplus:GitLink(确实开源)是中国计算机学会CCF官方指定的开源创新服务平台 for gitlink Gitlink/forgeplus for git"}
|
||||||
],
|
],
|
||||||
prism: {
|
prism: {
|
||||||
theme: lightCodeTheme,
|
theme:lightCodeTheme,
|
||||||
darkTheme: darkCodeTheme,
|
darkTheme: darkCodeTheme,
|
||||||
},
|
},
|
||||||
zoom: {
|
zoom: {
|
||||||
|
|
@ -71,6 +73,26 @@ module.exports = {
|
||||||
dropdownActiveClassDisabled: true
|
dropdownActiveClassDisabled: true
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
|
// type: 'localeDropdown',
|
||||||
|
// position: 'right',
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// position: 'right',
|
||||||
|
// component:'./src/components/LanguageSwitcher',
|
||||||
|
// label:"language",
|
||||||
|
// to:"#"
|
||||||
|
// items: [
|
||||||
|
// {
|
||||||
|
// label: 'English',
|
||||||
|
// onClick: () => handleLocaleChange('en')
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// label: '简体中文',
|
||||||
|
// onClick: () => handleLocaleChange('zh-Hans')
|
||||||
|
// }
|
||||||
|
// ]
|
||||||
|
// }
|
||||||
|
// {
|
||||||
// href: 'https://github.com/boxyhq',
|
// href: 'https://github.com/boxyhq',
|
||||||
// position: 'right',
|
// position: 'right',
|
||||||
// className: 'header-github-link',
|
// className: 'header-github-link',
|
||||||
|
|
@ -182,6 +204,16 @@ module.exports = {
|
||||||
],
|
],
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultLocale: 'zh-cn',
|
defaultLocale: 'zh-cn',
|
||||||
locales: ['zh-cn'],
|
locales: ['zh-cn','en'],
|
||||||
|
localeConfigs: {
|
||||||
|
en: {
|
||||||
|
label: 'English',
|
||||||
|
htmlLang: 'en',
|
||||||
|
},
|
||||||
|
'zh-cn': {
|
||||||
|
label: '简体中文',
|
||||||
|
htmlLang: 'zh-CN',
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
为了构建更好的平台生态环境,我们推出了基于OAuth2的API版本。
|
||||||
|
API 接口使用方式以及Url都参照GitHub,为了各位开发者更好的兼容已经存在的第三方应用。
|
||||||
|
|
||||||
|
# API 使用条款
|
||||||
|
|
||||||
|
未经用户允许,不准爬取或存储用户的资源。
|
||||||
|
禁止滥用 API,请求频率过快将导致请求终止。
|
||||||
|
OAuth2 认证基本流程
|
||||||
|

|
||||||
|
|
||||||
|
# OAuth2 获取 AccessToken 认证步骤
|
||||||
|
|
||||||
|
### 1. 授权码模式
|
||||||
|
* 应用通过 浏览器 或 Webview 将用户引导到平台三方认证页面上( GET请求 )
|
||||||
|
|
||||||
|
`https://gitlink.org.cn/oauth/authorize?client_id={client_id}&redirect_uri={redirect_uri}&response_type=code`
|
||||||
|
|
||||||
|
* 用户对应用进行授权
|
||||||
|
注意: 如果之前已经授权过的需要跳过授权页面,需要在上面第一步的 URL 加上 scope 参数,且 scope 的值需要和用户上次授权的勾选的一致。如用户在上次授权了user_info。则步骤A 中 GET 请求应为:
|
||||||
|
|
||||||
|
`https://gitlink.org.cn/oauth/authorize?client_id={client_id}&redirect_uri={redirect_uri}&response_type=code&scope=user_info`
|
||||||
|
|
||||||
|
* 平台认证服务器通过回调地址`{redirect_uri}`将 用户授权码 传递给 应用服务器 或者直接在 Webview 中跳转到携带 用户授权码的回调地址上,Webview 直接获取code即可(`{redirect_uri}?code=abc&state=xyz`)
|
||||||
|
* 应用服务器 或 Webview 使用 access_token API 向平台认证服务器发送post请求传入 用户授权码 以及 回调地址( POST请求 )
|
||||||
|
注:请求过程建议将 client_secret 放在 Body 中传值,以保证数据安全。
|
||||||
|
|
||||||
|
`https://gitlink.org.cn/oauth/token?grant_type=authorization_code&code={code}&client_id={client_id}&redirect_uri={redirect_uri}&client_secret={client_secret}`
|
||||||
|
|
||||||
|
* 平台认证服务器返回 access_token
|
||||||
|
|
||||||
|
应用通过 access_token 访问 Open API 使用用户数据。
|
||||||
|
当 access_token 过期后(有效期为一天),你可以通过以下 refresh_token 方式重新获取 access_token( POST请求 )
|
||||||
|
|
||||||
|
`https://gitlink.org.cn/oauth/token?grant_type=refresh_token&refresh_token={refresh_token}`
|
||||||
|
|
||||||
|
> 注意:如果获取 access_token 返回 403,可能是没有设置User-Agent的原因。
|
||||||
|
详见:获取Token时服务端响应状态403是什么情况
|
||||||
|
|
||||||
|
### 2. 密码模式
|
||||||
|
* 用户向客户端提供邮箱地址和密码。客户端将邮箱地址和密码发给平台认证服务器,并向平台认证服务器请求令牌。( POST请求。Content-Type: application/x-www-form-urlencoded )
|
||||||
|
|
||||||
|
`curl -X POST --data-urlencode "grant_type=password" --data-urlencode "username={email}" --data-urlencode "password={password}" --data-urlencode "client_id={client_id}" --data-urlencode "client_secret={client_secret}" --data-urlencode "scope=user_info" https://gitlink.org.cn/oauth/token`
|
||||||
|
|
||||||
|
scope表示权限范围,有以下选项,请求时使用空格隔开
|
||||||
|
`user_info` `projects` `pull_requests` `issues` `notes` `keys` `hook groups` `gists` `enterprises`
|
||||||
|
* 认证服务器返回 access_token
|
||||||
|
应用通过 access_token 访问 Open API 使用用户数据。
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 135 KiB |
File diff suppressed because it is too large
Load Diff
19
package.json
19
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "docusaurus",
|
"name": "docusaurus",
|
||||||
"version": "0.0.0",
|
"version": "3.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"docusaurus": "docusaurus",
|
"docusaurus": "docusaurus",
|
||||||
|
|
@ -15,17 +15,20 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@cmfcmf/docusaurus-search-local": "1.1.0",
|
"@cmfcmf/docusaurus-search-local": "1.1.0",
|
||||||
"@docusaurus/core": "2.4.1",
|
"@docusaurus/core": "3.9.2",
|
||||||
"@docusaurus/plugin-client-redirects": "2.4.1",
|
"@docusaurus/plugin-client-redirects": "3.9.2",
|
||||||
"@docusaurus/preset-classic": "2.4.1",
|
"@docusaurus/preset-classic": "3.9.2",
|
||||||
"@easyops-cn/docusaurus-search-local": "^0.35.0",
|
"@easyops-cn/docusaurus-search-local": "^0.35.0",
|
||||||
"@mdx-js/react": "1.6.22",
|
"@mdx-js/react": "^3.1.1",
|
||||||
"@node-rs/jieba": "^1.7.0",
|
"@node-rs/jieba": "^1.7.0",
|
||||||
"clsx": "1.2.1",
|
"clsx": "1.2.1",
|
||||||
"docusaurus-gtm-plugin": "0.0.2",
|
"docusaurus-gtm-plugin": "0.0.2",
|
||||||
"docusaurus-plugin-image-zoom": "1.0.1",
|
"docusaurus-plugin-image-zoom": "1.0.1",
|
||||||
"react": "17.0.2",
|
"or": "^0.2.0",
|
||||||
"react-dom": "17.0.2",
|
"prism-react-renderer": "^1.3.5",
|
||||||
|
"prismjs": "^1.30.0",
|
||||||
|
"react": "18.2.0",
|
||||||
|
"react-dom": "18.2.0",
|
||||||
"react-modal": "3.16.1"
|
"react-modal": "3.16.1"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
|
|
@ -41,6 +44,6 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.18.1 <=18.x"
|
"node": ">=18.x"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
// src/components/LanguageSwitcher.js
|
||||||
|
import React from 'react';
|
||||||
|
import { useDocusaurusContext } from '@docusaurus/useDocusaurusContext';
|
||||||
|
|
||||||
|
export default function LanguageSwitcher() {
|
||||||
|
const { i18n } = useDocusaurusContext();
|
||||||
|
|
||||||
|
const locales = [
|
||||||
|
{ code: 'en', label: 'English' },
|
||||||
|
{ code: 'zh-Hans', label: '简体中文' }
|
||||||
|
];
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div style={{ marginRight: '1rem' }}>
|
||||||
|
<select
|
||||||
|
value={i18n.currentLocale}
|
||||||
|
onChange={(e) => {
|
||||||
|
localStorage.setItem('preferredLocale', e.target.value);
|
||||||
|
window.location.href = `/${e.target.value}/`;
|
||||||
|
}}
|
||||||
|
style={{
|
||||||
|
padding: '0.5rem 1rem',
|
||||||
|
border: '1px solid #ddd',
|
||||||
|
borderRadius: '4px',
|
||||||
|
backgroundColor: 'white',
|
||||||
|
fontSize: '0.9rem',
|
||||||
|
cursor: 'pointer',
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{locales.map((locale) => (
|
||||||
|
<option key={locale.code} value={locale.code}>
|
||||||
|
{locale.label}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -57,7 +57,6 @@ html[data-theme='dark'] .docusaurus-highlight-code-line {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: space-around;
|
|
||||||
}
|
}
|
||||||
.footer__bottom .margin-bottom--sm{
|
.footer__bottom .margin-bottom--sm{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,26 @@ GitLink(确实开源)是CCF官方指定的开源创新服务平台,旨在
|
||||||
<h2 class="text--truncate cardTitle" title="第三方服务">第三方服务</h2>
|
<h2 class="text--truncate cardTitle" title="第三方服务">第三方服务</h2>
|
||||||
<p>第三方服务使用及设置[3个文档]</p>
|
<p>第三方服务使用及设置[3个文档]</p>
|
||||||
</a></article>
|
</a></article>
|
||||||
|
<article class="col col--6 margin-bottom--lg">
|
||||||
|
<a class="card padding--lg cardContainer" href="/通知/通知简介">
|
||||||
|
<h2 class="text--truncate cardTitle" title="通知">通知</h2>
|
||||||
|
<p>通知使用及设置[2个文档]</p>
|
||||||
|
</a></article>
|
||||||
|
<article class="col col--6 margin-bottom--lg">
|
||||||
|
<a class="card padding--lg cardContainer" href="/个人主页建站/站点创建流程">
|
||||||
|
<h2 class="text--truncate cardTitle" title="个人主页建站">个人主页建站</h2>
|
||||||
|
<p>个人主页建站使用及设置[2个文档]</p>
|
||||||
|
</a></article>
|
||||||
|
<article class="col col--6 margin-bottom--lg">
|
||||||
|
<a class="card padding--lg cardContainer" href="/平台公告/">
|
||||||
|
<h2 class="text--truncate cardTitle" title="平台公告">平台公告</h2>
|
||||||
|
<p>平台公告使用及设置</p>
|
||||||
|
</a></article>
|
||||||
|
<article class="col col--6 margin-bottom--lg">
|
||||||
|
<a class="card padding--lg cardContainer" href="/服务协议/GitLink服务协议">
|
||||||
|
<h2 class="text--truncate cardTitle" title="服务协议">服务协议</h2>
|
||||||
|
<p>服务协议使用及设置[1个文档]</p>
|
||||||
|
</a></article>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
Loading…
Reference in New Issue