Skip to content

Commit

Permalink
feat: 全面支持Github和Gitlab各平台
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Sep 8, 2023
1 parent ce2ef7b commit b5e7413
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 29 deletions.
30 changes: 20 additions & 10 deletions src/platforms/dynamicConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,19 @@ export enum SubPlatformType {

// Github 子平台
Github_Hexo = "Hexo",
// Github_Hugo = "Hugo",
// Github_Jekyll = "Jekyll",
// Github_Vuepress = "Vuepress",
// Github_Vuepress = "Vuepress2",
// Github_Vitepress = "Vitepress",
Github_Hugo = "Hugo",
Github_Jekyll = "Jekyll",
Github_Vuepress = "Vuepress",
Github_Vuepress2 = "Vuepress2",
Github_Vitepress = "Vitepress",

// Gitlab 子平台
Gitlab_Hexo = "Gitlabhexo",
Gitlab_Hugo = "Gitlabhugo",
Gitlab_Jekyll = "Gitlabjekyll",
Gitlab_Vuepress = "Gitlabvuepress",
Gitlab_Vuepress2 = "Gitlabvuepress2",
Gitlab_Vitepress = "Gitlabvitepress",

// Metaweblog
Metaweblog_Metaweblog = "Metaweblog",
Expand Down Expand Up @@ -230,14 +235,19 @@ export function getSubtypeList(ptype: PlatformType): SubPlatformType[] {
break
case PlatformType.Github:
subtypeList.push(SubPlatformType.Github_Hexo)
// subtypeList.push(SubPlatformType.Github_Hugo)
// subtypeList.push(SubPlatformType.Github_Jekyll)
// subtypeList.push(SubPlatformType.Github_Vuepress)
// subtypeList.push(SubPlatformType.Github_Vuepress2)
// subtypeList.push(SubPlatformType.Github_Vitepress)
subtypeList.push(SubPlatformType.Github_Hugo)
subtypeList.push(SubPlatformType.Github_Jekyll)
subtypeList.push(SubPlatformType.Github_Vuepress)
subtypeList.push(SubPlatformType.Github_Vuepress2)
subtypeList.push(SubPlatformType.Github_Vitepress)
break
case PlatformType.Gitlab:
subtypeList.push(SubPlatformType.Gitlab_Hexo)
subtypeList.push(SubPlatformType.Gitlab_Hugo)
subtypeList.push(SubPlatformType.Gitlab_Jekyll)
subtypeList.push(SubPlatformType.Gitlab_Vuepress)
subtypeList.push(SubPlatformType.Gitlab_Vuepress2)
subtypeList.push(SubPlatformType.Gitlab_Vitepress)
break
case PlatformType.Metaweblog:
subtypeList.push(SubPlatformType.Metaweblog_Metaweblog)
Expand Down
110 changes: 91 additions & 19 deletions src/utils/import/pre.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,35 +79,107 @@ export const pre = {
authMode: AuthMode.API,
isEnabled: false,
},
// {
// platformType: PlatformType.Github,
// subPlatformType: SubPlatformType.Github_Hugo,
// platformKey: "github_Hugo",
// platformName: "Hugo",
// platformIcon: svgIcons.iconIFHugo,
// authMode: AuthMode.API,
// isEnabled: false
// },
// {
// platformType: PlatformType.Github,
// subPlatformType: SubPlatformType.Github_Vitepress,
// platformKey: "github_Vitepress",
// platformName: "Vitepress",
// platformIcon: svgIcons.iconIFVue,
// authMode: AuthMode.API,
// isEnabled: false
// },
{
platformType: PlatformType.Github,
subPlatformType: SubPlatformType.Github_Hugo,
platformKey: "github_Hugo",
platformName: "Hugo",
platformIcon: svgIcons.iconIFHugo,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Github,
subPlatformType: SubPlatformType.Github_Jekyll,
platformKey: "github_Jekyll",
platformName: "Jekyll",
platformIcon: svgIcons.iconIFJekyll,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Github,
subPlatformType: SubPlatformType.Github_Vuepress,
platformKey: "github_Vuepress",
platformName: "Vuepress",
platformIcon: svgIcons.iconIFVuepress,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Github,
subPlatformType: SubPlatformType.Github_Vuepress2,
platformKey: "github_Vuepress2",
platformName: "Vuepress2",
platformIcon: svgIcons.iconIFVuepress2,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Github,
subPlatformType: SubPlatformType.Github_Vitepress,
platformKey: "github_Vitepress",
platformName: "Vitepress",
platformIcon: svgIcons.iconIFVue,
authMode: AuthMode.API,
isEnabled: false
},
],
gitlabCfg: <DynamicConfig[]>[
{
platformType: PlatformType.Gitlab,
subPlatformType: SubPlatformType.Gitlab_Hexo,
platformKey: "gitlab_Gitlabhexo",
platformName: "Gitlabhexo",
platformIcon: svgIcons.iconIFHexoGitlab,
platformIcon: svgIcons.iconIFHexo,
authMode: AuthMode.API,
isEnabled: false,
},
{
platformType: PlatformType.Gitlab,
subPlatformType: SubPlatformType.Gitlab_Hugo,
platformKey: "gitlab_Gitlabhugo",
platformName: "Gitlabhugo",
platformIcon: svgIcons.iconIFHugo,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Gitlab,
subPlatformType: SubPlatformType.Gitlab_Jekyll,
platformKey: "gitlab_Gitlabjekyll",
platformName: "Gitlabjekyll",
platformIcon: svgIcons.iconIFJekyll,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Gitlab,
subPlatformType: SubPlatformType.Gitlab_Vuepress,
platformKey: "gitlab_Gitlabvuepress",
platformName: "Gitlabvuepress",
platformIcon: svgIcons.iconIFVuepress,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Gitlab,
subPlatformType: SubPlatformType.Gitlab_Vuepress2,
platformKey: "gitlab_Gitlabvuepress2",
platformName: "Gitlabvuepress2",
platformIcon: svgIcons.iconIFVuepress2,
authMode: AuthMode.API,
isEnabled: false
},
{
platformType: PlatformType.Gitlab,
subPlatformType: SubPlatformType.Gitlab_Vitepress,
platformKey: "gitlab_Gitlabvitepress",
platformName: "Gitlabvitepress",
platformIcon: svgIcons.iconIFVue,
authMode: AuthMode.API,
isEnabled: false
},
],
metaweblogCfg: <DynamicConfig[]>[
{
Expand Down
4 changes: 4 additions & 0 deletions src/utils/svgIcons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export const svgIcons = {
iconIFHexo: `<svg t="1684170255787" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7119" width="16" height="16"><path d="M512 0.298667L66.986667 258.389333V770.133333L512 1023.786667l445.013333-258.090667V253.952L512 0.298667z m204.714667 729.813333l-40.064 22.229333-40.064-22.229333V552.106667H387.413333v178.005333l-40.106666 22.229333-40.021334-22.229333V293.973333l40.064-22.229333 40.064 22.229333v178.005334h249.173334V293.973333l40.106666-22.229333 40.021334 22.229333v436.138667z" p-id="7120"></path></svg>`,
iconIFHexoGitlab: `<svg t="1693214758547" class="icon" viewBox="0 0 1137 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="12137" width="16" height="16"><path d="M896.227556 577.991111c-21.048889 0-38.115556 16.952889-38.115556 38.058667v280.007111c0 28.103111-22.755556 50.801778-50.858667 50.801778H728.177778v-131.242667a127.317333 127.317333 0 0 0-127.146667-127.032889H538.168889a127.317333 127.317333 0 0 0-127.089778 127.032889v131.128889H331.776a50.801778 50.801778 0 0 1-50.801778-50.801778v-279.893333a38.115556 38.115556 0 1 0-76.288 0v280.007111a127.317333 127.317333 0 0 0 127.089778 127.032889h155.363556v-207.473778c0-28.046222 22.755556-50.801778 50.858666-50.801778h62.919111c28.103111 0 50.858667 22.755556 50.858667 50.801778v207.36h155.477333a127.317333 127.317333 0 0 0 127.146667-127.032889v-279.893333c0-21.048889-17.066667-38.115556-38.115556-38.115556z" p-id="12138"></path><path d="M1073.208889 413.411556a38.115556 38.115556 0 0 0-22.755556 72.817777 15.36 15.36 0 0 1 2.503111 28.16 15.530667 15.530667 0 0 1-21.845333-9.272889 41.528889 41.528889 0 0 0-4.039111-8.988444l-172.259556-398.677333-0.170666-0.398223a15.473778 15.473778 0 0 1 0.682666-11.662222 15.530667 15.530667 0 0 1 8.760889-7.907555 15.530667 15.530667 0 0 1 11.662223 0.625777 15.36 15.36 0 0 1 5.688888 22.983112 38.115556 38.115556 0 0 0 61.212445 45.511111 91.022222 91.022222 0 0 0 12.856889-84.878223 90.624 90.624 0 0 0-46.819556-52.224A91.192889 91.192889 0 0 0 838.656 5.688889a90.680889 90.680889 0 0 0-52.280889 46.762667 92.728889 92.728889 0 0 0-8.590222 30.890666H359.765333A91.932444 91.932444 0 0 0 298.894222 5.688889a91.192889 91.192889 0 0 0-70.087111 3.811555 91.704889 91.704889 0 0 0-33.962667 137.102223 38.115556 38.115556 0 1 0 61.212445-45.511111 15.36 15.36 0 1 1 26.794667-3.982223l-0.113778 0.341334L110.592 496.071111a44.487111 44.487111 0 0 0-4.039111 8.988445 15.303111 15.303111 0 0 1-10.24 10.296888 15.815111 15.815111 0 0 1-11.662222-1.024 15.36 15.36 0 0 1 2.56-28.216888 38.229333 38.229333 0 0 0 25.031111-47.786667 38.286222 38.286222 0 0 0-47.786667-24.974222 91.591111 91.591111 0 0 0-15.018667 168.448 90.680889 90.680889 0 0 0 69.802667 6.257777c23.893333-7.509333 43.349333-24.177778 54.442667-46.136888h790.414222a91.704889 91.704889 0 0 0 169.244444-13.824 91.818667 91.818667 0 0 0-60.131555-114.744889z m-866.474667 52.451555L339.057778 159.573333h459.434666l132.323556 306.289778H206.734222z" p-id="12139"></path></svg>`,
iconIFHugo: `<svg t="1684170339672" class="icon" viewBox="0 0 1280 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="9235" width="16" height="16"><path d="M800.20014 389.6c-21.8 5.6-39.8 8.6-58.2 15.2-14.6 3.8-29.4 7.8-46.4 12.2l-1.2 0.2c-8.4 2.4-9.2 2.6-17-6.4-9.4-10.6-16.2-17.4-29.2-23.8-39.4-19.2-77.4-13.6-112.8 9.4-42.4 27.4-64.2 68-63.6 118.4 0.6 50 34.8 91 82.4 97.8 44 5.6 79.6-9.2 107.6-41 4.2-5.2 8-10.6 12.2-16.6 1.6-2 3-4.2 4.6-6.6h-120.2c-13 0-16.2-8-11.8-18.6 8-19.4 23-51.8 31.8-68 1.8-3.6 6.2-11.6 13.8-11.6h202.2c9-26.8 23.6-53.8 43.2-79.4 45.4-59.8 98.6-91 174.4-104 63.6-11.2 123.4-5 177.8 31.8 49.2 33.6 79.6 79.2 87.8 139 10.6 84.2-13.8 152.6-73.4 211.2-39.4 41.8-89.8 68-147.8 79.8-11.2 2-22.2 3-33 4-5.8 0.4-11.4 1-17 1.6-56.6-1.2-108.4-17.4-152-54.8-30.6-26.6-51.8-59.2-62.2-97-7.4 14.6-16 28.8-28 42.2-43.2 59.2-101.8 96-175.8 105.8-61.2 8.2-117.8-3.6-167.8-41-46-35-72.2-81-79-138.4-8.2-68 11.8-130.8 52.8-182.6 44.4-58 103-94.8 174.6-107.8 58.6-12.4 114.6-3.8 165.2 30.6 33 21.8 56.6 51.6 72.2 87.8 3.8 5.6 1.2 8.8-6.2 10.6z m-703.6 11.2c-2.5 0-3.12-1.2-1.88-3.2l13.1-16.8c1.24-1.8 4.36-3 6.86-3H337.20014c2.4 0 3 1.8 1.8 3.6l-10.6 16.2c-1.2 2-4.4 3.8-6.2 3.8l-225.6-0.6zM2.49214 458.2c-2.492 0-3.116-1.4-1.868-3.2l13.086-16.8c1.248-1.8 4.364-3.2 6.85-3.2H304.80014c2.4 0 3.6 2 3 3.8l-5 15c-0.6 2.4-3 3.8-5.6 3.8l-294.708 0.6z m148.948 53.6c-1.24 1.8-0.62 3.6 1.86 3.6l135.9 0.6c1.8 0 4.4-1.8 4.4-4.2l1.2-15c0-2.6-1.2-4.4-3.8-4.4H166.40014c-2.5 0-4.98 1.8-6.24 3.8l-8.72 15.6z m1002.96-36c-0.4-5.2-0.6-9.6-1.4-14-11.2-61.6-68-96.6-127.2-82.8-58 13-95.4 49.8-109 108.4-11.2 48.6 12.4 97.8 57.2 117.8 34.4 15 68.6 13.2 101.6-3.8 49.2-27.2 76-65.4 79.2-119-0.2-2.4-0.2-4.6-0.4-6.6z" p-id="9236"></path></svg>`,
iconIFJekyll: `<svg t="1694167709305" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4932" width="16" height="16"><path d="M667.4 180c-35.2 0-69.6 8.8-99.7 27.1-57.2 32.2-91.6 89.4-91.6 151.7v306.4c0 35.9-20.5 68.9-55 88.7-19.8 11-41.8 16.9-64.5 16.9-66 0-119.5-47.6-119.5-105.5 0-17.6 4.4-34.4 13.9-49.8 13.9-23.5 38.8-41.8 70.4-51.3 3.7-1.5 6.6-1.5 8.1-1.5 20.5 0 36.6-16.1 36.6-36.6s-16.1-36.6-36.6-36.6c-8.8 0-17.6 1.5-30.8 5.1-46.9 13.9-85.8 43.2-109.9 82.8-16.1 27.1-24.9 57.2-24.9 87.9 0 98.9 86.5 178.8 192.8 178.8 35.2 0 69.6-8.8 100.4-26.4 57.2-32.2 91.6-89.4 91.6-151.7V358.8c0-35.9 20.5-68.9 55-88.7 19.8-11 41.8-16.9 64.5-16.9 65.2 0 118.7 47.6 118.7 105.5 0 17.6-4.4 34.4-13.9 49.8-13.9 24.2-38.8 42.5-70.4 51.3-3.7 1.5-6.6 1.5-8.1 1.5-20.5 0-36.6 16.1-36.6 36.6s16.1 36.6 36.6 36.6c8.8 0 18.3-1.5 30.8-5.1 46.9-13.9 85.8-43.2 109.9-82.8 16.1-27.1 24.9-57.2 24.9-87.9 0-98.8-86.5-178.7-192.7-178.7z" p-id="4933"></path></svg>`,
iconIFVuepress: `<svg t="1694167910261" class="icon" viewBox="0 0 1120 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8613" width="16" height="16"><path d="M1055.594124 381.672727L897.339578 139.636364c-18.618182-37.236364-74.472727-55.854545-111.709091-55.854546H282.939578c-37.236364 0-93.090909 27.927273-111.709091 55.854546L12.975942 381.672727c-18.618182 37.236364-18.618182 83.781818 9.309091 111.709091l465.454545 493.381818c27.927273 27.927273 65.163636 18.618182 93.090909 0l465.454546-493.381818c27.927273-27.927273 37.236364-83.781818 9.309091-111.709091z m-242.036364-74.472727s0 9.309091 0 0L552.903215 726.109091H422.575942L376.030487 344.436364c0-18.618182-9.309091-27.927273-9.309091-37.236364-9.309091-9.309091-18.618182-9.309091-27.927272-9.309091l9.309091-18.618182H469.121396c9.309091 0 18.618182 0 27.927273 9.309091 9.309091 9.309091 9.309091 18.618182 9.309091 27.927273l27.927273 269.963636 139.636363-251.345454v-9.309091-9.309091c0-9.309091 0-9.309091-9.309091-18.618182-9.309091 0-9.309091-9.309091-18.618181-9.309091l9.309091-18.618182h139.636363c9.309091 0 18.618182 0 18.618182 9.309091s9.309091 18.618182 0 27.927273c9.309091 0 0 0 0 0z" p-id="8614"></path></svg>`,
iconIFVuepress2: `<svg t="1694167983538" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="8866" width="16" height="16"><path d="M554.666667 384h234.666666L554.666667 149.333333V384M256 85.333333h341.333333l256 256v512a85.333333 85.333333 0 0 1-85.333333 85.333334H256a85.333333 85.333333 0 0 1-85.333333-85.333334V170.666667c0-47.36 37.973333-85.333333 85.333333-85.333334m384 682.666667v-85.333333H256v85.333333h384m128-170.666667v-85.333333H256v85.333333h512z" p-id="8867"></path><path d="M516.010667 555.946667l249.941333 431.36 249.941333-429.269334v-2.133333h-97.152l-151.338666 259.925333-150.613334-259.925333z" fill="#41B883" p-id="8868"></path><path d="M616.789333 555.946667l150.613334 259.925333 151.338666-259.968h-91.136L768 658.218667l-59.306667-102.314667z" p-id="8869"></path></svg>`,

iconIFVue: `<svg t="1684170497745" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="10726" width="16" height="16"><path d="M512 504L764.8 68.8h-134.4L512 275.2 393.6 70.4h-134.4L512 504zM819.2 70.4L512 600 204.8 68.8H0l512 886.4L1024 70.4H819.2z" p-id="10727"></path></svg>`,
iconIFNuxt: `<svg t="1689995630285" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2710" width="16" height="16"><path d="M841.557333 864.938667l0.981334-1.92a31.573333 31.573333 0 0 0 2.261333-4.992l0.085333-0.213334a49.493333 49.493333 0 0 0 2.304-25.898666l0.042667 0.298666a76.586667 76.586667 0 0 0-10.026667-26.581333l0.213334 0.341333-226.858667-399.061333-34.645333-60.586667-34.432 60.586667-226.730667 399.061333a78.933333 78.933333 0 0 0-8.704 25.770667l-0.042667 0.469333a53.632 53.632 0 0 0 3.413334 30.421334l-0.128-0.341334a34.517333 34.517333 0 0 0 2.133333 4.352l-0.085333-0.170666c6.826667 11.733333 21.333333 25.685333 53.333333 25.685333h422.314667c6.698667 0 39.466667-1.365333 54.613333-27.178667z m-265.685333-397.482667l207.317333 364.714667H368.64z m437.290667 338.517333L713.813333 278.613333c-3.072-5.546667-20.352-33.578667-50.432-33.578666-13.525333 0-32.938667 5.76-48.725333 33.493333l-38.698667 67.84 34.432 60.586667 53.333334-94.378667 296.149333 519.68h-112.64a50.645333 50.645333 0 0 1-2.474667 25.941333l0.128-0.341333a32.938667 32.938667 0 0 1-2.432 5.376l0.085334-0.170667-0.981334 1.92c-15.146667 25.813333-47.872 27.178667-54.272 27.178667h176.170667c6.485333 0 39.125333-1.365333 54.272-27.178667 6.698667-11.733333 11.52-31.445333-4.565333-58.965333zM311.637333 866.432a42.197333 42.197333 0 0 1-1.92-3.925333l-0.085333-0.256a52.394667 52.394667 0 0 1-3.584-30.378667l-0.042667 0.298667H64.042667L423.68 199.338667l118.058667 207.530666 34.218666-60.586666-102.912-181.290667c-2.858667-5.205333-20.266667-33.152-50.218666-33.152-13.525333 0-32.938667 5.845333-48.725334 33.578667L9.813333 805.930667c-3.072 5.546667-18.133333 34.645333-3.2 60.458666 6.826667 11.733333 21.333333 25.685333 53.333334 25.685334h305.109333c-31.786667 0-46.506667-13.738667-53.333333-25.685334z" p-id="2711"></path></svg>`,
iconIFYuque: `<svg t="1684169305378" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5780" width="16" height="16"><path d="M903.542857 350.4c-11.314286-45.028571 11.314286-116.8 83.885714-142.171429l-77.6-4.114285s-29.371429-102.857143-164.114285-112c-134.628571-9.257143-222.742857-3.428571-222.857143-3.428572 0.114286 0 99.885714 63.542857 59.885714 176.8-29.257143 60-75.2 109.257143-124.342857 165.371429-1.485714 1.485714-2.857143 2.971429-4 4.228571C291.885714 618.285714 36.571429 909.714286 36.571429 909.714286c281.028571 73.6 469.371429-7.2 580.8-104.114286 23.428571-0.228571 41.028571-0.342857 52.914285-0.342857 155.2 0 286.4-134.4 281.028572-283.885714-3.657143-102.742857-36.457143-125.942857-47.771429-170.971429z m-233.257143 381.714286c-12.114286 0-29.942857 0.114286-53.485714 0.342857l-26.971429 0.228571-20.342857 17.714286c-53.828571 46.857143-119.314286 81.714286-195.885714 100.114286-60 14.4-125.714286 18.514286-197.371429 10.971428 20.571429-23.428571 41.714286-47.542857 63.314286-72.114285 105.142857-119.542857 198.628571-225.714286 270.742857-306.857143l1.6-1.6 1.485715-1.714286c4.685714-5.257143 23.542857-26.628571 28.228571-32.114286 11.085714-12.685714 19.771429-22.742857 28-32.685714 35.085714-41.942857 59.657143-77.485714 78.857143-116.8l1.828571-3.771429 1.371429-3.885714c15.657143-44.342857 17.6-87.885714 7.085714-128.914286 25.714286 0.8 53.142857 2.171429 81.942857 4.114286 38.057143 2.628571 63.428571 14.742857 81.257143 33.371429 6.628571 6.857143 11.657143 14.285714 15.314286 21.371428 1.142857 2.285714 1.942857 4.114286 2.628571 5.714286l5.714286 20.228571c-17.942857 39.428571-22.742857 83.771429-13.028571 122.514286 3.428571 13.485714 7.885714 25.6 14.057142 39.314286 2.4 5.371429 10.857143 22.971429 12.571429 26.628571 11.771429 25.942857 17.6 49.142857 19.085714 89.942857 3.771429 108.114286-94.514286 207.885714-208 207.885715z" p-id="5781"></path></svg>`,
Expand Down

0 comments on commit b5e7413

Please sign in to comment.