├── .eslintrc.cjs
├── .github
├── dependabot.yml
└── workflows
│ ├── ci.yml
│ └── release-please.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.cjs
├── .release-please-manifest.json
├── CHANGELOG.md
├── DEVELOPMENT.md
├── LICENSE
├── README.md
├── README_zh_CN.md
├── auto-imports.d.ts
├── cross
├── crossPageUtils.spec.ts
└── crossPageUtils.ts
├── custom.d.ts
├── docs.md
├── docs
├── 人工智能.md
├── 使用指南.md
├── 发布设置.md
├── 常规发布.md
├── 批量分发.md
├── 插件开发.md
├── 文章管理.md
└── 极速发布.md
├── env.d.ts
├── esbuild.config.cjs
├── help
├── help_1.png
└── help_2.png
├── icon.png
├── index.html
├── package.json
├── plugin.json
├── pnpm-lock.yaml
├── policy.md
├── preview.png
├── public
├── favicon.ico
├── images
│ ├── github.png
│ ├── gitlab.jpg
│ ├── http.png
│ ├── metaweblog.jpg
│ ├── toutiao.png
│ ├── universal.webp
│ ├── weixin.png
│ ├── wordpress-logo.svg
│ ├── xmlrpc.png
│ └── zhihu.png
└── libs
│ ├── alioss
│ └── aliyun-oss-sdk-6.16.0.min.js
│ ├── eruda
│ ├── backers.svg
│ └── eruda.js
│ ├── lute
│ └── lute-1.7.5-20230410.min.js
│ ├── node-fetch-cjs
│ ├── LICENSE
│ ├── README.md
│ ├── package.json
│ └── pnpm-lock.yaml
│ └── zhi-formdata-fetch
│ └── index.cjs
├── release-please-config.json
├── scripts
├── build.py
├── dev.py
├── ext_build.py
├── make_dev_link.py
├── nginx_build.py
├── parse_changelog.py
├── plugin_build.py
├── plugin_dev.py
├── scriptutils.py
├── serve.py
├── siyuan_build.py
├── static_build.py
├── sync_widget_repo.py
├── vercel_build.py
├── version.py
└── widget_build.py
├── siyuan
├── Constants.ts
├── api
│ ├── base-kernel-api.ts
│ └── kernel-api.ts
├── appLogger.ts
├── i18n
│ ├── en_US.json
│ └── zh_CN.json
├── iframeDialog.ts
├── index.styl
├── index.ts
├── invoke
│ ├── pluginInvoke.ts
│ └── widgetInvoke.ts
├── store
│ ├── config.ts
│ └── preferenceConfigManager.ts
├── topbar.ts
└── utils
│ ├── htmlUtils.ts
│ ├── menuUtils.ts
│ ├── pageUtil.ts
│ ├── pageUtils.ts
│ ├── svg.ts
│ └── utils.ts
├── src
├── App.vue
├── adaptors
│ ├── api
│ │ ├── antora
│ │ │ └── antoraConfig.ts
│ │ ├── base
│ │ │ ├── baseBlogApi.ts
│ │ │ ├── commonBlogConfig.ts
│ │ │ ├── commonBlogPlaceholder.ts
│ │ │ ├── github
│ │ │ │ ├── commonGithubApiAdaptor.ts
│ │ │ │ ├── commonGithubConfig.ts
│ │ │ │ └── commonGithubPlaceholder.ts
│ │ │ ├── gitlab
│ │ │ │ ├── commonGitlabApiAdaptor.spec.ts
│ │ │ │ ├── commonGitlabApiAdaptor.ts
│ │ │ │ ├── commonGitlabConfig.ts
│ │ │ │ └── commonGitlabPlaceholder.ts
│ │ │ └── metaweblog
│ │ │ │ ├── metaweblogBlogApiAdaptor.ts
│ │ │ │ ├── metaweblogConfig.ts
│ │ │ │ ├── metaweblogConstants.ts
│ │ │ │ └── metaweblogPlaceholder.ts
│ │ ├── cnblogs
│ │ │ ├── cnblogsApiAdaptor.ts
│ │ │ ├── cnblogsConfig.ts
│ │ │ ├── cnblogsConstants.ts
│ │ │ ├── cnblogsPlaceholder.ts
│ │ │ ├── docs.md
│ │ │ └── useCnblogsApi.ts
│ │ ├── docsify
│ │ │ └── docsifyConfig.ts
│ │ ├── gitlab-antora
│ │ │ └── gitlabantoraConfig.ts
│ │ ├── gitlab-docsify
│ │ │ └── GitlabdocsifyConfig.ts
│ │ ├── gitlab-hexo
│ │ │ ├── gitlabhexoApiAdaptor.ts
│ │ │ ├── gitlabhexoConfig.ts
│ │ │ ├── gitlabhexoPlaceHolder.ts
│ │ │ ├── gitlabhexoYamlConverterAdaptor.ts
│ │ │ └── useGitlabhexoApi.ts
│ │ ├── gitlab-hugo
│ │ │ ├── gitlabhugoApiAdaptor.ts
│ │ │ ├── gitlabhugoConfig.ts
│ │ │ ├── gitlabhugoPlaceHolder.ts
│ │ │ ├── gitlabhugoYamlConverterAdaptor.ts
│ │ │ └── useGitlabhugoApi.ts
│ │ ├── gitlab-jekyll
│ │ │ ├── gitlabjekyllApiAdaptor.ts
│ │ │ ├── gitlabjekyllConfig.ts
│ │ │ ├── gitlabjekyllPlaceHolder.ts
│ │ │ ├── gitlabjekyllYamlConverterAdaptor.ts
│ │ │ └── useGitlabjekyllApi.ts
│ │ ├── gitlab-vitepress
│ │ │ ├── gitlabvitepressApiAdaptor.ts
│ │ │ ├── gitlabvitepressConfig.ts
│ │ │ ├── gitlabvitepressPlaceHolder.ts
│ │ │ ├── gitlabvitepressYamlConverterAdaptor.ts
│ │ │ └── useGitlabvitepressApi.ts
│ │ ├── gitlab-vuepress
│ │ │ ├── gitlabvuepressApiAdaptor.ts
│ │ │ ├── gitlabvuepressConfig.ts
│ │ │ ├── gitlabvuepressPlaceHolder.ts
│ │ │ ├── gitlabvuepressYamlConverterAdaptor.ts
│ │ │ └── useGitlabvuepressApi.ts
│ │ ├── gitlab-vuepress2
│ │ │ ├── gitlabvuepress2ApiAdaptor.ts
│ │ │ ├── gitlabvuepress2Config.ts
│ │ │ ├── gitlabvuepress2PlaceHolder.ts
│ │ │ ├── gitlabvuepress2YamlConverterAdaptor.ts
│ │ │ └── useGitlabvuepress2Api.ts
│ │ ├── halo
│ │ │ ├── HaloApiAdaptor.ts
│ │ │ ├── HaloConfig.ts
│ │ │ ├── HaloPlaceholder.ts
│ │ │ ├── HaloPostMeta.ts
│ │ │ ├── haloUtils.ts
│ │ │ └── useHaloApi.ts
│ │ ├── hexo
│ │ │ ├── hexoApiAdaptor.ts
│ │ │ ├── hexoConfig.ts
│ │ │ ├── hexoPlaceHolder.ts
│ │ │ ├── hexoYamlConverterAdaptor.ts
│ │ │ └── useHexoApi.ts
│ │ ├── hugo
│ │ │ ├── hugoApiAdaptor.ts
│ │ │ ├── hugoConfig.ts
│ │ │ ├── hugoPlaceHolder.ts
│ │ │ ├── hugoYamlConverterAdaptor.ts
│ │ │ └── useHugoApi.ts
│ │ ├── jekyll
│ │ │ ├── jekyllApiAdaptor.ts
│ │ │ ├── jekyllConfig.ts
│ │ │ ├── jekyllPlaceHolder.ts
│ │ │ ├── jekyllYamlConverterAdaptor.ts
│ │ │ └── useJekyllApi.ts
│ │ ├── jvue
│ │ │ ├── jvueApiAdaptor.ts
│ │ │ ├── jvueConfig.ts
│ │ │ ├── jvuePlaceHolder.ts
│ │ │ └── useJvueApi.ts
│ │ ├── metaweblog
│ │ │ └── useMetaweblogApi.ts
│ │ ├── notion
│ │ │ ├── notionApiAdaptor.ts
│ │ │ ├── notionConfig.ts
│ │ │ ├── notionPlaceHolder.ts
│ │ │ └── useNotionApi.ts
│ │ ├── telegraph
│ │ │ ├── telegraphApiAdaptor.ts
│ │ │ ├── telegraphConfig.ts
│ │ │ ├── telegraphPlaceholder.ts
│ │ │ └── useTelegraphApi.ts
│ │ ├── typecho
│ │ │ ├── docs.md
│ │ │ ├── typechoApiAdaptor.ts
│ │ │ ├── typechoConfig.ts
│ │ │ ├── typechoConstants.ts
│ │ │ ├── typechoPlaceholder.ts
│ │ │ ├── typechoUtils.ts
│ │ │ └── useTypechoApi.ts
│ │ ├── vitepress
│ │ │ ├── useVitepressApi.ts
│ │ │ ├── vitepressApiAdaptor.ts
│ │ │ ├── vitepressConfig.ts
│ │ │ ├── vitepressPlaceHolder.ts
│ │ │ └── vitepressYamlConverterAdaptor.ts
│ │ ├── vuepress
│ │ │ ├── useVuepressApi.ts
│ │ │ ├── vuepressApiAdaptor.ts
│ │ │ ├── vuepressConfig.ts
│ │ │ ├── vuepressPlaceHolder.ts
│ │ │ └── vuepressYamlConverterAdaptor.ts
│ │ ├── vuepress2
│ │ │ ├── useVuepress2Api.ts
│ │ │ ├── vuepress2ApiAdaptor.ts
│ │ │ ├── vuepress2Config.ts
│ │ │ ├── vuepress2PlaceHolder.ts
│ │ │ └── vuepress2YamlConverterAdaptor.ts
│ │ ├── wordpress
│ │ │ ├── docs.md
│ │ │ ├── useWordpressApi.ts
│ │ │ ├── wordpressApiAdaptor.ts
│ │ │ ├── wordpressConfig.ts
│ │ │ ├── wordpressConstants.ts
│ │ │ ├── wordpressPlaceholder.ts
│ │ │ └── wordpressUtils.ts
│ │ ├── yinxiang
│ │ │ └── yinxiangConfig.ts
│ │ └── yuque
│ │ │ ├── useYuqueApi.ts
│ │ │ ├── yuqueApiAdaptor.ts
│ │ │ ├── yuqueConfig.ts
│ │ │ └── yuquePlaceHolder.ts
│ ├── base
│ │ └── baseExtendApi.ts
│ ├── index.ts
│ └── web
│ │ ├── base
│ │ ├── baseWebApi.ts
│ │ ├── commonWebConfig.ts
│ │ ├── commonWebPlaceholder.ts
│ │ └── webUtils.ts
│ │ ├── bilibili
│ │ └── bilibiliConfig.ts
│ │ ├── csdn
│ │ ├── csdnConfig.ts
│ │ ├── csdnPlaceholder.ts
│ │ ├── csdnUtils.spec.ts
│ │ ├── csdnUtils.ts
│ │ ├── csdnWebAdaptor.ts
│ │ └── useCsdnWeb.ts
│ │ ├── douban
│ │ └── doubanConfig.ts
│ │ ├── flowus
│ │ ├── flowusConfig.ts
│ │ ├── flowusPlaceholder.ts
│ │ ├── flowusWebAdaptor.ts
│ │ └── useFlowusWeb.ts
│ │ ├── jianshu
│ │ ├── docs.md
│ │ ├── jianshuConfig.ts
│ │ ├── jianshuPlaceholder.ts
│ │ ├── jianshuWebAdaptor.ts
│ │ └── useJianshuWeb.ts
│ │ ├── juejin
│ │ ├── docs.md
│ │ ├── juejinConfig.ts
│ │ ├── juejinPlaceholder.ts
│ │ ├── juejinWebAdaptor.ts
│ │ └── useJuejinWeb.ts
│ │ ├── mdnice
│ │ └── mdniceConfig.ts
│ │ ├── wechat
│ │ ├── docs.md
│ │ ├── useWechatWeb.ts
│ │ ├── wechatConfig.ts
│ │ ├── wechatPlaceholder.ts
│ │ └── wechatWebAdaptor.ts
│ │ ├── wuaipojie
│ │ └── wuaipojieConfig.ts
│ │ ├── xiaohongshu
│ │ └── xiaohongshuConfig.ts
│ │ └── zhihu
│ │ ├── useZhihuWeb.ts
│ │ ├── zhihuConfig.ts
│ │ ├── zhihuPlaceholder.ts
│ │ ├── zhihuUtils.ts
│ │ └── zhihuWebAdaptor.ts
├── ai
│ ├── AiConstants.ts
│ └── prompt.ts
├── assets
│ ├── README.md
│ ├── README_0_8_1_zh_CN.md
│ ├── README_zh_CN.md
│ ├── icon.png
│ ├── preview.png
│ ├── style.css
│ ├── style.dark.css
│ ├── tech.md
│ ├── vue.svg
│ └── webfont.css
├── bootstrap.ts
├── components
│ ├── common
│ │ ├── BackPage.vue
│ │ ├── DrawerBoxBridge.vue
│ │ └── LoadingTimer.vue
│ ├── publish
│ │ ├── BatchPublishIndex.vue
│ │ ├── QuickPublishSelectPlatform.vue
│ │ ├── SinglePublishDoPublish.vue
│ │ ├── SinglePublishSelectPlatform.vue
│ │ └── form
│ │ │ ├── AiSwitch.vue
│ │ │ ├── CommonCategories.vue
│ │ │ ├── EditModeSelect.vue
│ │ │ ├── PublishCategories.vue
│ │ │ ├── PublishDescription.vue
│ │ │ ├── PublishKnowledgeSpace.vue
│ │ │ ├── PublishPlatform.vue
│ │ │ ├── PublishTags.vue
│ │ │ ├── PublishTime.vue
│ │ │ ├── PublishTips.vue
│ │ │ ├── PublishTitle.vue
│ │ │ ├── SourceMode.vue
│ │ │ ├── category
│ │ │ └── MultiCategories.vue
│ │ │ ├── kwspace
│ │ │ ├── SingleKnowledgeSpace.vue
│ │ │ └── TreeSingleKnowledgeSpace.vue
│ │ │ └── tagslug
│ │ │ └── SingleTagSlug.vue
│ ├── set
│ │ ├── GeneralSetting.vue
│ │ ├── PublishSetting.vue
│ │ ├── SetIndex.vue
│ │ ├── SiyuanSetting.vue
│ │ ├── preference
│ │ │ ├── AiSetting.vue
│ │ │ ├── ChangeLocal.vue
│ │ │ ├── PostBind.vue
│ │ │ └── PreferenceSetting.vue
│ │ └── publish
│ │ │ ├── PlatformAddForm.vue
│ │ │ ├── PlatformQuickAdd.vue
│ │ │ ├── PlatformUpdateForm.vue
│ │ │ ├── form
│ │ │ ├── PlatformAddForm.vue
│ │ │ ├── PlatformQuickAdd.vue
│ │ │ └── PlatformUpdateForm.vue
│ │ │ ├── platform
│ │ │ ├── PublishPlatformImport.vue
│ │ │ ├── PublishPlatformSettingList.vue
│ │ │ ├── PublishPlatformStore.vue
│ │ │ └── PublishSettingTips.vue
│ │ │ └── singleplatform
│ │ │ ├── SingleSettingIndex.vue
│ │ │ ├── base
│ │ │ ├── CommonBlogSetting.vue
│ │ │ ├── CookieSetting.vue
│ │ │ └── impl
│ │ │ │ ├── CommonGithubSetting.vue
│ │ │ │ ├── CustomWebSetting.vue
│ │ │ │ └── MetaweblogSetting.vue
│ │ │ ├── commonblog
│ │ │ ├── HaloSetting.vue
│ │ │ ├── NotionSetting.vue
│ │ │ ├── TelegraphSetting.vue
│ │ │ └── YuqueSetting.vue
│ │ │ ├── github
│ │ │ ├── HexoSetting.vue
│ │ │ ├── HugoSetting.vue
│ │ │ ├── JekyllSetting.vue
│ │ │ ├── VitepressSetting.vue
│ │ │ ├── Vuepress2Setting.vue
│ │ │ └── VuepressSetting.vue
│ │ │ ├── gitlab
│ │ │ ├── GitlabhexoSetting.vue
│ │ │ ├── GitlabhugoSetting.vue
│ │ │ ├── GitlabjekyllSetting.vue
│ │ │ ├── GitlabvitepressSetting.vue
│ │ │ ├── Gitlabvuepress2Setting.vue
│ │ │ └── GitlabvuepressSetting.vue
│ │ │ ├── metaweblog
│ │ │ ├── CnblogsSetting.vue
│ │ │ ├── JvueSetting.vue
│ │ │ ├── OthermetaSetting.vue
│ │ │ ├── TypechoSetting.vue
│ │ │ └── WordpressSetting.vue
│ │ │ └── web
│ │ │ ├── CsdnSetting.vue
│ │ │ ├── FlowusSetting.vue
│ │ │ ├── JianshuSetting.vue
│ │ │ ├── JuejinSetting.vue
│ │ │ ├── WechatSetting.vue
│ │ │ └── ZhihuSetting.vue
│ └── test
│ │ ├── ChatgptTest.vue
│ │ ├── CnblogsTest.vue
│ │ ├── CsdnTest.vue
│ │ ├── HexoTest.vue
│ │ ├── HugoTest.vue
│ │ ├── OtherTest.vue
│ │ ├── PicgoTest.vue
│ │ ├── SiyuanTest.vue
│ │ ├── TypechoTest.vue
│ │ ├── VitepressTest.vue
│ │ ├── WordpressTest.vue
│ │ ├── YuqueTest.vue
│ │ ├── ZhihuTest.vue
│ │ └── kmsTest.vue
├── composables
│ ├── useChatGPT.ts
│ ├── useLoadingTimer.ts
│ ├── usePicgoBridge.ts
│ ├── usePlatformDefine.ts
│ ├── useProxy.ts
│ ├── usePublish.ts
│ ├── usePublishConfig.spec.ts
│ ├── usePublishConfig.ts
│ ├── useSiyuanApi.ts
│ ├── useSiyuanDevice.ts
│ ├── useVueI18n.ts
│ └── useVueRouter.ts
├── extensions
│ ├── background.js
│ ├── images
│ │ ├── icon128.png
│ │ ├── icon16.png
│ │ ├── icon32.png
│ │ └── icon48.png
│ ├── manifest.json
│ └── mv2
│ │ ├── background-v2-for-firefox.js
│ │ └── manifest-v2-for-firefox.json
├── layouts
│ ├── AppLayout.vue
│ └── default
│ │ ├── AppLayoutDefault.vue
│ │ ├── DefaultFooter.vue
│ │ └── DefaultHeader.vue
├── locales
│ ├── en_US.ts
│ ├── index.ts
│ └── zh_CN.ts
├── main.ts
├── models
│ ├── aiPrompt.ts
│ ├── distributionPattern.ts
│ ├── methodEnum.ts
│ ├── pageEditMode.ts
│ ├── platformMetadata.ts
│ ├── publishPreferenceCfg.ts
│ └── sourceContentShowType.ts
├── pages
│ ├── About.vue
│ ├── Admin.vue
│ ├── AiChat.vue
│ ├── BatchPublish.vue
│ ├── Setting.vue
│ ├── SinglePublish.vue
│ └── Test.vue
├── platforms
│ ├── dynamicConfig.spec.ts
│ ├── dynamicConfig.ts
│ └── pre.ts
├── publisherAppInstance.ts
├── routes
│ └── routeConfig.ts
├── setup.ts
├── stores
│ ├── common
│ │ ├── commonStorage.ts
│ │ ├── commonStorageAsync.ts
│ │ ├── jsonStorage.ts
│ │ ├── useCommonLocalStorage.ts
│ │ └── useCommonStorageAsync.ts
│ ├── usePlatformMetadataStore.ts
│ ├── usePreferenceSettingStore.ts
│ ├── usePublishPreferenceSetting.ts
│ ├── usePublishSettingStore.ts
│ ├── useSettingStore.ts
│ ├── useSiyuanSetting.ts
│ └── useSiyuanSettingStore.ts
├── types
│ ├── ICategoryConfig.ts
│ ├── IPublishCfg.ts
│ └── ITagConfig.ts
├── utils
│ ├── ai
│ │ ├── AiConstants.ts
│ │ └── prompt.ts
│ ├── appLogger.ts
│ ├── constants.ts
│ ├── cookieUtils.spec.ts
│ ├── cookieUtils.ts
│ ├── directives
│ │ └── iframeResize.ts
│ ├── drawerUtils.ts
│ ├── idUtil.ts
│ ├── import
│ │ └── pre.ts
│ ├── katexUtils.ts
│ ├── luteUtil.ts
│ ├── pluginUtils.ts
│ ├── polyfillUtils.ts
│ ├── siyuanUtils.ts
│ ├── svgIcons.ts
│ ├── sypIdUtil.ts
│ ├── utils.ts
│ ├── vueUtils.ts
│ └── widgetUtils.ts
├── vendors
│ └── alioss
│ │ └── s3oss.ts
├── vite-env.d.ts
├── vue-shim.d.ts
└── workers
│ └── QuickPublish.vue
├── syp.config.ts
├── tsconfig.json
├── tsconfig.node.json
├── vite.config.ts
└── widget.json
/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | extends: [
3 | "eslint:recommended",
4 | "plugin:@typescript-eslint/recommended",
5 | "plugin:vue/vue3-recommended",
6 | "turbo",
7 | "prettier",
8 | ],
9 |
10 | // https://eslint.vuejs.org/user-guide/#how-to-use-a-custom-parser
11 | parser: "vue-eslint-parser",
12 | parserOptions: {
13 | parser: "@typescript-eslint/parser",
14 | },
15 |
16 | plugins: ["@typescript-eslint", "vue", "prettier"],
17 |
18 | rules: {
19 | // Note: you must disable the base rule as it can report incorrect errors
20 | semi: "off",
21 | quotes: "off",
22 | "no-undef": "off",
23 | "vue/no-v-htm": "off",
24 | "@typescript-eslint/no-empty-function": "off",
25 | "@typescript-eslint/no-empty-interface": "off",
26 | "@typescript-eslint/no-var-requires": "off",
27 | "@typescript-eslint/no-this-alias": "off",
28 | "@typescript-eslint/no-non-null-assertion": "off",
29 | "@typescript-eslint/no-unused-vars": "off",
30 | "@typescript-eslint/no-explicit-any": "off",
31 | "turbo/no-undeclared-env-vars": "off",
32 | "prettier/prettier": "error",
33 | },
34 | }
35 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | # Fetch and update latest `npm` packages
4 | - package-ecosystem: npm
5 | directory: "/"
6 | schedule:
7 | interval: daily
8 | time: "00:00"
9 | open-pull-requests-limit: 10
10 | reviewers:
11 | - terwer
12 | assignees:
13 | - terwer
14 | commit-message:
15 | prefix: fix
16 | prefix-development: chore
17 | include: scope
18 | labels:
19 | - "npm dependencies"
20 | - "npm"
21 |
22 | # Fetch and update latest `github-actions` pkgs
23 | - package-ecosystem: github-actions
24 | directory: "/"
25 | schedule:
26 | interval: daily
27 | time: "00:00"
28 | open-pull-requests-limit: 10
29 | reviewers:
30 | - terwer
31 | assignees:
32 | - terwer
33 | commit-message:
34 | prefix: fix
35 | prefix-development: chore
36 | include: scope
37 | labels:
38 | - "github actions"
39 | - "ci"
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 | on:
3 | push:
4 | branches:
5 | - dev
6 |
7 | jobs:
8 | ci:
9 | runs-on: ubuntu-22.04
10 | steps:
11 | - name: Checkout
12 | uses: actions/checkout@v3
13 |
14 | - name: Install Node.js
15 | uses: actions/setup-node@v4
16 | with:
17 | node-version: 18
18 |
19 | - uses: pnpm/action-setup@v3
20 | name: Install pnpm
21 | id: pnpm-install
22 | with:
23 | version: 8
24 | run_install: false
25 |
26 | - name: Get pnpm store directory
27 | id: pnpm-cache
28 | shell: bash
29 | run: |
30 | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
31 |
32 | - uses: actions/cache@v4
33 | name: Setup pnpm cache
34 | with:
35 | path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
36 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
37 | restore-keys: |
38 | ${{ runner.os }}-pnpm-store-
39 |
40 | - name: Install dependencies
41 | run: pnpm install
42 |
43 | - name: Build for production
44 | run: pnpm build
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # idea
2 | .idea
3 | .DS_Store
4 |
5 | # build
6 | dist
7 | lib
8 | !src/lib
9 | node_modules
10 |
11 | # api-extractor
12 | etc
13 | temp
14 | tsdoc-metadata.json
15 |
16 | # env
17 | .env.development
18 | .env.production
19 | .env.test
20 |
21 | # Scripts
22 | venv
23 | __pycache__
24 | cookie.txt
25 | token.txt
26 | pageId.txt
27 |
28 | # ext
29 | extension
30 | build
31 |
32 | # widget
33 | widget
34 | archive.zip
35 | components.d.ts
36 | auto-imports.d.ts
37 |
38 | # ginx
39 | nginx
40 |
41 | # test
42 | coverage
43 | testdata
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | # platform
2 |
3 | # Ignore artifacts:
4 | dist
5 | node_modules
6 |
7 | # Ignore all dts files:
8 | *.d.ts
9 |
10 | # lib
11 | /pnpm-lock.yaml
12 |
--------------------------------------------------------------------------------
/.prettierrc.cjs:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | module.exports = {
27 | semi: false,
28 | singleQuote: false,
29 | printWidth: 120
30 | }
31 |
--------------------------------------------------------------------------------
/.release-please-manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | ".": "1.21.0"
3 | }
--------------------------------------------------------------------------------
/DEVELOPMENT.md:
--------------------------------------------------------------------------------
1 | # Development
2 |
3 | ## Prerequisites
4 |
5 | ```bash
6 | pnpm install
7 | ```
8 |
9 | ## Development
10 |
11 | serve
12 |
13 | ```bash
14 | pnpm serve
15 | ```
16 |
17 | dev
18 |
19 | ```bash
20 | pnpm dev -p siyuan
21 | # siyuan plugin
22 | # -d 默认 dist
23 | # -t 默认 plugin
24 | pnpm makeLink -p siyuan
25 |
26 | # -d 默认 widget
27 | pnpm dev -p widget
28 | # siyuan widget
29 | pnpm makeLink -p widget -d widget -t widget
30 |
31 | # chrome extension
32 | # -d 默认 chrome,实际地址是:extension/extension
33 | pnpm dev -p chrome
34 |
35 | # firefox extension
36 | # -d 默认 firefox,实际地址是:extension/firefox
37 | pnpm dev -p firefox
38 |
39 | # nginx
40 | # -d 默认 nginx
41 | pnpm dev -p nginx
42 | # ================================================
43 | # serve nginx
44 | cd ./nginx
45 | # npm i -g serve
46 | serve -l 9000 -C
47 | ```
48 |
49 | ## Build
50 |
51 | ```bash
52 | pnpm package
53 | ```
54 |
55 | artifacts structure
56 |
57 | ```
58 | ├── build
59 | ├── package.zip
60 | ├── package-widget.zip
61 | ├── siyuan-plugin-publisher-1.19.1.zip
62 | ├── siyuan-publisher-nginx-1.19.1
63 | ├── sy-post-publisher-chrome-1.19.1.zip
64 | ├── sy-post-publisher-firefox-1.19.1.zip
65 | └── sy-post-publisher-widget-1.19.1.zip
66 | ```
67 |
68 | Note: vercel is also supported via `pnpm vercelBuild`
69 |
70 | ## Sync to legacy widget repo
71 |
72 | ```bash
73 | pnpm syncWidgetRepo
74 | ```
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Terwer
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/auto-imports.d.ts:
--------------------------------------------------------------------------------
1 | /* eslint-disable */
2 | /* prettier-ignore */
3 | // @ts-nocheck
4 | // noinspection JSUnusedGlobalSymbols
5 | // Generated by unplugin-auto-import
6 | export {}
7 | declare global {
8 | const ElMessage: typeof import('element-plus/es')['ElMessage']
9 | const ElMessageBox: typeof import('element-plus/es')['ElMessageBox']
10 | }
11 |
--------------------------------------------------------------------------------
/cross/crossPageUtils.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { describe, it } from "vitest"
27 | import CrossPageUtils from "./crossPageUtils"
28 |
29 | describe("test crossPageUtils", () => {
30 | it("test subPlatformName", () => {
31 | const result = CrossPageUtils.subPlatformName("Gitlabvuepress2", 11)
32 | console.log(result)
33 | })
34 | })
35 |
--------------------------------------------------------------------------------
/custom.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | declare module "zhi-notion-markdown"
27 | declare module "uuid"
28 | declare module "cookie-parse"
29 | declare module "telegraph.md"
--------------------------------------------------------------------------------
/docs.md:
--------------------------------------------------------------------------------
1 | # docs
2 |
3 | ## 构建
4 |
5 | ### 插件构建
6 |
7 | `pnpm build`
8 |
9 | (1) `pnpm pluginBuild`
10 |
11 | (2) `pnpm siyuanBuild`
12 |
13 | 输出目录 `dist`
14 |
15 | ### 挂件构建
16 |
17 | `pnpm widgetBuild`
18 |
19 | 或者 `pnpm widgetBuild -t`
20 |
21 | 或者 `pnpm widgetBuild -t -nb`
22 |
23 | 输出目录 `widget`
24 |
25 | ### 浏览器插件构建
26 |
27 | chrome
28 |
29 | `pnpm extBuild`
30 |
31 | 或者 `pnpm extBuild -nb`
32 |
33 | firefox
34 |
35 | `pnpm extBuild -t firefox`
36 |
37 | 或者 `pnpm widgetBuild -t firefox -nb`
38 |
39 | ## 注意事项
40 |
41 | 下面的类库需要动态引用,不能直接构建
42 |
43 | ```
44 | "fetch-blob": "^4.0.0",
45 | "formdata-polyfill": "^4.0.10",
46 | ```
--------------------------------------------------------------------------------
/docs/人工智能.md:
--------------------------------------------------------------------------------
1 | ## 人工智能
2 |
3 | 入口地址为:/#/manage
--------------------------------------------------------------------------------
/docs/使用指南.md:
--------------------------------------------------------------------------------
1 | # 使用指南
2 |
3 | 请参考 []()
--------------------------------------------------------------------------------
/docs/发布设置.md:
--------------------------------------------------------------------------------
1 | # 发布设置
2 |
3 | ## 发布设置
4 |
5 | 入口地址为:/#/manage
6 |
7 | ## 偏好设置
8 |
9 | 入口地址为:/#/manage
--------------------------------------------------------------------------------
/docs/常规发布.md:
--------------------------------------------------------------------------------
1 | ## 常规发布
2 |
3 | 入口地址为:/#/manage
--------------------------------------------------------------------------------
/docs/批量分发.md:
--------------------------------------------------------------------------------
1 | ## 批量分发
2 |
3 | 入口地址为:/#/manage
--------------------------------------------------------------------------------
/docs/插件开发.md:
--------------------------------------------------------------------------------
1 | ## 插件开发指南
2 |
3 | 先要确定插件所属的大类,这个是发布工具内置的,需要发布工具内部添加维护,不支持用户自定义。
4 | 目前可用的有
5 | - Common
6 | - Metaweblog
7 | - Wordpress
8 | - Github
9 | - Gitlab
10 | - Custom
11 | - System
12 |
13 | ## 新增大类的时候需要维护(内部维护)
14 | - DynamicJsonCfg
15 | - getSubtypeList
16 | - setDynamicJsonCfg
17 | - src/platforms/pre.ts
18 |
19 | ## API授权插件开发指南
20 |
21 | 1. 确定大类。例如:Halo属于Common
22 | 2. 新建子类别。例如:src/platforms/dynamicConfig.ts里面的SubPlatformType加一个Common_CSDN
23 | 3. 注册子类别,需要修改
24 | - getSubtypeList
25 | - src/platforms/pre.ts
26 | 4. 新增适配器
27 | API授权需要再 src/adaptors/api 新建文件。例如
28 | - HaloApiAdaptor 需要继承 BaseBlogApi
29 | - HaloConfig 需要继承 CommonBlogConfig
30 | - HaloPlaceholder 需要继承 CommonBlogPlaceholder
31 | - useHaloApi 定义 const useHaloApi = async (key: string, newCfg?: HaloConfig) => {}
32 |
33 | 5. 注册适配器
34 | 适配器 src/adaptors/index.ts getCfg
35 | 配置 src/adaptors/index.ts getAdaptor
36 | YAML适配器(不一定有)
37 | 6. 开启配置页面
38 | 在 src/components/set/publish/singleplatform/SingleSettingIndex.vue 注册配置
39 | 7. 修改图片上传逻辑,可选
40 |
41 | ## 网页授权插件开发指南
42 |
43 | 1. 确定大类。例如:CSDN属于Custom
44 | 2. 新建子类别。例如:src/platforms/dynamicConfig.ts里面的SubPlatformType加一个Custom_CSDN
45 | 3. 注册子类别,需要修改
46 | - getSubtypeList
47 | - src/platforms/pre.ts
48 | 4. 新增适配器
49 | 网页授权需要再 src/adaptors/web 新建文件。例如
50 | - csdnWebAdaptor 需要继承 BaseWebApi
51 | - csdnConfig 需要继承 CommonWebConfig
52 | - csdnPlaceholder 需要继承 CommonWebPlaceholder
53 | - useCsdnWeb 定义 const useCsdnWeb = async (key?: string, newCfg?: CsdnConfig) => {}
54 | 5. 注册适配器
55 | 适配器 src/adaptors/index.ts getCfg
56 | 配置 src/adaptors/index.ts getAdaptor
57 | YAML适配器(不一定有)
58 | 6. 开启配置页面
59 | 在 src/components/set/publish/singleplatform/SingleSettingIndex.vue 注册配置
60 | 7. 修改图片上传逻辑,可选
--------------------------------------------------------------------------------
/docs/文章管理.md:
--------------------------------------------------------------------------------
1 | ## 文章管理
2 |
3 | 入口地址为:/#/manage
--------------------------------------------------------------------------------
/docs/极速发布.md:
--------------------------------------------------------------------------------
1 | ## 极速发布
2 |
3 | 入口地址为:/#/manage
--------------------------------------------------------------------------------
/env.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | interface ImportMeta {
27 | readonly env: ImportMetaEnv
28 | }
29 |
--------------------------------------------------------------------------------
/help/help_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/help/help_1.png
--------------------------------------------------------------------------------
/help/help_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/help/help_2.png
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/icon.png
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | 思源笔记发布工具
8 | <%- injectScript %>
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/plugin.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "siyuan-plugin-publisher",
3 | "author": "terwer",
4 | "url": "https://github.com/terwer/siyuan-plugin-publisher",
5 | "version": "0.12.0",
6 | "minAppVersion": "2.9.0",
7 | "backends": [
8 | "windows",
9 | "linux",
10 | "darwin",
11 | "docker",
12 | "android",
13 | "ios"
14 | ],
15 | "frontends": [
16 | "desktop",
17 | "desktop-window",
18 | "mobile",
19 | "browser-desktop",
20 | "browser-mobile"
21 | ],
22 | "displayName": {
23 | "default": "Publisher",
24 | "zh_CN": "发布工具"
25 | },
26 | "description": {
27 | "default": "Publish articles from siyuan-note to platforms like Yuque etc. Free and open source.",
28 | "zh_CN": "将思源笔记的文章发布到语雀等平台,开源、免费 。"
29 | },
30 | "readme": {
31 | "default": "README.md",
32 | "zh_CN": "README_zh_CN.md"
33 | },
34 | "i18n": [
35 | "en_US",
36 | "zh_CN"
37 | ],
38 | "funding": {
39 | "custom": [
40 | "https://afdian.net/a/terwer"
41 | ]
42 | }
43 | }
--------------------------------------------------------------------------------
/preview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/preview.png
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/favicon.ico
--------------------------------------------------------------------------------
/public/images/github.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/github.png
--------------------------------------------------------------------------------
/public/images/gitlab.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/gitlab.jpg
--------------------------------------------------------------------------------
/public/images/http.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/http.png
--------------------------------------------------------------------------------
/public/images/metaweblog.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/metaweblog.jpg
--------------------------------------------------------------------------------
/public/images/toutiao.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/toutiao.png
--------------------------------------------------------------------------------
/public/images/universal.webp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/universal.webp
--------------------------------------------------------------------------------
/public/images/weixin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/weixin.png
--------------------------------------------------------------------------------
/public/images/wordpress-logo.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/images/xmlrpc.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/xmlrpc.png
--------------------------------------------------------------------------------
/public/images/zhihu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/public/images/zhihu.png
--------------------------------------------------------------------------------
/public/libs/node-fetch-cjs/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 - 2021 Node Fetch Team / Touchify Team
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/public/libs/node-fetch-cjs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-fetch-cjs",
3 | "version": "3.2.10",
4 | "description": "A wrapper for node-fetch (a light-weight module that brings Fetch API to node.js) to be used in commonjs environment.",
5 | "main": "dist/index.js",
6 | "sideEffects": false,
7 | "files": [
8 | "dist"
9 | ],
10 | "types": "./dist/index.d.ts",
11 | "engines": {
12 | "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
13 | },
14 | "scripts": {
15 | "build": "node scripts/build.mjs",
16 | "check": "node scripts/check.mjs",
17 | "test": "node --experimental-vm-modules --no-warnings node_modules/jest/bin/jest.js"
18 | },
19 | "repository": {
20 | "type": "git",
21 | "url": "https://github.com/touchifyapp/node-fetch-cjs.git"
22 | },
23 | "keywords": [
24 | "fetch",
25 | "http",
26 | "promise",
27 | "request",
28 | "curl",
29 | "wget",
30 | "xhr",
31 | "whatwg",
32 | "cjs",
33 | "commonjs"
34 | ],
35 | "author": "Touchify",
36 | "license": "MIT",
37 | "bugs": {
38 | "url": "https://github.com/node-fetch/node-fetch/issues"
39 | },
40 | "homepage": "https://github.com/node-fetch/node-fetch",
41 | "funding": {
42 | "type": "opencollective",
43 | "url": "https://opencollective.com/node-fetch"
44 | },
45 | "devDependencies": {
46 | "data-uri-to-buffer": "^4.0.0",
47 | "esbuild": "^0.13.13",
48 | "fetch-blob": "^3.1.4",
49 | "formdata-polyfill": "^4.0.10",
50 | "jest": "^27.3.1"
51 | },
52 | "dependencies": {
53 | "node-fetch": "^3.3.2"
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/public/libs/zhi-formdata-fetch/index.cjs:
--------------------------------------------------------------------------------
1 | const doFetch = async (moduleBase, url, headers, formData) => {
2 | ReadableStream.prototype[Symbol.asyncIterator] ??= async function* () {
3 | const reader = this.getReader()
4 | try {
5 | while (true) {
6 | const { done, value } = await reader.read()
7 | if (done) return
8 | yield value
9 | }
10 | } finally {
11 | reader.releaseLock()
12 | }
13 | }
14 |
15 | const nodeFetch = window.require(`${moduleBase}libs/node-fetch-cjs/dist/index.js`).default
16 | const { FormData, Headers } = window.require(`${moduleBase}libs/node-fetch-cjs/dist/index.js`)
17 |
18 | // headers
19 | const myHeaders = new Headers()
20 | for (const key in headers) {
21 | if (headers.hasOwnProperty(key)) {
22 | myHeaders.append(key, headers[key])
23 | }
24 | }
25 |
26 | // options
27 | const requestOptions = {
28 | method: "POST",
29 | headers: myHeaders,
30 | body: formData,
31 | }
32 |
33 | const response = await nodeFetch(url, requestOptions)
34 | const resText = await response.text()
35 | return resText
36 | }
37 |
38 | module.exports = doFetch
39 |
--------------------------------------------------------------------------------
/release-please-config.json:
--------------------------------------------------------------------------------
1 | {
2 | "packages": {
3 | ".": {
4 | "changelog-path": "CHANGELOG.md",
5 | "release-type": "node",
6 | "target-branch": "main",
7 | "bump-minor-pre-major": false,
8 | "bump-patch-for-minor-pre-major": false,
9 | "draft": false,
10 | "prerelease": false
11 | }
12 | },
13 | "pull-request-header": ":robot: A new release will be created",
14 | "changelog-sections": [
15 | {
16 | "type": "feat",
17 | "section": "Features"
18 | },
19 | {
20 | "type": "fix",
21 | "section": "Bug Fixes"
22 | },
23 | {
24 | "type": "refactor",
25 | "section": "Code Refactoring"
26 | },
27 | {
28 | "type": "chore",
29 | "section": "Miscellaneous"
30 | },
31 | {
32 | "type": "perf",
33 | "section": "Performance Improvements"
34 | }
35 | ],
36 | "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
37 | }
38 |
--------------------------------------------------------------------------------
/scripts/plugin_build.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, Terwer . All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Terwer designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Terwer in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
21 | # or visit www.terwer.space if you need additional information or have any
22 | # questions.
23 |
24 | import os
25 |
26 | import scriptutils
27 |
28 | if __name__ == "__main__":
29 | # Switch to the working directory.
30 | scriptutils.switch_workdir()
31 |
32 | # Get the current working directory.
33 | cwd = scriptutils.get_workdir()
34 |
35 | # 获取当前工作目录
36 | print(os.getcwd())
37 |
38 | os.system("zhi-build --production")
39 |
--------------------------------------------------------------------------------
/scripts/plugin_dev.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, Terwer . All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Terwer designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Terwer in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
21 | # or visit www.terwer.space if you need additional information or have any
22 | # questions.
23 |
24 | import os
25 |
26 | import scriptutils
27 |
28 | if __name__ == "__main__":
29 | # Switch to the working directory.
30 | scriptutils.switch_workdir()
31 |
32 | # Get the current working directory.
33 | cwd = scriptutils.get_workdir()
34 |
35 | # 获取当前工作目录
36 | print(os.getcwd())
37 |
38 | os.system("zhi-build --watch")
39 |
--------------------------------------------------------------------------------
/scripts/siyuan_build.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, Terwer . All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Terwer designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Terwer in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
21 | # or visit www.terwer.space if you need additional information or have any
22 | # questions.
23 |
24 | import os
25 |
26 | import scriptutils
27 |
28 | if __name__ == "__main__":
29 | # Switch to the working directory.
30 | scriptutils.switch_workdir()
31 |
32 | # Get the current working directory.
33 | cwd = scriptutils.get_workdir()
34 |
35 | # 获取当前工作目录
36 | print(os.getcwd())
37 |
38 | # 设置环境变量
39 | os.environ['BUILD_TYPE'] = 'siyuan'
40 |
41 | os.system("vue-tsc --noEmit && vite build")
42 |
--------------------------------------------------------------------------------
/scripts/static_build.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, Terwer . All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Terwer designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Terwer in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
21 | # or visit www.terwer.space if you need additional information or have any
22 | # questions.
23 |
24 | import os
25 |
26 | import scriptutils
27 |
28 | if __name__ == "__main__":
29 | # Switch to the working directory.
30 | scriptutils.switch_workdir()
31 |
32 | # Get the current working directory.
33 | cwd = scriptutils.get_workdir()
34 |
35 | # 获取当前工作目录
36 | print(os.getcwd())
37 |
38 | # 设置环境变量
39 | os.environ['BUILD_TYPE'] = 'nginx'
40 |
41 | os.system("vue-tsc --noEmit && vite build")
42 |
--------------------------------------------------------------------------------
/scripts/sync_widget_repo.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, Terwer . All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Terwer designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Terwer in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
21 | # or visit www.terwer.space if you need additional information or have any
22 | # questions.
23 | import os
24 |
25 | import scriptutils
26 |
27 | if __name__ == "__main__":
28 | # Switch to the working directory.
29 | scriptutils.switch_workdir()
30 |
31 | # Get the current working directory.
32 | cwd = scriptutils.get_workdir()
33 |
34 | # 打包文件夹
35 | archive_name = 'archive.zip' # 替换为要创建的压缩文件名
36 | os.system(f"git archive --format=zip --output={archive_name} HEAD")
37 |
38 | # 解压文件到目标路径
39 | destination_directory = '../../siyuan-widgets/sy-post-publisher' # 替换为目标解压路径
40 | scriptutils.unzip_file(archive_name, destination_directory)
41 |
--------------------------------------------------------------------------------
/scripts/vercel_build.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2023, Terwer . All rights reserved.
2 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3 | #
4 | # This code is free software; you can redistribute it and/or modify it
5 | # under the terms of the GNU General Public License version 2 only, as
6 | # published by the Free Software Foundation. Terwer designates this
7 | # particular file as subject to the "Classpath" exception as provided
8 | # by Terwer in the LICENSE file that accompanied this code.
9 | #
10 | # This code is distributed in the hope that it will be useful, but WITHOUT
11 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 | # version 2 for more details (a copy is included in the LICENSE file that
14 | # accompanied this code).
15 | #
16 | # You should have received a copy of the GNU General Public License version
17 | # 2 along with this work; if not, write to the Free Software Foundation,
18 | # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 | #
20 | # Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
21 | # or visit www.terwer.space if you need additional information or have any
22 | # questions.
23 |
24 | import os
25 |
26 | import scriptutils
27 |
28 | if __name__ == "__main__":
29 | # Switch to the working directory.
30 | scriptutils.switch_workdir()
31 |
32 | # Get the current working directory.
33 | cwd = scriptutils.get_workdir()
34 |
35 | # 获取当前工作目录
36 | print(os.getcwd())
37 |
38 | # 设置环境变量
39 | os.environ['BUILD_TYPE'] = 'vercel'
40 |
41 | os.system("vue-tsc --noEmit && vite build")
42 |
--------------------------------------------------------------------------------
/siyuan/Constants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | export const isSiyuanDev = process.env.DEV_MODE === "true"
27 |
28 | export const siyuanApiToken = ""
29 | export const siyuanApiUrl = ""
30 |
31 | /**
32 | * 动态配置key,全系统唯一,请勿更改
33 | */
34 | export const DYNAMIC_CONFIG_KEY = "dynamic-config"
35 |
--------------------------------------------------------------------------------
/siyuan/appLogger.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { isSiyuanDev } from "./Constants"
27 | import { simpleLogger } from "zhi-lib-base"
28 |
29 | /**
30 | * 使用 eruda 更好的控制日志
31 | */
32 | if (typeof window !== "undefined") {
33 | const econole = (window as any)?.eruda?.get("console")
34 | window.console = isSiyuanDev && econole ? econole : window.console
35 | }
36 |
37 | /**
38 | * 简单的日志接口
39 | */
40 | interface ILogger {
41 | debug: (msg: string, obj?: any) => void
42 | info: (msg: string, obj?: any) => void
43 | warn: (msg: string, obj?: any) => void
44 | error: (msg: string | Error, obj?: any) => void
45 | }
46 |
47 | /**
48 | * 一个简单轻量级的日志记录器
49 | *
50 | * @author terwer
51 | * @version 1.0.0
52 | * @since 1.0.0
53 | */
54 | export const createSiyuanAppLogger = (name: string): ILogger => {
55 | return simpleLogger(name, "publisher", isSiyuanDev)
56 | }
57 |
--------------------------------------------------------------------------------
/siyuan/i18n/en_US.json:
--------------------------------------------------------------------------------
1 | {
2 | "publishTool": "Publisher",
3 | "publish": "Publish",
4 | "preview": "Preview",
5 | "picmanage": "Picture manage",
6 | "picbed": "Upload picture to picbed",
7 | "aitool": "AI tool",
8 | "setting": "Setting",
9 | "settingGeneral": "General setting",
10 | "settingPicbed": "Picbed manage",
11 | "settingPublish": "Publish setting",
12 | "settingPlatform": "Platform setting",
13 | "settingAbout": "About",
14 | "copyPageId": "Copy pageId",
15 | "publisherWidget": "Publisher Widget",
16 | "cancel": "Cancel",
17 | "save": "Save",
18 | "publishTo": "Publish to...",
19 | "publishToQuick": "Publish to..",
20 | "batchSync": "Batch sync",
21 | "publishNormal": "Publish normal",
22 | "extendFunction": "Extended functionality",
23 | "articleManage": "Article manage",
24 | "aiChat": "AI chat",
25 | "aiChatTab": "AI chat tab"
26 | }
--------------------------------------------------------------------------------
/siyuan/i18n/zh_CN.json:
--------------------------------------------------------------------------------
1 | {
2 | "publishTool": "发布工具",
3 | "publish": "发布",
4 | "preview": "发布预览",
5 | "picmanage": "图床管理",
6 | "picbed": "上传图片到图床",
7 | "aitool": "智能工具",
8 | "setting": "通用设置",
9 | "settingGeneral": "偏好设置",
10 | "settingPicbed": "图床设置",
11 | "settingPublish": "发布设置",
12 | "settingPlatform": "平台设置",
13 | "settingAbout": "关于作者",
14 | "copyPageId": "复制文档ID",
15 | "publisherWidget": "挂件版",
16 | "cancel": "取消",
17 | "save": "保存",
18 | "publishTo": "一键发布",
19 | "publishToQuick": "发布到..",
20 | "batchSync": "批量分发",
21 | "publishNormal": "常规发布",
22 | "extendFunction": "扩展功能",
23 | "articleManage": "仪表盘",
24 | "aiChat": "AI聊天",
25 | "aiChatTab": "新页签AI聊天"
26 | }
27 |
--------------------------------------------------------------------------------
/siyuan/index.styl:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | // 图标
27 | // 建议使用 iconfont ,可以调色,可以调整大小
28 | // https://fontawesome.com/search?q=yuque&o=r&m=free
29 | // https://www.iconfont.cn/search/index?searchType=icon&q=cnblogs&page=1&tag=&fromCollection=1&fills=
30 | .iconfont-icon
31 | width 12px
32 | height 12px
33 | margin-right 10px
34 | margin-top 2.5px
35 |
36 | .img-icon img
37 | width 16px !important
38 | height 16px !important
39 | margin-right 8px
40 |
41 | .red
42 | color red
--------------------------------------------------------------------------------
/siyuan/store/config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import PublisherPlugin from "../index"
27 | import { JsonUtil } from "zhi-common"
28 |
29 | /**
30 | * 配置管理类
31 | * 提供配置的加载、保存和删除功能
32 | */
33 | export class ConfigManager {
34 | private static storageKey = "/data/storage/syp/sy-p-plus-cfg.json"
35 |
36 | /**
37 | * 加载配置
38 | *
39 | * @param pluginInstance PublisherPlugin的实例
40 | * @returns 返回配置对象
41 | */
42 | public static async loadConfig(pluginInstance: PublisherPlugin): Promise {
43 | const configStr = await pluginInstance.kernelApi.getFile(this.storageKey, "text")
44 | return JsonUtil.safeParse(configStr, {} as any)
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/siyuan/store/preferenceConfigManager.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import PublisherPlugin from "../index"
27 | import { JsonUtil } from "zhi-common"
28 |
29 | /**
30 | * 配置管理类
31 | * 提供配置的加载、保存和删除功能
32 | */
33 | export class PreferenceConfigManager {
34 | private static storageKey = "/data/storage/syp/publish-preference-cfg.json"
35 | private static cfgKey="publish-preference-cfg"
36 |
37 | /**
38 | * 加载配置
39 | *
40 | * @param pluginInstance PublisherPlugin的实例
41 | * @returns 返回配置对象
42 | */
43 | public static async loadConfig(pluginInstance: PublisherPlugin): Promise {
44 | const configStr = await pluginInstance.kernelApi.getFile(this.storageKey, "text")
45 | const config= JsonUtil.safeParse(configStr, {} as any)
46 | if(!config[this.cfgKey]){
47 | return {}
48 | }
49 | return JsonUtil.safeParse(config[this.cfgKey],{} as any)
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/siyuan/utils/htmlUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | class HtmlUtils {
27 | public static async copyToClipboard(text: string): Promise {
28 | try {
29 | await navigator.clipboard.writeText(text)
30 | return true
31 | } catch (err) {
32 | throw new Error("复制失败!" + err)
33 | }
34 | }
35 | }
36 |
37 | export default HtmlUtils
38 |
--------------------------------------------------------------------------------
/siyuan/utils/pageUtil.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 文档工具类
28 | */
29 | class PageUtil {
30 | public static getPageId() {
31 | // 查找包含 protyle 类但不包含 fn__none 的 div 元素
32 | const protyleElement = document.querySelector("div.protyle:not(.fn__none)")
33 | // 在该 div 元素下查找包含 protyle-title 类的 div 元素,并查找 data-node-id 属性
34 | const protyleTitleElement = protyleElement?.querySelector("div.protyle-title")
35 | // 如果该元素存在 data-node-id 属性,则获取其值并返回,否则返回空字符串
36 | return protyleTitleElement?.hasAttribute("data-node-id") ? protyleTitleElement.getAttribute("data-node-id") : ""
37 | }
38 | }
39 |
40 | export default PageUtil
41 |
--------------------------------------------------------------------------------
/siyuan/utils/pageUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 文档工具类
28 | */
29 | class PageUtils {
30 | public static getPageId() {
31 | // 查找包含 protyle 类但不包含 fn__none 的 div 元素
32 | const protyleElement = document.querySelector("div.protyle:not(.fn__none)")
33 | // 在该 div 元素下查找包含 protyle-title 类的 div 元素,并查找 data-node-id 属性
34 | const protyleTitleElement = protyleElement?.querySelector("div.protyle-title")
35 | // 如果该元素存在 data-node-id 属性,则获取其值并返回,否则返回空字符串
36 | return protyleTitleElement?.hasAttribute("data-node-id") ? protyleTitleElement.getAttribute("data-node-id") : ""
37 | }
38 | }
39 |
40 | export default PageUtils
41 |
--------------------------------------------------------------------------------
/siyuan/utils/utils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import KernelApi from "../api/kernel-api"
27 | import { StrUtil } from "zhi-common"
28 |
29 | /**
30 | * 文件是否存在
31 | *
32 | * @param kernelApi - kernelApi
33 | * @param p - 路径
34 | * @param type - 类型
35 | */
36 | export const isSiyuanFileExists = async (kernelApi: KernelApi, p: string, type: "text" | "json") => {
37 | try {
38 | const res = await kernelApi.getFile(p, type)
39 | if (type === "text") {
40 | return !StrUtil.isEmptyString(res)
41 | }
42 | return res !== null
43 | } catch {
44 | return false
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/App.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/src/adaptors/api/base/commonBlogPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { BlogPlaceholder } from "zhi-blog-api"
27 |
28 | /**
29 | * Metaweblog 操作提示
30 | */
31 | export class CommonBlogPlaceholder extends BlogPlaceholder {}
32 |
--------------------------------------------------------------------------------
/src/adaptors/api/base/github/commonGithubPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Github 操作提示
30 | */
31 | class CommonGithubPlaceholder extends CommonBlogPlaceholder {}
32 |
33 | export { CommonGithubPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/base/gitlab/commonGitlabConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubConfig } from "~/src/adaptors/api/base/github/commonGithubConfig.ts"
27 |
28 | /**
29 | * CommonGitlabConfig 类用于存储 Gitlab 相关配置信息
30 | */
31 | class CommonGitlabConfig extends CommonGithubConfig {}
32 |
33 | export { CommonGitlabConfig }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/base/gitlab/commonGitlabPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Gitlab 操作提示
30 | */
31 | class CommonGitlabPlaceholder extends CommonBlogPlaceholder {}
32 |
33 | export { CommonGitlabPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/base/metaweblog/metaweblogConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 预定义 Metaweblog 变量
28 | *
29 | * @author terwer
30 | * @version 0.9.0
31 | * @since 0.9.0
32 | */
33 | class MetaweblogConstants {
34 | public static METHOD_GET_USERS_BLOGS = "metaWeblog.getUsersBlogs"
35 | public static METHOD_NEW_POST = "metaWeblog.newPost"
36 | public static METHOD_EDIT_POST = "metaWeblog.editPost"
37 | public static METHOD_DELETE_POST = "metaWeblog.deletePost"
38 | public static METHOD_GET_RECENT_POSTS = "metaWeblog.getRecentPosts"
39 | public static METHOD_GET_POST = "metaWeblog.getPost"
40 | public static METHOD_GET_CATEGORIES = "metaWeblog.getCategories"
41 | public static METHOD_NEW_MEDIA_OBJECT = "metaWeblog.newMediaObject"
42 | }
43 |
44 | export { MetaweblogConstants }
45 |
--------------------------------------------------------------------------------
/src/adaptors/api/base/metaweblog/metaweblogPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Metaweblog 操作提示
30 | */
31 | export class MetaweblogPlaceholder extends CommonBlogPlaceholder {}
32 |
--------------------------------------------------------------------------------
/src/adaptors/api/cnblogs/cnblogsConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 预定义博客园变量
28 | *
29 | * @author terwer
30 | * @version 0.9.0
31 | * @since 0.9.0
32 | */
33 | class CnblogsConstants {
34 | // 博客园不支持 metaWeblog.getUsersBlogs 只支持 blogger.getUsersBlogs
35 | public static METHOD_GET_USERS_BLOGS = "blogger.getUsersBlogs"
36 | // 博客园不支持 metaWeblog.deletePost 只支持 blogger.deletePost
37 | public static METHOD_DELETE_POST = "blogger.deletePost"
38 | }
39 |
40 | export { CnblogsConstants }
41 |
--------------------------------------------------------------------------------
/src/adaptors/api/cnblogs/cnblogsPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { MetaweblogPlaceholder } from "~/src/adaptors/api/base/metaweblog/metaweblogPlaceholder.ts"
27 |
28 | /**
29 | * 博客园操作提示
30 | */
31 | class CnblogsPlaceholder extends MetaweblogPlaceholder {}
32 |
33 | export { CnblogsPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/cnblogs/docs.md:
--------------------------------------------------------------------------------
1 | # CnblogsApiAdaptor
2 |
3 | - 统一目录结构
4 |
5 | 所有的适配器目录约定如下:
6 |
7 | ```
8 | xxxApiAdaptor
9 | xxxConfig
10 | useXxxApi
11 |
12 | xxxConstants
13 | xxxPlaceholder
14 | docs.md
15 | ```
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-hexo/gitlabhexoPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { HexoPlaceholder } from "~/src/adaptors/api/hexo/hexoPlaceholder.ts"
27 |
28 | class GitlabhexoPlaceholder extends HexoPlaceholder {}
29 |
30 | export { GitlabhexoPlaceholder }
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-hexo/gitlabhexoYamlConverterAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { HexoYamlConverterAdaptor } from "~/src/adaptors/api/hexo/hexoYamlConverterAdaptor.ts"
27 |
28 | /**
29 | * Hexo平台的YAML解析器
30 | *
31 | * @author terwer
32 | * @since 0.8.1
33 | */
34 | class GitlabhexoYamlConverterAdaptor extends HexoYamlConverterAdaptor {}
35 |
36 | export { GitlabhexoYamlConverterAdaptor }
37 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-hugo/gitlabhugoPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { HugoPlaceholder } from "~/src/adaptors/api/hugo/hugoPlaceholder.ts"
27 |
28 | class GitlabhugoPlaceholder extends HugoPlaceholder {}
29 |
30 | export { GitlabhugoPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-hugo/gitlabhugoYamlConverterAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { HugoYamlConverterAdaptor } from "~/src/adaptors/api/hugo/hugoYamlConverterAdaptor.ts"
27 |
28 | /**
29 | * Hugo平台的YAML解析器
30 | *
31 | * @author terwer
32 | * @since 1.14.0
33 | */
34 | class GitlabhugoYamlConverterAdaptor extends HugoYamlConverterAdaptor {}
35 |
36 | export { GitlabhugoYamlConverterAdaptor }
37 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-jekyll/gitlabjekyllPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { JekyllPlaceholder } from "~/src/adaptors/api/jekyll/jekyllPlaceholder.ts"
27 |
28 | class GitlabjekyllPlaceholder extends JekyllPlaceholder {}
29 |
30 | export { GitlabjekyllPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-jekyll/gitlabjekyllYamlConverterAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { JekyllYamlConverterAdaptor } from "~/src/adaptors/api/jekyll/jekyllYamlConverterAdaptor.ts"
27 |
28 | /**
29 | * Jekyll平台的YAML解析器
30 | *
31 | * @author terwer
32 | * @since 1.14.0
33 | */
34 | class GitlabjekyllYamlConverterAdaptor extends JekyllYamlConverterAdaptor {}
35 |
36 | export { GitlabjekyllYamlConverterAdaptor }
37 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-vitepress/gitlabvitepressPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { VitepressPlaceholder } from "~/src/adaptors/api/vitepress/vitepressPlaceholder.ts"
27 |
28 | class GitlabvitepressPlaceholder extends VitepressPlaceholder {}
29 |
30 | export { GitlabvitepressPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-vitepress/gitlabvitepressYamlConverterAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { VitepressYamlConverterAdaptor } from "~/src/adaptors/api/vitepress/vitepressYamlConverterAdaptor.ts"
27 |
28 | /**
29 | * Vitepress 平台的YAML解析器
30 | *
31 | * @author terwer
32 | * @since 0.8.1
33 | */
34 | class GitlabvitepressYamlConverterAdaptor extends VitepressYamlConverterAdaptor {}
35 |
36 | export { GitlabvitepressYamlConverterAdaptor }
37 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-vuepress/gitlabvuepressPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { VuepressPlaceholder } from "~/src/adaptors/api/vuepress/vuepressPlaceholder.ts"
27 |
28 | class GitlabvuepressPlaceholder extends VuepressPlaceholder {}
29 |
30 | export { GitlabvuepressPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-vuepress/gitlabvuepressYamlConverterAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { VuepressYamlConverterAdaptor } from "~/src/adaptors/api/vuepress/vuepressYamlConverterAdaptor.ts"
27 |
28 | /**
29 | * Gitlabvuepress平台的YAML解析器
30 | *
31 | * @author terwer
32 | * @since 1.14.0
33 | */
34 | class GitlabvuepressYamlConverterAdaptor extends VuepressYamlConverterAdaptor {}
35 |
36 | export { GitlabvuepressYamlConverterAdaptor }
37 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-vuepress2/gitlabvuepress2PlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { Vuepress2Placeholder } from "~/src/adaptors/api/vuepress2/vuepress2Placeholder.ts"
27 |
28 | class Gitlabvuepress2Placeholder extends Vuepress2Placeholder {}
29 |
30 | export { Gitlabvuepress2Placeholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/gitlab-vuepress2/gitlabvuepress2YamlConverterAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { Vuepress2YamlConverterAdaptor } from "~/src/adaptors/api/vuepress2/vuepress2YamlConverterAdaptor.ts"
27 |
28 | /**
29 | * Vuepress2 平台的YAML解析器
30 | *
31 | * @author terwer
32 | * @since 0.8.1
33 | */
34 | class Gitlabvuepress2YamlConverterAdaptor extends Vuepress2YamlConverterAdaptor {}
35 |
36 | export { Gitlabvuepress2YamlConverterAdaptor }
37 |
--------------------------------------------------------------------------------
/src/adaptors/api/halo/HaloPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Halo 配置提示
30 | */
31 | class HaloPlaceholder extends CommonBlogPlaceholder {}
32 |
33 | export { HaloPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/halo/HaloPostMeta.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { DateUtil } from "zhi-common"
27 |
28 | /**
29 | * Halo 平台的一些元数据
30 | *
31 | * @author terwer
32 | * @version 1.15.0
33 | * @since 1.15.0
34 | */
35 | class HaloPostMeta {
36 | public slug: string
37 | public name: string
38 | public year: string
39 | public month: string
40 | public day: string
41 |
42 | constructor(slug: string, name: string, dateCreated: Date) {
43 | this.slug = slug
44 | this.name = name
45 |
46 | const created = DateUtil.formatIsoToZhDate(dateCreated.toISOString(), true)
47 | const datearr = created.split(" ")[0]
48 | const numarr = datearr.split("-")
49 | this.year = numarr[0]
50 | this.month = numarr[1]
51 | this.day = numarr[2]
52 | }
53 | }
54 |
55 | export { HaloPostMeta }
56 |
--------------------------------------------------------------------------------
/src/adaptors/api/halo/haloUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import * as yaml from "js-yaml"
27 | import * as matter from "gray-matter"
28 |
29 | /**
30 | * Halo 平台工具类
31 | *
32 | * @author terwer
33 | * @version 1.15.0
34 | * @since 1.15.0
35 | */
36 | class HaloUtils {
37 | private static options = {
38 | engines: {
39 | yaml: {
40 | parse: (input: string) => yaml.load(input) as object,
41 | stringify: (data: object) => {
42 | return yaml.dump(data, {
43 | styles: { "!!null": "empty" },
44 | })
45 | },
46 | },
47 | },
48 | }
49 |
50 | public static readMatter(content: string) {
51 | return matter(content, this.options)
52 | }
53 |
54 | public static mergeMatter(content: string, data: object) {
55 | return matter.stringify(content, data, this.options)
56 | }
57 | }
58 |
59 | export default HaloUtils
60 |
--------------------------------------------------------------------------------
/src/adaptors/api/hexo/hexoPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubPlaceholder } from "~/src/adaptors/api/base/github/commonGithubPlaceholder.ts"
27 |
28 | class HexoPlaceholder extends CommonGithubPlaceholder {}
29 |
30 | export { HexoPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/hugo/hugoPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubPlaceholder } from "~/src/adaptors/api/base/github/commonGithubPlaceholder.ts"
27 |
28 | class HugoPlaceholder extends CommonGithubPlaceholder {}
29 |
30 | export { HugoPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/jekyll/jekyllPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubPlaceholder } from "~/src/adaptors/api/base/github/commonGithubPlaceholder.ts"
27 |
28 | class JekyllPlaceholder extends CommonGithubPlaceholder {}
29 |
30 | export { JekyllPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/jvue/jvueApiAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { MetaweblogBlogApiAdaptor } from "~/src/adaptors/api/base/metaweblog/metaweblogBlogApiAdaptor.ts"
27 | import { PublisherAppInstance } from "~/src/publisherAppInstance.ts"
28 | import { JvueConfig } from "~/src/adaptors/api/jvue/jvueConfig.ts"
29 | import { createAppLogger } from "~/src/utils/appLogger.ts"
30 |
31 | /**
32 | * Typecho API 适配器
33 | *
34 | * @author terwer
35 | * @version 0.9.0
36 | * @since 0.9.0
37 | */
38 | class JvueApiAdaptor extends MetaweblogBlogApiAdaptor {
39 | /**
40 | * 初始化 Typecho API 适配器
41 | *
42 | * @param appInstance 应用实例
43 | * @param cfg 配置项
44 | */
45 | constructor(appInstance: PublisherAppInstance, cfg: JvueConfig) {
46 | super(appInstance, cfg)
47 | this.logger = createAppLogger("typecho-api-adaptor")
48 | this.cfg.blogid = "jvue"
49 | }
50 | }
51 |
52 | export { JvueApiAdaptor }
53 |
--------------------------------------------------------------------------------
/src/adaptors/api/jvue/jvuePlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { MetaweblogPlaceholder } from "~/src/adaptors/api/base/metaweblog/metaweblogPlaceholder.ts"
27 |
28 | /**
29 | * Jvue 操作提示
30 | */
31 | class JvuePlaceHolder extends MetaweblogPlaceholder {}
32 |
33 | export { JvuePlaceHolder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/notion/notionPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Notion 配置提示
30 | */
31 | class NotionPlaceholder extends CommonBlogPlaceholder {}
32 |
33 | export { NotionPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/telegraph/telegraphConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogConfig } from "~/src/adaptors/api/base/commonBlogConfig.ts"
27 | import { PasswordType } from "zhi-blog-api"
28 |
29 | /**
30 | * Telegraph 配置
31 | */
32 | class TelegraphConfig extends CommonBlogConfig {
33 | constructor(telegraphUrl: string, telegraphToken: string, middlewareUrl?: string) {
34 | super(telegraphUrl, "https://edit.telegra.ph", "", telegraphToken, middlewareUrl)
35 |
36 | this.passwordType = PasswordType.PasswordType_Token
37 | this.previewUrl = "/[postid]"
38 | this.allowPreviewUrlChange = false
39 | }
40 | }
41 |
42 | export { TelegraphConfig }
43 |
--------------------------------------------------------------------------------
/src/adaptors/api/telegraph/telegraphPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Telegraph 配置提示
30 | */
31 | class TelegraphPlaceholder extends CommonBlogPlaceholder {}
32 |
33 | export { TelegraphPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/typecho/docs.md:
--------------------------------------------------------------------------------
1 | # TypechoApiAdaptor
--------------------------------------------------------------------------------
/src/adaptors/api/typecho/typechoApiAdaptor.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { PublisherAppInstance } from "~/src/publisherAppInstance.ts"
27 | import { createAppLogger } from "~/src/utils/appLogger.ts"
28 | import { TypechoConfig } from "~/src/adaptors/api/typecho/typechoConfig.ts"
29 | import { MetaweblogBlogApiAdaptor } from "~/src/adaptors/api/base/metaweblog/metaweblogBlogApiAdaptor.ts"
30 |
31 | /**
32 | * Typecho API 适配器
33 | *
34 | * @author terwer
35 | * @version 0.9.0
36 | * @since 0.9.0
37 | */
38 | class TypechoApiAdaptor extends MetaweblogBlogApiAdaptor {
39 | /**
40 | * 初始化 Typecho API 适配器
41 | *
42 | * @param appInstance 应用实例
43 | * @param cfg 配置项
44 | */
45 | constructor(appInstance: PublisherAppInstance, cfg: TypechoConfig) {
46 | super(appInstance, cfg)
47 | this.logger = createAppLogger("typecho-api-adaptor")
48 | this.cfg.blogid = "typecho"
49 | }
50 | }
51 | export { TypechoApiAdaptor }
52 |
--------------------------------------------------------------------------------
/src/adaptors/api/typecho/typechoConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 预定义 Typecho 变量
28 | *
29 | * @author terwer
30 | * @version 0.9.0
31 | * @since 0.9.0
32 | */
33 | class TypechoConstants {
34 | public static METHOD_GET_USERS_BLOGS = "metaWeblog.getUsersBlogs"
35 | }
36 |
37 | export { TypechoConstants }
38 |
--------------------------------------------------------------------------------
/src/adaptors/api/typecho/typechoPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { MetaweblogPlaceholder } from "~/src/adaptors/api/base/metaweblog/metaweblogPlaceholder.ts"
27 |
28 | /**
29 | * Typecho 操作提示
30 | */
31 | class TypechoPlaceholder extends MetaweblogPlaceholder {}
32 |
33 | export { TypechoPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/vitepress/vitepressPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubPlaceholder } from "~/src/adaptors/api/base/github/commonGithubPlaceholder.ts"
27 |
28 | class VitepressPlaceholder extends CommonGithubPlaceholder {}
29 |
30 | export { VitepressPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/vuepress/vuepressPlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubPlaceholder } from "~/src/adaptors/api/base/github/commonGithubPlaceholder.ts"
27 |
28 | class VuepressPlaceholder extends CommonGithubPlaceholder {}
29 |
30 | export { VuepressPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/vuepress2/vuepress2PlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonGithubPlaceholder } from "~/src/adaptors/api/base/github/commonGithubPlaceholder.ts"
27 |
28 | class Vuepress2Placeholder extends CommonGithubPlaceholder {}
29 |
30 | export { Vuepress2Placeholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/api/wordpress/docs.md:
--------------------------------------------------------------------------------
1 | # WordpressApiAdaptor
--------------------------------------------------------------------------------
/src/adaptors/api/wordpress/wordpressConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 预定义 WordPress 变量
28 | *
29 | * @author terwer
30 | * @version 0.9.0
31 | * @since 0.9.0
32 | */
33 | class WordpressConstants {}
34 |
35 | export { WordpressConstants }
36 |
--------------------------------------------------------------------------------
/src/adaptors/api/wordpress/wordpressPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { MetaweblogPlaceholder } from "~/src/adaptors/api/base/metaweblog/metaweblogPlaceholder.ts"
27 |
28 | /**
29 | * WordPress 操作提示
30 | */
31 | class WordpressPlaceholder extends MetaweblogPlaceholder {}
32 |
33 | export { WordpressPlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/api/wordpress/wordpressUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { createAppLogger } from "~/src/utils/appLogger.ts"
27 |
28 | /**
29 | * 用于处理WordPress相关操作的实用工具类
30 | */
31 | class WordpressUtils {
32 | private static logger = createAppLogger("wordpress-utils")
33 |
34 | /**
35 | * 解析给定的主页地址并生成相应的apiUrl地址
36 | *
37 | * @param home - 主页地址
38 | */
39 | public static parseHomeAndUrl(home: string): { home: string; apiUrl: string } {
40 | this.logger.debug(`Parsing Home address: ${home}`)
41 | // 解析主页地址
42 | let apiUrl = ""
43 | if (home.endsWith("/xmlrpc.php")) {
44 | apiUrl = home
45 | home = home.replace("/xmlrpc.php", "")
46 | } else {
47 | home = home.replace(/\/$/, "")
48 | apiUrl = `${home}/xmlrpc.php`
49 | }
50 |
51 | this.logger.debug(`Parse result: home=${home}, apiUrl=${apiUrl}`)
52 | return { home, apiUrl }
53 | }
54 | }
55 |
56 | export default WordpressUtils
57 |
--------------------------------------------------------------------------------
/src/adaptors/api/yuque/yuquePlaceHolder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonBlogPlaceholder } from "~/src/adaptors/api/base/commonBlogPlaceholder.ts"
27 |
28 | /**
29 | * Yuque 配置提示
30 | */
31 | class YuquePlaceholder extends CommonBlogPlaceholder {}
32 |
33 | export { YuquePlaceholder }
34 |
--------------------------------------------------------------------------------
/src/adaptors/web/base/commonWebPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { WebPlaceholder } from "zhi-blog-api"
27 |
28 | /**
29 | * 网页授权操作提示
30 | */
31 | export class CommonWebPlaceholder extends WebPlaceholder {}
32 |
--------------------------------------------------------------------------------
/src/adaptors/web/csdn/csdnConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebConfig } from "~/src/adaptors/web/base/commonWebConfig.ts"
27 | import { CategoryTypeEnum, PageTypeEnum, PasswordType } from "zhi-blog-api"
28 |
29 | /**
30 | * CSDN配置
31 | */
32 | export class CsdnConfig extends CommonWebConfig {
33 | constructor(username: string, password: string, middlewareUrl?: string) {
34 | super("https://blog.csdn.net", "https://bizapi.csdn.net", username, password, middlewareUrl)
35 | this.previewUrl = "/[userid]/article/details/[postid]"
36 | this.pageType = PageTypeEnum.Markdown
37 | this.usernameEnabled = false
38 | this.passwordType = PasswordType.PasswordType_Cookie
39 | this.tagEnabled = true
40 | this.cateEnabled = true
41 | this.categoryType = CategoryTypeEnum.CategoryType_Multi
42 | this.allowCateChange = true
43 | this.knowledgeSpaceEnabled = false
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/adaptors/web/csdn/csdnPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebPlaceholder } from "~/src/adaptors/web/base/commonWebPlaceholder.ts"
27 |
28 | class CsdnPlaceholder extends CommonWebPlaceholder {}
29 |
30 | export { CsdnPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/web/flowus/flowusPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebPlaceholder } from "~/src/adaptors/web/base/commonWebPlaceholder.ts"
27 |
28 | class FlowusPlaceholder extends CommonWebPlaceholder {}
29 |
30 | export { FlowusPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/web/jianshu/docs.md:
--------------------------------------------------------------------------------
1 | # JianshuWebAdaptor
2 |
--------------------------------------------------------------------------------
/src/adaptors/web/jianshu/jianshuPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebPlaceholder } from "~/src/adaptors/web/base/commonWebPlaceholder.ts"
27 |
28 | class JianshuPlaceholder extends CommonWebPlaceholder {}
29 |
30 | export { JianshuPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/web/juejin/docs.md:
--------------------------------------------------------------------------------
1 | # JuejinWebAdaptor
2 |
--------------------------------------------------------------------------------
/src/adaptors/web/juejin/juejinPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebPlaceholder } from "~/src/adaptors/web/base/commonWebPlaceholder.ts"
27 |
28 | class JuejinPlaceholder extends CommonWebPlaceholder {}
29 |
30 | export { JuejinPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/web/wechat/docs.md:
--------------------------------------------------------------------------------
1 | # WechatWebAdaptor
--------------------------------------------------------------------------------
/src/adaptors/web/wechat/wechatConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebConfig } from "~/src/adaptors/web/base/commonWebConfig.ts"
27 | import { PageTypeEnum, PasswordType } from "zhi-blog-api"
28 |
29 | /**
30 | * 微信公众号配置
31 | */
32 | export class WechatConfig extends CommonWebConfig {
33 | constructor(username: string, password: string, middlewareUrl?: string) {
34 | super("https://mp.weixin.qq.com", "https://mp.weixin.qq.com/cgi-bin/appmsg", username, password, middlewareUrl)
35 |
36 | this.previewUrl =
37 | "/cgi-bin/appmsg?t=media/appmsg_edit&action=edit&type=77&appmsgid=[postid]&token=[token]&lang=zh_CN"
38 | this.pageType = PageTypeEnum.Html
39 | this.passwordType = PasswordType.PasswordType_Cookie
40 | this.usernameEnabled = false
41 | this.tagEnabled = false
42 | this.cateEnabled = false
43 | this.knowledgeSpaceEnabled = false
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/adaptors/web/wechat/wechatPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebPlaceholder } from "~/src/adaptors/web/base/commonWebPlaceholder.ts"
27 |
28 | class WechatPlaceholder extends CommonWebPlaceholder {}
29 |
30 | export { WechatPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/adaptors/web/xiaohongshu/xiaohongshuConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebConfig } from "~/src/adaptors/web/base/commonWebConfig.ts"
27 | import { PageTypeEnum, PasswordType } from "zhi-blog-api"
28 |
29 | /**
30 | * 小红书配置
31 | */
32 | class XiaohongshuConfig extends CommonWebConfig {
33 | constructor(username: string, password: string, middlewareUrl?: string) {
34 | super("https://creator.xiaohongshu.com", "https://creator.xiaohongshu.com", username, password, middlewareUrl)
35 |
36 | this.previewUrl = "/p/[postid]"
37 | this.pageType = PageTypeEnum.Markdown
38 | this.passwordType = PasswordType.PasswordType_Cookie
39 | this.usernameEnabled = false
40 | // 小红书不支持标签
41 | this.tagEnabled = false
42 | // 小红书不支持分类
43 | this.cateEnabled = false
44 | // 小红书没有知识空间
45 | this.knowledgeSpaceEnabled = false
46 | }
47 | }
48 |
49 | export { XiaohongshuConfig }
50 |
--------------------------------------------------------------------------------
/src/adaptors/web/zhihu/zhihuPlaceholder.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { CommonWebPlaceholder } from "~/src/adaptors/web/base/commonWebPlaceholder.ts"
27 |
28 | class ZhihuPlaceholder extends CommonWebPlaceholder {}
29 |
30 | export { ZhihuPlaceholder }
31 |
--------------------------------------------------------------------------------
/src/ai/AiConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * AI 常量
28 | *
29 | * https://github.com/transitive-bullshit/chatgpt-api/blob/main/src/chatgpt-api.ts#L443
30 | *
31 | * Use up to 4096 tokens (prompt + response), but try to leave 1000 tokens
32 | * for the response.
33 | */
34 | enum AiConstants {
35 | /**
36 | * 最大输入长度
37 | */
38 | MAX_INPUT_TOKEN_LENGTH = 3000,
39 |
40 | /**
41 | * 最大指令长度
42 | */
43 | // MAX_PROMPT_LENGTH = 96,
44 |
45 | /**
46 | * 标题返回字符限制
47 | */
48 | // MAX_RESP_TITLE_LENGTH = 255,
49 | }
50 |
51 | export { AiConstants }
52 |
--------------------------------------------------------------------------------
/src/assets/README.md:
--------------------------------------------------------------------------------
1 | [中文](README_zh_CN.md)
2 |
3 | # sy-post-publisher
4 |
5 | 
6 |
7 | Publish [siyuan-note](https://github.com/siyuan-note/siyuan) articles to supported platforms
8 |
9 | 0.9.0+ It is highly recommended to use with the [Publishing Tool](https://github.com/terwer/siyuan-plugin-publisher) plugin for a better experience~
10 |
11 | 0.8.1- For the following versions, please see [this description](./README_0_8_1_zh_CN.md)
12 |
13 | ## New widget beta
14 |
15 | Note: This version will be used with the plugin on one line. Please think about it before upgrading. This version is in closed beta, currently only available in Blog Park and Yuque, welcome to submit issues and PRs.
16 |
17 | Features are currently available
18 |
19 | - Dynamic addition of new platforms
20 | - Platform disable enabled
21 | - Platform settings, available via the plugin menu [Publish Settings].
22 | - Single release with plugins, providing a friendly plugin menu
23 | - Bulk distribution, available via plugin menu general release
24 |
25 | The platform is currently supported
26 |
27 | - [X] Cnblogs
28 | - [X] yuque
29 |
30 | Refer to https://github.com/terwer/siyuan-plugin-publisher/blob/main/README_zh_CN.md for subsequent support
31 |
32 | ## Donate
33 |
34 | If you approve of this project, please have a cup of coffee, which will encourage me to keep updating and creating more useful tools~
35 |
36 | ### Wechat
37 |
38 |
35 |
36 |
37 |
41 |
--------------------------------------------------------------------------------
/src/components/set/SetIndex.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/components/set/publish/singleplatform/base/impl/CustomWebSetting.vue:
--------------------------------------------------------------------------------
1 |
25 |
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/src/components/set/publish/singleplatform/base/impl/MetaweblogSetting.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/src/components/set/publish/singleplatform/metaweblog/OthermetaSetting.vue:
--------------------------------------------------------------------------------
1 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/src/composables/useVueI18n.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 | import { useI18n } from "vue-i18n"
26 |
27 | /**
28 | * 多语言封装,解决 CSP
29 | *
30 | * https://github.com/intlify/vue-i18n-next/issues/543
31 | */
32 | export const useVueI18n = () => {
33 | const { messages, locale } = useI18n()
34 |
35 | const translate = (key) => {
36 | const localeMessages = messages.value?.[locale.value]
37 | return localeMessages[key] || key
38 | }
39 |
40 | return { t: translate, locale }
41 | }
42 |
--------------------------------------------------------------------------------
/src/composables/useVueRouter.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023-2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { createRouter, createWebHashHistory, Router } from "vue-router"
27 | import { routeConfig } from "~/src/routes/routeConfig.ts"
28 |
29 | export const useVueRouter = (): Router => {
30 | return createRouter({
31 | history: createWebHashHistory(),
32 | routes: routeConfig,
33 | })
34 | }
35 |
--------------------------------------------------------------------------------
/src/extensions/images/icon128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/src/extensions/images/icon128.png
--------------------------------------------------------------------------------
/src/extensions/images/icon16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/src/extensions/images/icon16.png
--------------------------------------------------------------------------------
/src/extensions/images/icon32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/src/extensions/images/icon32.png
--------------------------------------------------------------------------------
/src/extensions/images/icon48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/terwer/sy-post-publisher/af92260e9ee5f5237611dc7b8e69604f9b0dd21e/src/extensions/images/icon48.png
--------------------------------------------------------------------------------
/src/extensions/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "思源笔记发布辅助工具",
3 | "version": "0.12.0",
4 | "manifest_version": 3,
5 | "author": "terwer",
6 | "icons": {
7 | "16": "images/icon16.png",
8 | "32": "images/icon32.png",
9 | "48": "images/icon48.png",
10 | "128": "images/icon128.png"
11 | },
12 | "description": "思源笔记发布辅助工具,支持博客式只读浏览,多平台文章发布。",
13 | "background": {
14 | "service_worker": "background.js"
15 | },
16 | "host_permissions": [
17 | "*://*/*"
18 | ],
19 | "web_accessible_resources": [
20 | {
21 | "resources": [
22 | "index.html"
23 | ],
24 | "matches": [
25 | ""
26 | ]
27 | }
28 | ],
29 | "action": {
30 | "default_icon": {
31 | "16": "images/icon16.png",
32 | "32": "images/icon32.png",
33 | "48": "images/icon48.png",
34 | "128": "images/icon128.png"
35 | },
36 | "default_popup": "index.html"
37 | },
38 | "content_security_policy": {
39 | "extension_pages": "script-src 'self' 'wasm-unsafe-eval';font-src 'self' https://static-rs-terwer.oss-cn-beijing.aliyuncs.com;"
40 | }
41 | }
--------------------------------------------------------------------------------
/src/extensions/mv2/manifest-v2-for-firefox.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "开发版 - 思源笔记发布辅助工具",
3 | "version": "0.12.0",
4 | "manifest_version": 2,
5 | "author": "terwer",
6 | "icons": {
7 | "16": "images/icon16.png",
8 | "32": "images/icon32.png",
9 | "48": "images/icon48.png",
10 | "128": "images/icon128.png"
11 | },
12 | "description": "思源笔记发布辅助工具,支持博客式只读浏览,多平台文章发布。",
13 | "applications": {
14 | "gecko": {
15 | "id": "terwer@terwer.space",
16 | "strict_min_version": "47.0"
17 | }
18 | },
19 | "background": {
20 | "scripts": [
21 | "background.js"
22 | ]
23 | },
24 | "web_accessible_resources": [
25 | "blog/index.html",
26 | "detail/index.html",
27 | "publish/index.html",
28 | "index.html"
29 | ],
30 | "browser_action": {
31 | "default_icon": {
32 | "16": "images/icon16.png",
33 | "32": "images/icon32.png",
34 | "48": "images/icon48.png",
35 | "128": "images/icon128.png"
36 | },
37 | "default_popup": "blog/index.html"
38 | }
39 | }
--------------------------------------------------------------------------------
/src/layouts/AppLayout.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
40 |
--------------------------------------------------------------------------------
/src/layouts/default/AppLayoutDefault.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
40 |
41 |
49 |
--------------------------------------------------------------------------------
/src/layouts/default/DefaultHeader.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
27 |
28 |
29 |
30 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/locales/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { createI18n } from "vue-i18n"
27 | import zh_CN from "./zh_CN"
28 | import en_US from "./en_US"
29 |
30 | const i18n = createI18n({
31 | legacy: false,
32 | locale: "zh_CN", // 默认显示语言
33 | fallbackLocale: "en_US", // 次要语言
34 | messages: {
35 | zh_CN,
36 | en_US,
37 | },
38 | })
39 |
40 | export default i18n
41 |
--------------------------------------------------------------------------------
/src/main.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { createVueApp } from "./bootstrap"
27 |
28 | import "element-plus/dist/index.css"
29 | import "element-plus/theme-chalk/dark/css-vars.css"
30 |
31 | ;(async () => {
32 | const instance = await createVueApp()
33 | const app = instance.app
34 |
35 | // 挂载 vue app
36 | app.mount("#app")
37 | })()
38 |
--------------------------------------------------------------------------------
/src/models/aiPrompt.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 表示一个 AI 提示的类,用于存储标题、内容和描述等信息
28 | *
29 | * 使用:const prompt = new AiPrompt("Generate Blog Post",
30 | * "Write a blog post about the benefits of AI.",
31 | * "Generate a blog post discussing the various advantages of artificial intelligence in different industries.");
32 | */
33 | class AiPrompt {
34 | /**
35 | * 提示的标题
36 | */
37 | title: string
38 |
39 | /**
40 | * 提示的内容
41 | */
42 | content: string
43 |
44 | /**
45 | * 提示的描述
46 | */
47 | description: string
48 |
49 | /**
50 | * 创建一个 AiPrompt 的新实例
51 | *
52 | * @param title - 提示的标题
53 | * @param content - 提示的内容
54 | * @param description - 提示的描述
55 | */
56 | constructor(title: string, content: string, description: string) {
57 | this.title = title
58 | this.content = content
59 | this.description = description
60 | }
61 | }
62 |
63 | export { AiPrompt }
64 |
--------------------------------------------------------------------------------
/src/models/distributionPattern.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 枚举,表示不同的分发模式
28 | */
29 | enum DistributionPattern {
30 | /**
31 | * 表示 "覆盖" 模式
32 | */
33 | Override = "Override",
34 |
35 | /**
36 | * 表示 "合并" 模式
37 | */
38 | Merge = "Merge",
39 | }
40 |
41 | export { DistributionPattern }
42 |
--------------------------------------------------------------------------------
/src/models/methodEnum.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 方法定义
28 | */
29 | export enum MethodEnum {
30 | /**
31 | * 新增
32 | */
33 | METHOD_ADD = "add",
34 |
35 | /**
36 | * 编辑
37 | */
38 | METHOD_EDIT = "edit",
39 | }
40 |
--------------------------------------------------------------------------------
/src/models/pageEditMode.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 编辑模式
28 | *
29 | * @author terwer
30 | * @since 0.6.0
31 | */
32 | export enum PageEditMode {
33 | /**
34 | * 简洁模式
35 | */
36 | EditMode_simple,
37 | /**
38 | * 详细模式
39 | */
40 | EditMode_complex,
41 | /**
42 | * 源码模式
43 | */
44 | EditMode_source,
45 | }
46 |
--------------------------------------------------------------------------------
/src/models/platformMetadata.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 表示与平台相关的元数据
28 | *
29 | * @author terwer
30 | * @since 1.18.0
31 | */
32 | class PlatformMetadata {
33 | metadata: Record
34 | }
35 |
36 | /**
37 | * 表示元数据项
38 | *
39 | * @author terwer
40 | * @since 1.18.0
41 | */
42 | class MetadataItem {
43 | /**
44 | * 标签列表
45 | */
46 | public tags: string[]
47 |
48 | /**
49 | * 分类列表
50 | */
51 | public categories: string[]
52 |
53 | /**
54 | * 模板列表
55 | */
56 | public templates: string[]
57 |
58 | constructor() {
59 | this.tags = []
60 | this.categories = []
61 | this.templates = []
62 | }
63 | }
64 |
65 | export { PlatformMetadata, MetadataItem }
66 |
--------------------------------------------------------------------------------
/src/models/sourceContentShowType.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * 源码显示类型
28 | */
29 | export enum SourceContentShowType {
30 | YAML,
31 | MD_CONTENT,
32 | YAML_MD_CONTENT,
33 | HTML_CONTENT,
34 | }
35 |
--------------------------------------------------------------------------------
/src/pages/BatchPublish.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/pages/Setting.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/pages/SinglePublish.vue:
--------------------------------------------------------------------------------
1 |
25 |
26 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/platforms/dynamicConfig.spec.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import {
27 | getNewPlatformKey,
28 | getSubPlatformTypeByKey,
29 | PlatformType,
30 | SubPlatformType,
31 | } from "~/src/platforms/dynamicConfig.ts"
32 | import { describe, it, expect } from "vitest"
33 |
34 | describe("test dynamicConfig", () => {
35 | it("test getSubPlatformTypeByKey", () => {
36 | // const key = "custom_Zhihu-z2jom6d"
37 | const key = "custom_Zhihu"
38 | const result = getSubPlatformTypeByKey(key)
39 | console.log("result=>", result)
40 | expect(result).toBe(SubPlatformType.Custom_Zhihu)
41 | })
42 |
43 | it("test getNewPlatformKey", () => {
44 | const ptype = PlatformType.Common
45 | const subtype = SubPlatformType.Common_Yuque
46 | const result = getNewPlatformKey(ptype, subtype)
47 | console.log("result=>", result)
48 | expect(result).toMatch(/common_Yuque-\w+/)
49 | })
50 | })
51 |
--------------------------------------------------------------------------------
/src/setup.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { afterEach, beforeEach } from "vitest"
27 |
28 | beforeEach(async () => {
29 | console.log("======test is starting...======")
30 | })
31 |
32 | afterEach(() => {
33 | console.log("======test is finished.========")
34 | })
35 |
--------------------------------------------------------------------------------
/src/types/IPublishCfg.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { SypConfig } from "~/syp.config.ts"
27 | import { DynamicConfig } from "~/src/platforms/dynamicConfig.ts"
28 | import { BlogConfig } from "zhi-blog-api"
29 |
30 | /**
31 | * 表示发布配置的接口
32 | *
33 | * @interface IPublishCfg
34 | * @author terwer
35 | * @since 1.3.2
36 | */
37 | interface IPublishCfg {
38 | /**
39 | * SypConfig 类型的设置值
40 | *
41 | * @type {typeof SypConfig}
42 | */
43 | setting: typeof SypConfig
44 |
45 | /**
46 | * 平台配置集合
47 | */
48 | dynamicConfigArray: DynamicConfig[]
49 |
50 | /**
51 | * BlogConfig 类型的配置对象
52 | *
53 | * @type {BlogConfig}
54 | */
55 | cfg: BlogConfig
56 |
57 | /**
58 | * DynamicConfig 类型的动态配置对象
59 | *
60 | * @type {DynamicConfig}
61 | */
62 | dynCfg: DynamicConfig
63 | }
64 |
65 | export type { IPublishCfg }
66 |
--------------------------------------------------------------------------------
/src/types/ITagConfig.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { BlogConfig } from "zhi-blog-api"
27 |
28 | /**
29 | * 标签接口配置
30 | *
31 | * @author terwer
32 | * @since 1.9.0
33 | */
34 | interface ITagConfig {
35 | /**
36 | * API类型
37 | */
38 | apiType?: string
39 |
40 | /**
41 | * 平台配置
42 | */
43 | cfg?: BlogConfig
44 | }
45 |
46 | export { type ITagConfig }
47 |
--------------------------------------------------------------------------------
/src/utils/ai/AiConstants.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | /**
27 | * AI 常量
28 | *
29 | * https://github.com/transitive-bullshit/chatgpt-api/blob/main/src/chatgpt-api.ts#L443
30 | *
31 | * Use up to 4096 tokens (prompt + response), but try to leave 1000 tokens
32 | * for the response.
33 | */
34 | enum AiConstants {
35 | /**
36 | * 最大输入长度
37 | */
38 | MAX_INPUT_TOKEN_LENGTH = 3000,
39 |
40 | /**
41 | * 最大指令长度
42 | */
43 | // MAX_PROMPT_LENGTH = 96,
44 |
45 | /**
46 | * 标题返回字符限制
47 | */
48 | // MAX_RESP_TITLE_LENGTH = 255,
49 | }
50 |
51 | export { AiConstants }
52 |
--------------------------------------------------------------------------------
/src/utils/drawerUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | export const goTo = () => {
27 |
28 | }
--------------------------------------------------------------------------------
/src/utils/idUtil.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import shortHash from "shorthash2"
27 | import { v4 as uuidv4 } from "uuid"
28 |
29 | /**
30 | * 唯一ID
31 | */
32 | const newID = (): string => {
33 | const newstr = new Date().toISOString()
34 | return shortHash(newstr).toLowerCase()
35 | }
36 |
37 | /**
38 | * ID生成统一入口
39 | */
40 | const newUuid = () => {
41 | return uuidv4()
42 | }
43 |
44 | const idUtil = {
45 | newUuid,
46 | newID,
47 | }
48 |
49 | export default idUtil
50 |
--------------------------------------------------------------------------------
/src/utils/katexUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import katex from "katex"
27 | import { createAppLogger } from "~/src/utils/appLogger.ts"
28 |
29 | /**
30 | * 公式渲染
31 | *
32 | * @author terwer
33 | * @since 1.18.6
34 | */
35 | class KatexUtils {
36 | private static logger = createAppLogger("katex-utils")
37 |
38 | /**
39 | * 获得要渲染 KaTeX 表达式的 HTML
40 | *
41 | * @param mathExpression katex
42 | */
43 | public static renderToString(mathExpression: string) {
44 | this.logger.debug("准备处理 Katex =>", { mathExpression: mathExpression })
45 | return katex.renderToString(mathExpression)
46 | }
47 | }
48 |
49 | export default KatexUtils
50 |
--------------------------------------------------------------------------------
/src/utils/pluginUtils.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2024, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { isFileExists } from "~/src/utils/siyuanUtils.ts"
27 | import { useSiyuanApi } from "~/src/composables/useSiyuanApi.ts"
28 |
29 | /**
30 | * 插件工具类
31 | *
32 | * @since 1.20.0
33 | * @author Terwer
34 | */
35 | export class PluginUtils {
36 | public static async preCheckPicgoPlugin() {
37 | const { kernelApi } = useSiyuanApi()
38 | // 检测是否安装 picgo 插件
39 | return await isFileExists(kernelApi, "/data/plugins/siyuan-plugin-picgo/plugin.json", "text")
40 | }
41 |
42 | public static async preCheckBlogPlugin() {
43 | const { kernelApi } = useSiyuanApi()
44 | return await isFileExists(kernelApi, "/data/plugins/siyuan-blog/plugin.json", "text")
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/src/utils/sypIdUtil.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2022-2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import shortHash from "shorthash2"
27 | import { v4 as uuidv4 } from "uuid"
28 |
29 | /**
30 | * 唯一ID
31 | */
32 | const newID = (): string => {
33 | const newstr = new Date().toISOString()
34 | return shortHash(newstr).toLowerCase()
35 | }
36 |
37 | /**
38 | * ID生成统一入口
39 | */
40 | const newUuid = () => {
41 | return uuidv4()
42 | }
43 |
44 | /**
45 | * 生成随机ID
46 | */
47 | const randomUuid = (): string => {
48 | const uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
49 | const r = (Math.random() * 16) | 0,
50 | v = c === "x" ? r : (r & 0x3) | 0x8
51 | return v.toString(16)
52 | })
53 | return uuid
54 | }
55 |
56 | const sypIdUtil = {
57 | newUuid,
58 | newID,
59 | randomUuid,
60 | }
61 |
62 | export default sypIdUtil
63 |
--------------------------------------------------------------------------------
/src/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | ///
27 |
--------------------------------------------------------------------------------
/src/vue-shim.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | declare module "*.vue" {
27 | import { defineComponent } from "vue";
28 | const component: ReturnType;
29 | export default component;
30 | }
--------------------------------------------------------------------------------
/syp.config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2023, Terwer . All rights reserved.
3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 | *
5 | * This code is free software; you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License version 2 only, as
7 | * published by the Free Software Foundation. Terwer designates this
8 | * particular file as subject to the "Classpath" exception as provided
9 | * by Terwer in the LICENSE file that accompanied this code.
10 | *
11 | * This code is distributed in the hope that it will be useful, but WITHOUT
12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 | * version 2 for more details (a copy is included in the LICENSE file that
15 | * accompanied this code).
16 | *
17 | * You should have received a copy of the GNU General Public License version
18 | * 2 along with this work; if not, write to the Free Software Foundation,
19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 | *
21 | * Please contact Terwer, Shenzhen, Guangdong, China, youweics@163.com
22 | * or visit www.terwer.space if you need additional information or have any
23 | * questions.
24 | */
25 |
26 | import { DYNAMIC_CONFIG_KEY } from "~/src/utils/constants.ts"
27 |
28 | interface ISypConfig {
29 | // version?: ""
30 | lang?: "zh_CN" | "en_US"
31 | // 平台总的集合
32 | [DYNAMIC_CONFIG_KEY]?: any
33 |
34 | // [平台key1]: {平台配置1}
35 | // [平台key2]: {平台配置2}
36 |
37 | // [siyuan文档ID]: {
38 | // [custom-slug]: 初始化生成,初始化可读取siyuan属性,但是之后不能再修改
39 | // [动态平台1postid的key]: 对应平台的文章ID
40 | // [动态平台2postid的key]: 对应平台的文章ID
41 | // }
42 |
43 | [key: string]: any
44 | }
45 |
46 | export const SypConfig: ISypConfig = {
47 | lang: "zh_CN",
48 | [DYNAMIC_CONFIG_KEY]: "{}",
49 | }
50 |
--------------------------------------------------------------------------------
/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "module": "ESNext",
6 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
7 | "skipLibCheck": true,
8 | "allowJs": true,
9 | "checkJs": false,
10 | "allowSyntheticDefaultImports": true,
11 |
12 | /* Bundler mode */
13 | "moduleResolution": "node",
14 | "allowImportingTsExtensions": true,
15 | "resolveJsonModule": true,
16 | "isolatedModules": true,
17 | "noEmit": true,
18 | "jsx": "preserve",
19 |
20 | /* Linting */
21 | "strict": false,
22 | "noUnusedLocals": false,
23 | "noUnusedParameters": false,
24 | "noFallthroughCasesInSwitch": true,
25 |
26 | "paths": {
27 | "~/*": ["./*"]
28 | },
29 | "types": [
30 | "unplugin-icons/types/vue"
31 | ]
32 | },
33 | "include": ["*.ts", "*.vue", "*.d.ts", "**/**/*.ts", "**/**/*.d.ts", "**/**/*.vue", "custom.d.ts"],
34 | "references": [{ "path": "./tsconfig.node.json" }]
35 | }
36 |
--------------------------------------------------------------------------------
/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true
8 | },
9 | "include": ["vite.config.ts"]
10 | }
11 |
--------------------------------------------------------------------------------
/widget.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sy-post-publisher",
3 | "author": "terwer",
4 | "url": "https://github.com/terwer/sy-post-publisher",
5 | "version": "0.12.0",
6 | "minAppVersion": "2.9.0",
7 | "backends": [
8 | "windows",
9 | "linux",
10 | "darwin",
11 | "docker"
12 | ],
13 | "frontends": [
14 | "desktop",
15 | "browser-desktop"
16 | ],
17 | "displayName": {
18 | "default": "sy-post-publisher",
19 | "zh_CN": "发布工具挂件版"
20 | },
21 | "description": {
22 | "default": "Publish articles from siyuan-note to supported platforms.It is highly recommended to use it with the 'Release Tool' plugin for a better experience~",
23 | "zh_CN": "将思源笔记的文章发布到支持的平台的思源笔记挂件。强烈建议使用 [发布工具] 插件代替此挂件,体验更好~"
24 | },
25 | "readme": {
26 | "default": "README.md",
27 | "zh_CN": "README_zh_CN.md"
28 | },
29 | "i18n": [
30 | "en_US",
31 | "zh_CN"
32 | ],
33 | "funding": {
34 | "custom": [
35 | "https://afdian.net/a/terwer"
36 | ]
37 | }
38 | }
--------------------------------------------------------------------------------