├── .asf.yaml
├── .github
└── workflows
│ ├── check-asf-header.yml
│ └── sync-info.yml
├── .gitignore
├── .vaunt
├── config.yaml
└── plugin.png
├── LICENSE
├── README.md
├── cache-redis
├── README.md
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
└── redis.go
├── captcha-basic
├── .eslintrc.cjs
├── Captcha.tsx
├── README.md
├── basic.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── index.ts
├── info.yaml
├── interface.ts
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
├── tsconfig.node.json
├── useCaptcha.tsx
└── vite.config.ts
├── captcha-google-v2
├── .eslintrc.cjs
├── Captcha.tsx
├── README.md
├── common.ts
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── index.ts
├── info.yaml
├── interface.ts
├── package.json
├── pnpm-lock.yaml
├── recaptcha.go
├── tsconfig.json
├── tsconfig.node.json
├── useCaptcha.tsx
└── vite.config.ts
├── cdn-aliyun
├── README.md
├── aliyun.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── cdn-s3
├── README.md
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── s3.go
└── s3_client.go
├── connector-apache
├── README.md
├── apache.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
└── schema.go
├── connector-basic
├── README.md
├── basic.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── connector-dingtalk
├── README.md
├── dingtalk.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── connector-github
├── README.md
├── github.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── connector-google
├── README.md
├── go.mod
├── go.sum
├── google.go
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── connector-wallet
├── .eslintrc.cjs
├── .prettierrc.json
├── Component.tsx
├── README.md
├── WalletAuthorizer.tsx
├── WalletProvider.tsx
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── imgs
│ ├── activate.png
│ ├── bind.png
│ ├── click1.png
│ ├── click2.png
│ ├── create.png
│ ├── install.png
│ └── wallet.png
├── index.ts
├── info.yaml
├── package.json
├── tsconfig.json
├── tsconfig.node.json
├── vite.config.ts
└── wallet.go
├── editor-chart
├── .eslintrc.cjs
├── .gitignore
├── .prettierrc.json
├── Chart.tsx
├── README.md
├── chart.go
├── go.mod
├── go.sum
├── hooks.ts
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── index.ts
├── info.yaml
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
├── tsconfig.node.json
├── vite-env.d.ts
└── vite.config.ts
├── editor-formula
├── .eslintrc.cjs
├── .gitignore
├── .prettierrc.json
├── Formula.tsx
├── README.md
├── formula.go
├── go.mod
├── go.sum
├── hooks.ts
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── index.ts
├── info.yaml
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
├── tsconfig.node.json
├── vite-env.d.ts
└── vite.config.ts
├── embed-basic
├── .prettierrc.json
├── Component.tsx
├── README.md
├── basic.go
├── components
│ ├── CodePenEmbed
│ │ └── index.tsx
│ ├── DropboxEmbed
│ │ └── index.tsx
│ ├── EmbedContainer
│ │ └── index.tsx
│ ├── ExcalidrawEmbed
│ │ └── index.tsx
│ ├── FigmaEmbed
│ │ └── index.tsx
│ ├── GithubGistEmbed
│ │ └── index.tsx
│ ├── JSFiddleEmbed
│ │ └── index.tsx
│ ├── LoomEmbed
│ │ └── index.tsx
│ ├── TwitterEmbed
│ │ └── index.tsx
│ ├── YouTubeEmbed
│ │ └── index.tsx
│ └── index.ts
├── go.mod
├── go.sum
├── hooks.tsx
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── index.ts
├── info.yaml
├── modal.tsx
├── package.json
├── pnpm-lock.yaml
├── tsconfig.json
├── tsconfig.node.json
├── types.ts
├── vite-env.d.ts
└── vite.config.ts
├── licenserc.toml
├── notification-dingtalk
├── README.md
├── config.go
├── dingtalk_notification.go
├── docs
│ └── dingtalk-config.png
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── schema.go
└── user_config.go
├── notification-lark
├── README.md
├── README_CN.md
├── config.go
├── docs
│ ├── 1.png
│ ├── 2.png
│ ├── 3.png
│ └── 4.png
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── lark_card.go
├── lark_card_test.go
├── notification.go
├── user_config.go
├── utils.go
└── utils_test.go
├── notification-slack
├── README.md
├── config.go
├── docs
│ └── slack-config.png
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── schema.go
├── slack_notification.go
└── user_config.go
├── notification-wecom
├── README.md
├── README_CN.md
├── config.go
├── docs
│ └── wecom-config.png
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── notification_wecom.go
├── schema.go
└── user_config.go
├── plugins_desc.json
├── render-markdown-codehighlight
├── .eslintrc.cjs
├── .prettierrc.json
├── README.md
├── generate-theme.cjs
├── go.mod
├── go.sum
├── hooks.ts
├── i18n
│ ├── en_US.yaml
│ ├── index.ts
│ ├── translation.go
│ └── zh_CN.yaml
├── index.ts
├── info.yaml
├── package.json
├── renderMarkdownCodehighlight.go
├── theme_list.go
├── tsconfig.json
├── tsconfig.node.json
├── types.ts
└── vite.config.ts
├── reviewer-akismet
├── README.md
├── akismet.go
├── basic.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── reviewer-baidu
├── README.md
├── basic.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── reviewer-basic
├── README.md
├── basic.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── script
├── check-asf-header.sh
├── clean.sh
├── create-tag.sh
└── sync-info.sh
├── search-algolia
├── README.md
├── algolia.go
├── algoliaserverconfig.go
├── config.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── icon.go
├── info.yaml
├── initsearch.go
└── sync.go
├── search-elasticsearch
├── README.md
├── es.go
├── es_index.go
├── es_log.go
├── es_operator.go
├── es_test.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
└── sync.go
├── search-meilisearch
├── README.md
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── index.go
├── info.yaml
├── meilisearch.go
└── sync.go
├── storage-aliyunoss
├── README.md
├── aliyunoss.go
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
└── info.yaml
├── storage-s3
├── README.md
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── s3.go
└── s3_client.go
├── storage-tencentyuncos
├── README.md
├── go.mod
├── go.sum
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
└── tencentyuncos.go
├── user-center-slack
├── README.md
├── client.go
├── config.go
├── cron.go
├── go.mod
├── go.sum
├── handler.go
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── importer.go
├── info.yaml
├── notification.go
├── schema.go
├── slack_user_center.go
└── user_config.go
├── user-center-wecom
├── README.md
├── company.go
├── config.go
├── cron.go
├── docs
│ ├── wecom-config.png
│ ├── wecom-login.png
│ └── wecom-qrcode.png
├── go.mod
├── go.sum
├── handler.go
├── i18n
│ ├── en_US.yaml
│ ├── translation.go
│ └── zh_CN.yaml
├── info.yaml
├── notification.go
├── schema.go
├── user_config.go
└── wecom_user_center.go
└── util
├── go.mod
├── go.sum
└── util.go
/.asf.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | # NOTE: All configurations could be found here: https://cwiki.apache.org/confluence/display/INFRA/Git+-+.asf.yaml+features
19 | github:
20 | description: "The Apache Answer plugins repository."
21 | homepage: https://answer.apache.org/plugins
22 | enabled_merge_buttons:
23 | squash: true
24 | rebase: true
25 | merge: false
26 | features:
27 | wiki: false
28 | issues: true
29 | projects: true
30 | protected_branches:
31 | main: {}
32 |
33 | notifications:
34 | commits: commits@answer.apache.org
35 | issues: commits@answer.apache.org
36 | pullrequests: commits@answer.apache.org
37 | discussions: commits@answer.apache.org
38 |
--------------------------------------------------------------------------------
/.github/workflows/sync-info.yml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | name: Sync info
19 | on:
20 | push:
21 | branches: [dev, main]
22 |
23 | jobs:
24 | build:
25 | runs-on: ubuntu-latest
26 | steps:
27 | - name: Checkout repository
28 | uses: actions/checkout@v4
29 |
30 | - name: Run script
31 | run: script/sync-info.sh
32 |
33 | - name: Create pull request
34 | uses: peter-evans/create-pull-request@v5
35 | with:
36 | token: ${{ secrets.GITHUB_TOKEN }}
37 | commit-message: "chore: Sync Plugin Info"
38 | title: "chore: Sync Plugin Info"
39 | body: "Sync Plugin Info"
40 | branch: "chore/sync-info"
41 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.exe
2 | *.orig
3 | *.rej
4 | *.so
5 | *~
6 | .DS_Store
7 | ._*
8 | /.idea
9 | /.fleet
10 | /.vscode/*.log
11 | /go.work*
12 | /logs
13 | /vendor
14 | Thumbs*.db
15 | tmp
16 | vendor/
17 |
18 | node_modules/
19 | dist/
20 |
--------------------------------------------------------------------------------
/.vaunt/config.yaml:
--------------------------------------------------------------------------------
1 | version: 0.0.1
2 | achievements:
3 | - achievement:
4 | name: Plugin Maestro
5 | icon: https://raw.githubusercontent.com/apache/answer-plugins/main/.vaunt/plugin.png
6 | description: Awarded for crafting a plugin, magical!
7 | triggers:
8 | - trigger:
9 | actor: assignees
10 | action: pull_request
11 | condition: merged = true & labels in ['LGTM']
12 |
--------------------------------------------------------------------------------
/.vaunt/plugin.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/.vaunt/plugin.png
--------------------------------------------------------------------------------
/cache-redis/README.md:
--------------------------------------------------------------------------------
1 | # Redis Cache (preview)
2 | > This plugin designed to support Redis cache.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/cache-redis
9 | ```
10 |
11 | ### Configuration
12 | - `Endpoint` - Redis connection address
13 |
--------------------------------------------------------------------------------
/cache-redis/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | redis_cache:
20 | backend:
21 | info:
22 | name:
23 | other: Redis Cache
24 | description:
25 | other: Use Redis as cache
26 | config:
27 | endpoint:
28 | title:
29 | other: Endpoint
30 | description:
31 | other: Redis connection address, such as 127.0.0.1:6379
32 | username:
33 | title:
34 | other: Username
35 | description:
36 | other: Redis username
37 | password:
38 | title:
39 | other: Password
40 | description:
41 | other: Redis password
42 |
--------------------------------------------------------------------------------
/cache-redis/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.redis_cache.backend.info.name"
24 | InfoDescription = "plugin.redis_cache.backend.info.description"
25 |
26 | ConfigEndpointTitle = "plugin.redis_cache.backend.config.endpoint.title"
27 | ConfigEndpointDescription = "plugin.redis_cache.backend.config.endpoint.description"
28 | ConfigUsernameTitle = "plugin.redis_cache.backend.config.username.title"
29 | ConfigUsernameDescription = "plugin.redis_cache.backend.config.username.description"
30 | ConfigPasswordTitle = "plugin.redis_cache.backend.config.password.title"
31 | ConfigPasswordDescription = "plugin.redis_cache.backend.config.password.description"
32 | )
33 |
--------------------------------------------------------------------------------
/cache-redis/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | redis_cache:
20 | backend:
21 | info:
22 | name:
23 | other: Redis缓存
24 | description:
25 | other: 使用Redis作为缓存
26 | config:
27 | endpoint:
28 | title:
29 | other: Endpoint
30 | description:
31 | other: Redis的链接地址,如:127.0.0.1:6379
32 | username:
33 | title:
34 | other: 用户名
35 | description:
36 | other: Redis 用户名
37 | password:
38 | title:
39 | other: 密码
40 | description:
41 | other: Redis 密码
--------------------------------------------------------------------------------
/cache-redis/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: redis_cache
19 | type: cache
20 | version: 1.3.0
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/cache-redis
23 |
--------------------------------------------------------------------------------
/captcha-basic/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: { browser: true, es2020: true },
4 | extends: [
5 | 'eslint:recommended',
6 | 'plugin:@typescript-eslint/recommended',
7 | 'plugin:react-hooks/recommended',
8 | ],
9 | ignorePatterns: ['dist', '.eslintrc.cjs'],
10 | parser: '@typescript-eslint/parser',
11 | plugins: ['react-refresh'],
12 | rules: {
13 | 'react-refresh/only-export-components': [
14 | 'warn',
15 | { allowConstantExport: true },
16 | ],
17 | "@typescript-eslint/no-explicit-any": "off"
18 | },
19 | }
20 |
--------------------------------------------------------------------------------
/captcha-basic/Captcha.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | const Index = () => {
21 | return (
22 |
captcha basic
23 | );
24 | };
25 |
26 | export default Index;
27 |
--------------------------------------------------------------------------------
/captcha-basic/README.md:
--------------------------------------------------------------------------------
1 | # captcha basic
2 | This plug-in is the default graphical verification code plug-in, used to do some human-machine verification, prevent malicious registration and malicious submission, etc.
3 |
--------------------------------------------------------------------------------
/captcha-basic/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | basic_captcha:
20 | backend:
21 | info:
22 | name:
23 | other: Basic Captcha
24 | description:
25 | other: Default graphic verification code
26 | frontend:
27 | title: Captcha
28 | placeholder: Type the text above
29 | msg:
30 | empty: Captcha cannot be empty.
31 | verify: Verify
32 |
--------------------------------------------------------------------------------
/captcha-basic/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/captcha-basic/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.basic_captcha.backend.info.name"
24 | InfoDescription = "plugin.basic_captcha.backend.info.description"
25 | )
26 |
--------------------------------------------------------------------------------
/captcha-basic/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | basic_captcha:
20 | backend:
21 | info:
22 | name:
23 | other: 基础验证码
24 | description:
25 | other: 默认图形验证码
26 | frontend:
27 | title: 验证码
28 | placeholder: 输入上面的文本
29 | msg:
30 | empty: 验证码不能为空
31 | verify: 验证
--------------------------------------------------------------------------------
/captcha-basic/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import Captcha from './Captcha';
21 | import i18nConfig from './i18n';
22 | import useCaptcha from './useCaptcha';
23 |
24 | export default {
25 | info: {
26 | type: 'captcha',
27 | slug_name: 'basic_captcha',
28 | },
29 | component: Captcha,
30 | i18nConfig,
31 | hooks: {
32 | useCaptcha: useCaptcha,
33 | },
34 | };
35 |
--------------------------------------------------------------------------------
/captcha-basic/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: basic_captcha
19 | type: captcha
20 | version: 1.0.5
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/captcha-basic
--------------------------------------------------------------------------------
/captcha-basic/interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export interface FormValue {
21 | value: T;
22 | isInvalid: boolean;
23 | errorMsg: string;
24 | [prop: string]: any;
25 | }
26 |
27 | export interface FormDataType {
28 | [prop: string]: FormValue;
29 | }
30 |
31 | export interface FieldError {
32 | error_field: string;
33 | error_msg: string;
34 | }
35 |
36 | export interface ImgCodeReq {
37 | captcha_id?: string;
38 | captcha_code?: string;
39 | }
40 |
41 | export interface ImgCodeRes {
42 | captcha_id: string;
43 | captcha_img: string;
44 | verify: boolean;
45 | }
46 |
47 | export type CaptchaKey =
48 | | 'email'
49 | | 'password'
50 | | 'edit_userinfo'
51 | | 'question'
52 | | 'answer'
53 | | 'comment'
54 | | 'edit'
55 | | 'invitation_answer'
56 | | 'search'
57 | | 'report'
58 | | 'delete'
59 | | 'vote';
60 |
--------------------------------------------------------------------------------
/captcha-basic/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "captcha_basic",
3 | "private": true,
4 | "author": "Answer.dev",
5 | "description": "Basic for captcha",
6 | "version": "1.0.5",
7 | "files": [
8 | "dist",
9 | "README.md"
10 | ],
11 | "main": "./dist/captcha_basic.umd.js",
12 | "module": "./dist/captcha_basic.es.js",
13 | "types": "./dist/captcha_basic.d.ts",
14 | "exports": {
15 | ".": {
16 | "import": "./dist/captcha_basic.es.js",
17 | "require": "./dist/captcha_basic.umd.js"
18 | }
19 | },
20 | "scripts": {
21 | "dev": "vite build --mode development --watch",
22 | "build": "tsc && vite build",
23 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
24 | "preview": "vite preview"
25 | },
26 | "peerDependencies": {
27 | "react": "^18.2.0",
28 | "react-bootstrap": "^2.10.0",
29 | "react-dom": "^18.2.0",
30 | "react-i18next": "^11.18.3",
31 | "@types/react": "^18.0.17"
32 | },
33 | "peerDependenciesMeta": {
34 | "@types/react": {
35 | "optional": true
36 | }
37 | },
38 | "devDependencies": {
39 | "@modyfi/vite-plugin-yaml": "^1.1.0",
40 | "@typescript-eslint/eslint-plugin": "^6.0.0",
41 | "@typescript-eslint/parser": "^6.0.0",
42 | "@vitejs/plugin-react-swc": "^3.3.2",
43 | "eslint": "^8.45.0",
44 | "eslint-plugin-react-hooks": "^4.6.0",
45 | "eslint-plugin-react-refresh": "^0.4.3",
46 | "typescript": "5.4.2",
47 | "vite": "^4.4.5",
48 | "vite-plugin-dts": "^3.9.1"
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/captcha-basic/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": [
6 | "ES2020",
7 | "DOM",
8 | "DOM.Iterable"
9 | ],
10 | "module": "ESNext",
11 | "skipLibCheck": true,
12 | /* Bundler mode */
13 | "moduleResolution": "bundler",
14 | "allowImportingTsExtensions": true,
15 | "resolveJsonModule": true,
16 | "isolatedModules": true,
17 | "noImplicitAny": false,
18 | "noEmit": true,
19 | "jsx": "react-jsx",
20 | /* Linting */
21 | "strict": true,
22 | "noUnusedLocals": true,
23 | "noUnusedParameters": true,
24 | "noFallthroughCasesInSwitch": true,
25 |
26 | "types": [
27 | "@modyfi/vite-plugin-yaml/modules"
28 | ]
29 | },
30 | "references": [
31 | {
32 | "path": "./tsconfig.node.json"
33 | }
34 | ]
35 | }
--------------------------------------------------------------------------------
/captcha-basic/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 |
--------------------------------------------------------------------------------
/captcha-google-v2/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: { browser: true, es2020: true },
4 | extends: [
5 | 'eslint:recommended',
6 | 'plugin:@typescript-eslint/recommended',
7 | 'plugin:react-hooks/recommended',
8 | ],
9 | ignorePatterns: ['dist', '.eslintrc.cjs'],
10 | parser: '@typescript-eslint/parser',
11 | plugins: ['react-refresh'],
12 | rules: {
13 | 'react-refresh/only-export-components': [
14 | 'warn',
15 | { allowConstantExport: true },
16 | ],
17 | "@typescript-eslint/no-explicit-any": "off"
18 | },
19 | }
20 |
--------------------------------------------------------------------------------
/captcha-google-v2/Captcha.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | const Index = () => {
21 | return (
22 |
gogle v2
23 | );
24 | };
25 |
26 | export default Index;
27 |
--------------------------------------------------------------------------------
/captcha-google-v2/README.md:
--------------------------------------------------------------------------------
1 | # captcha google v2
2 |
3 | This plugin uses [google recaptcha](https://developers.google.com/recaptcha/docs/display) to replace the default graphical verification code
4 |
5 |
6 | ### Notice
7 |
8 | This plug-in needs to load Google resources. Before using it, please make sure that the network can fully load related resources.
9 |
--------------------------------------------------------------------------------
/captcha-google-v2/common.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | /**
21 | * @description: System language conversion bit google reacptcah corresponding language format
22 | * @link: https://developers.google.com/recaptcha/docs/language
23 | */
24 | export const languageKeys = {
25 | af_ZA: 'af',
26 | ar_SA: 'ar',
27 | az_AZ: 'az',
28 | en_US: 'en',
29 | zh_CN: 'zh-CN',
30 | zh_TW: 'zh-TW',
31 | };
32 |
--------------------------------------------------------------------------------
/captcha-google-v2/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/captcha-google-v2/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.google_v2_captcha.backend.info.name"
24 | InfoDescription = "plugin.google_v2_captcha.backend.info.description"
25 | ConfigSiteKeyTitle = "plugin.google_v2_captcha.backend.config.site_key.title"
26 | ConfigSiteKeyDescription = "plugin.google_v2_captcha.backend.config.site_key.description"
27 | ConfigSecretKeyTitle = "plugin.google_v2_captcha.backend.config.secret_key.title"
28 | ConfigSecretKeyDescription = "plugin.google_v2_captcha.backend.config.secret_key.description"
29 | ConfigSiteVerifyEndpointTitle = "plugin.google_v2_captcha.backend.config.site_verify_endpoint.title"
30 | ConfigSiteVerifyEndpointDescription = "plugin.google_v2_captcha.backend.config.site_verify_endpoint.description"
31 | )
32 |
--------------------------------------------------------------------------------
/captcha-google-v2/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import Captcha from './Captcha';
21 | import i18nConfig from './i18n';
22 | import useCaptcha from './useCaptcha';
23 |
24 | export default {
25 | info: {
26 | type: 'captcha',
27 | slug_name: 'google_v2_captcha',
28 | },
29 | component: Captcha,
30 | i18nConfig,
31 | hooks: {
32 | useCaptcha: useCaptcha,
33 | },
34 | };
35 |
--------------------------------------------------------------------------------
/captcha-google-v2/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: google_v2_captcha
19 | type: captcha
20 | version: 1.0.5
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/captcha-google-v2
--------------------------------------------------------------------------------
/captcha-google-v2/interface.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export interface FormValue {
21 | value: T;
22 | isInvalid: boolean;
23 | errorMsg: string;
24 | [prop: string]: any;
25 | }
26 |
27 | export interface FormDataType {
28 | [prop: string]: FormValue;
29 | }
30 |
31 | export interface FieldError {
32 | error_field: string;
33 | error_msg: string;
34 | }
35 |
36 | export interface ImgCodeReq {
37 | captcha_id?: string;
38 | captcha_code?: string;
39 | }
40 |
41 | export interface ImgCodeRes {
42 | captcha_id: string;
43 | captcha_img: string;
44 | verify: boolean;
45 | }
46 |
47 | export type CaptchaKey =
48 | | 'email'
49 | | 'password'
50 | | 'edit_userinfo'
51 | | 'question'
52 | | 'answer'
53 | | 'comment'
54 | | 'edit'
55 | | 'invitation_answer'
56 | | 'search'
57 | | 'report'
58 | | 'delete'
59 | | 'vote';
60 |
--------------------------------------------------------------------------------
/captcha-google-v2/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "captcha_google_v2",
3 | "private": true,
4 | "author": "Answer.dev",
5 | "description": "google reCaptcha v2",
6 | "version": "1.0.5",
7 | "files": [
8 | "dist",
9 | "README.md"
10 | ],
11 | "main": "./dist/captcha_google_v2.umd.js",
12 | "module": "./dist/captcha_google_v2.es.js",
13 | "types": "./dist/captcha_google_v2.d.ts",
14 | "exports": {
15 | ".": {
16 | "import": "./dist/captcha_google_v2.es.js",
17 | "require": "./dist/captcha_google_v2.umd.js"
18 | }
19 | },
20 | "scripts": {
21 | "dev": "vite build --mode development --watch",
22 | "build": "tsc && vite build",
23 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
24 | "preview": "vite preview"
25 | },
26 | "peerDependencies": {
27 | "react": "^18.2.0",
28 | "react-bootstrap": "^2.10.0",
29 | "react-dom": "^18.2.0",
30 | "react-i18next": "^11.18.3",
31 | "@types/react": "^18.0.17"
32 | },
33 | "peerDependenciesMeta": {
34 | "@types/react": {
35 | "optional": true
36 | }
37 | },
38 | "devDependencies": {
39 | "@modyfi/vite-plugin-yaml": "^1.1.0",
40 | "@typescript-eslint/eslint-plugin": "^6.0.0",
41 | "@typescript-eslint/parser": "^6.0.0",
42 | "@vitejs/plugin-react-swc": "^3.3.2",
43 | "eslint": "^8.45.0",
44 | "eslint-plugin-react-hooks": "^4.6.0",
45 | "eslint-plugin-react-refresh": "^0.4.3",
46 | "typescript": "5.4.2",
47 | "vite": "^4.4.5",
48 | "vite-plugin-dts": "^3.9.1"
49 | },
50 | "dependencies": {
51 | "react-google-recaptcha": "^3.1.0"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/captcha-google-v2/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": [
6 | "ES2020",
7 | "DOM",
8 | "DOM.Iterable"
9 | ],
10 | "module": "ESNext",
11 | "skipLibCheck": true,
12 | /* Bundler mode */
13 | "moduleResolution": "bundler",
14 | "allowImportingTsExtensions": true,
15 | "resolveJsonModule": true,
16 | "isolatedModules": true,
17 | "noImplicitAny": false,
18 | "noEmit": true,
19 | "jsx": "react-jsx",
20 | /* Linting */
21 | "strict": true,
22 | "noUnusedLocals": true,
23 | "noUnusedParameters": true,
24 | "noFallthroughCasesInSwitch": true,
25 |
26 | "types": [
27 | "@modyfi/vite-plugin-yaml/modules"
28 | ]
29 | },
30 | "references": [
31 | {
32 | "path": "./tsconfig.node.json"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/captcha-google-v2/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 |
--------------------------------------------------------------------------------
/cdn-aliyun/README.md:
--------------------------------------------------------------------------------
1 | # CDN With Aliyun OSS Storage (preview)
2 | > This plugin can be used to store static files to Aliyun OSS.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/cdn-aliyun
9 | ```
10 |
11 | ### Configuration
12 | - `Endpoint` - Endpoint of AliCloud OSS storage, such as oss-cn-hangzhou.aliyuncs.com
13 | - `Bucket Name` - Your bucket name
14 | - `Object Key Prefix` - Prefix of the object key like 'static/' that ending with '/'
15 | - `Access Key Id` - AccessKeyID of the AliCloud OSS storage
16 | - `Access Key Secret` - AccessKeySecret of the AliCloud OSS storage
17 | - `Visit Url Prefix` - Prefix of access address for the CDN file, ending with '/' such as https://static.example.com/xxx/
18 | - `Max File Size` - Max file size in MB, default is 10MB
--------------------------------------------------------------------------------
/cdn-aliyun/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: aliyun_cdn
19 | type: cdn
20 | version: 1.0.3
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/cdn-aliyun
23 |
--------------------------------------------------------------------------------
/cdn-s3/README.md:
--------------------------------------------------------------------------------
1 | # CDN With S3 Storage (preview)
2 | > This plugin can be used to store static files to AWS S3.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/answerdev/plugins/cdn-s3
9 | ```
10 |
11 | ### Configuration
12 | - `Endpoint` - Endpoint of the AWS S3 storage
13 | - `Bucket Name` - Your bucket name
14 | - `Object Key Prefix` - Prefix of the object key like 'static/' that ending with '/'
15 | - `Access Key Id` - AccessKeyId of the S3
16 | - `Access Key Secret` - AccessKeySecret of the S3
17 | - `Access Token` - AccessToken of the S3
18 | - `Visit Url Prefix` - Prefix of access address for the static file, ending with '/' such as https://static.example.com/xxx/
19 | - `Max File Size` - Max file size in MB, default is 10MB
--------------------------------------------------------------------------------
/cdn-s3/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: s3_cdn
19 | type: cdn
20 | version: 1.0.3
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/cdn-s3
23 |
--------------------------------------------------------------------------------
/connector-apache/README.md:
--------------------------------------------------------------------------------
1 | # Apache OAuth2 Connector
2 | > Apache OAuth2 Connector is a plugin designed to support login with Apache OAuth2.
3 |
4 | ## Reference
5 | ASF OAuth Documentation: https://oauth.apache.org/api.html
6 |
--------------------------------------------------------------------------------
/connector-apache/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | apache_connector:
20 | backend:
21 | name:
22 | other: Apache
23 | info:
24 | name:
25 | other: Apache Connector
26 | description:
27 | other: Connect to Apache Oauth
--------------------------------------------------------------------------------
/connector-apache/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | ConnectorName = "plugin.apache_connector.backend.name"
24 | InfoName = "plugin.apache_connector.backend.info.name"
25 | InfoDescription = "plugin.apache_connector.backend.info.description"
26 | )
27 |
--------------------------------------------------------------------------------
/connector-apache/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | apache_connector:
20 | backend:
21 | name:
22 | other: Apache
23 | info:
24 | name:
25 | other: Apache 连接器
26 | description:
27 | other: 用于接入 Apache Oauth
--------------------------------------------------------------------------------
/connector-apache/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: apache_connector
19 | type: connector
20 | version: 1.0.4
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/connector-apache
23 |
--------------------------------------------------------------------------------
/connector-apache/schema.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package apache
21 |
22 | // OAuthResponse is the response from the Apache OAuth server
23 | type OAuthResponse struct {
24 | Uid string `json:"uid"`
25 | Email string `json:"email"`
26 | Fullname string `json:"fullname"`
27 | IsMember bool `json:"isMember"`
28 | IsChair bool `json:"isChair"`
29 | IsRoot bool `json:"isRoot"`
30 | Projects []string `json:"projects"`
31 | Pmcs []string `json:"pmcs"`
32 | State string `json:"state"`
33 | }
34 |
--------------------------------------------------------------------------------
/connector-basic/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: basic_connector
19 | type: connector
20 | version: 1.2.9
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/connector-basic
23 |
--------------------------------------------------------------------------------
/connector-dingtalk/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | dingtalk_connector:
20 | backend:
21 | name:
22 | other: Dingtalk
23 | info:
24 | name:
25 | other: Dingtalk Connector
26 | description:
27 | other: Connect to Dingtalk for third-party login
28 | config:
29 | client_id:
30 | title:
31 | other: ClientID
32 | description:
33 | other: Client ID of your Dingtalk application
34 | client_secret:
35 | title:
36 | other: ClientSecret
37 | description:
38 | other: Client secret of your Dingtalk application
--------------------------------------------------------------------------------
/connector-dingtalk/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | ConnectorName = "plugin.dingtalk_connector.backend.name"
24 | InfoName = "plugin.dingtalk_connector.backend.info.name"
25 | InfoDescription = "plugin.dingtalk_connector.backend.info.description"
26 | ConfigClientIDTitle = "plugin.dingtalk_connector.backend.config.client_id.title"
27 | ConfigClientIDDescription = "plugin.dingtalk_connector.backend.config.client_id.description"
28 | ConfigClientSecretTitle = "plugin.dingtalk_connector.backend.config.client_secret.title"
29 | ConfigClientSecretDescription = "plugin.dingtalk_connector.backend.config.client_secret.description"
30 | )
31 |
--------------------------------------------------------------------------------
/connector-dingtalk/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | dingtalk_connector:
20 | backend:
21 | name:
22 | other: 钉钉
23 | info:
24 | name:
25 | other: 钉钉连接器
26 | description:
27 | other: 用于接入钉钉第三方登录
28 | config:
29 | client_id:
30 | title:
31 | other: ClientID
32 | description:
33 | other: 钉钉创建的应用后获取的 Client ID
34 | client_secret:
35 | title:
36 | other: ClientSecret
37 | description:
38 | other: 钉钉创建的应用后获取的 Client Secret
--------------------------------------------------------------------------------
/connector-dingtalk/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: dingtalk_connector
19 | type: connector
20 | version: 1.0.4
21 | author: xbmlz
22 | link: https://github.com/apache/answer-plugins/tree/main/connector-dingtalk
23 |
--------------------------------------------------------------------------------
/connector-github/README.md:
--------------------------------------------------------------------------------
1 | # GitHub connector
2 | > GitHub connector is a OAuth plug-in designed to support GitHub OAuth login.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/connector-github
9 | ```
10 |
11 | ### Configuration
12 | - `ClientID` - GitHub OAuth client ID
13 | - `ClientSecret` - GitHub OAuth client secret
14 |
15 | In the https://github.com/settings/applications/new page, config the Authorization callback URL as https://example.com/answer/api/v1/connector/redirect/github
--------------------------------------------------------------------------------
/connector-github/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | github_connector:
20 | backend:
21 | name:
22 | other: GitHub
23 | info:
24 | name:
25 | other: GitHub Connector
26 | description:
27 | other: Connect to GitHub for third-party login
28 | config:
29 | client_id:
30 | title:
31 | other: ClientID
32 | description:
33 | other: Client ID of your GitHub application
34 | client_secret:
35 | title:
36 | other: ClientSecret
37 | description:
38 | other: Client secret of your GitHub application
--------------------------------------------------------------------------------
/connector-github/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | ConnectorName = "plugin.github_connector.backend.name"
24 | InfoName = "plugin.github_connector.backend.info.name"
25 | InfoDescription = "plugin.github_connector.backend.info.description"
26 | ConfigClientIDTitle = "plugin.github_connector.backend.config.client_id.title"
27 | ConfigClientIDDescription = "plugin.github_connector.backend.config.client_id.description"
28 | ConfigClientSecretTitle = "plugin.github_connector.backend.config.client_secret.title"
29 | ConfigClientSecretDescription = "plugin.github_connector.backend.config.client_secret.description"
30 | )
31 |
--------------------------------------------------------------------------------
/connector-github/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | github_connector:
20 | backend:
21 | name:
22 | other: GitHub
23 | info:
24 | name:
25 | other: GitHub 连接器
26 | description:
27 | other: 用于接入 GitHub 第三方登录
28 | config:
29 | client_id:
30 | title:
31 | other: ClientID
32 | description:
33 | other: GitHub 创建的应用后获取的 Client ID
34 | client_secret:
35 | title:
36 | other: ClientSecret
37 | description:
38 | other: GitHub 创建的应用后获取的 Client Secret
--------------------------------------------------------------------------------
/connector-github/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: github_connector
19 | type: connector
20 | version: 1.2.10
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/connector-github
23 |
--------------------------------------------------------------------------------
/connector-google/README.md:
--------------------------------------------------------------------------------
1 | # Google connector
2 | > Google connector is a OAuth plug-in designed to support Google OAuth login.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/connector-google
9 | ```
10 |
11 | ### Configuration
12 | - `ClientID` - Google OAuth client ID
13 | - `ClientSecret` - Google OAuth client secret
14 |
15 | You need to configure the **redirect URI** such as:
16 | https://example.com/answer/api/v1/connector/redirect/google
--------------------------------------------------------------------------------
/connector-google/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | google_connector:
20 | backend:
21 | name:
22 | other: Google
23 | info:
24 | name:
25 | other: Google Connector
26 | description:
27 | other: Connect to Google for third-party login
28 | config:
29 | client_id:
30 | title:
31 | other: ClientID
32 | description:
33 | other: Client ID of your Google application
34 | client_secret:
35 | title:
36 | other: ClientSecret
37 | description:
38 | other: Client secret of your Google application
--------------------------------------------------------------------------------
/connector-google/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | ConnectorName = "plugin.google_connector.backend.name"
24 | InfoName = "plugin.google_connector.backend.info.name"
25 | InfoDescription = "plugin.google_connector.backend.info.description"
26 | ConfigClientIDTitle = "plugin.google_connector.backend.config.client_id.title"
27 | ConfigClientIDDescription = "plugin.google_connector.backend.config.client_id.description"
28 | ConfigClientSecretTitle = "plugin.google_connector.backend.config.client_secret.title"
29 | ConfigClientSecretDescription = "plugin.google_connector.backend.config.client_secret.description"
30 | )
31 |
--------------------------------------------------------------------------------
/connector-google/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | google_connector:
20 | backend:
21 | name:
22 | other: Google
23 | info:
24 | name:
25 | other: Google 连接器
26 | description:
27 | other: 用于接入 Google 第三方登录
28 | config:
29 | client_id:
30 | title:
31 | other: ClientID
32 | description:
33 | other: Google 创建的应用后获取的 Client ID
34 | client_secret:
35 | title:
36 | other: ClientSecret
37 | description:
38 | other: Google 创建的应用后获取的 Client Secret
--------------------------------------------------------------------------------
/connector-google/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: google_connector
19 | type: connector
20 | version: 1.2.10
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/connector-google
23 |
--------------------------------------------------------------------------------
/connector-wallet/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | module.exports = {
21 | root: true,
22 | env: { browser: true, es2020: true },
23 | extends: [
24 | 'eslint:recommended',
25 | 'plugin:@typescript-eslint/recommended',
26 | 'plugin:react-hooks/recommended',
27 | ],
28 | ignorePatterns: ['dist', '.eslintrc.cjs'],
29 | parser: '@typescript-eslint/parser',
30 | plugins: ['react-refresh'],
31 | rules: {
32 | 'react-refresh/only-export-components': [
33 | 'warn',
34 | { allowConstantExport: true },
35 | ],
36 | },
37 | }
38 |
--------------------------------------------------------------------------------
/connector-wallet/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "all",
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "jsxBracketSameLine": true,
6 | "printWidth": 80,
7 | "endOfLine": "auto"
8 | }
9 |
--------------------------------------------------------------------------------
/connector-wallet/Component.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import WalletProvider from './WalletProvider';
21 | import WalletAuthorizer from './WalletAuthorizer';
22 |
23 | const Component = () => {
24 | return (
25 |
26 |
27 |
28 |
29 |
30 | );
31 | };
32 |
33 | export default Component;
34 |
--------------------------------------------------------------------------------
/connector-wallet/README.md:
--------------------------------------------------------------------------------
1 | # Wallet connector
2 | > Wallet connector is a OAuth plug-in designed to support Wallet OAuth login.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/connector-wallet
9 | ```
10 |
11 | ### Use Case
12 |
13 | - Step 1: Install the wallet plug-in on your chrome/firefox browser. ex:MetaMask,BitgetWallet.
14 |
15 | 
16 |
17 | - Step 2: Generate your web3 wallet.
18 |
19 | 
20 |
21 | 
22 |
23 |
24 | - Step3: Build your answer with golang and register the plugin.
25 |
26 | 
27 |
28 | - Step4: Log in through your wallet and bind to your email.
29 | 
30 |
31 | 
32 |
33 | 
34 |
--------------------------------------------------------------------------------
/connector-wallet/WalletProvider.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import '@rainbow-me/rainbowkit/styles.css';
21 | import { getDefaultConfig, RainbowKitProvider } from '@rainbow-me/rainbowkit';
22 | import { WagmiProvider } from 'wagmi';
23 | import { mainnet } from 'wagmi/chains';
24 | import { QueryClientProvider, QueryClient } from '@tanstack/react-query';
25 |
26 | const config = getDefaultConfig({
27 | appName: 'Apache Answer',
28 | projectId: 'xxx',
29 | chains: [mainnet], // There's no on-chain operations, so only ETH mainnet is enough.
30 | });
31 |
32 | const queryClient = new QueryClient();
33 |
34 | function WalletProvider({ children }: React.PropsWithChildren) {
35 | return (
36 |
37 |
38 |
39 | {children}
40 |
41 |
42 |
43 | );
44 | }
45 |
46 | export default WalletProvider;
47 |
--------------------------------------------------------------------------------
/connector-wallet/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | wallet_connector:
20 | backend:
21 | name:
22 | other: Wallet
23 | info:
24 | name:
25 | other: Wallet Connector
26 | description:
27 | other: Connect to Wallet for third-party login
28 | frontend:
29 | wallet_needed: You haven't connect wallet yet.
30 | connect_button: Connect
31 | wrong_network: Current network isn't supported.
32 | switch_button: Switch network
33 | connected_wallet: "You've connected to ${ADDRESS}, then you can:"
34 | authorize_button: Authorize
35 | disconnect_button: Change account
36 |
--------------------------------------------------------------------------------
/connector-wallet/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/connector-wallet/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | ConnectorName = "plugin.wallet_connector.backend.name"
24 | InfoName = "plugin.wallet_connector.backend.info.name"
25 | InfoDescription = "plugin.wallet_connector.backend.info.description"
26 | )
27 |
--------------------------------------------------------------------------------
/connector-wallet/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | wallet_connector:
20 | backend:
21 | name:
22 | other: Wallet
23 | info:
24 | name:
25 | other: Wallet 连接器
26 | description:
27 | other: 用于接入 Wallet 第三方登录
28 | frontend:
29 | wallet_needed: 你还没连接钱包。
30 | connect_button: 连接钱包
31 | wrong_network: 不支持当前连接的网络。
32 | switch_button: 切换网络
33 | connected_wallet: "你已经连接到地址 ${ADDRESS},接下来可以:"
34 | authorize_button: 授权登录
35 | disconnect_button: 更换账号
36 |
--------------------------------------------------------------------------------
/connector-wallet/imgs/activate.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/activate.png
--------------------------------------------------------------------------------
/connector-wallet/imgs/bind.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/bind.png
--------------------------------------------------------------------------------
/connector-wallet/imgs/click1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/click1.png
--------------------------------------------------------------------------------
/connector-wallet/imgs/click2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/click2.png
--------------------------------------------------------------------------------
/connector-wallet/imgs/create.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/create.png
--------------------------------------------------------------------------------
/connector-wallet/imgs/install.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/install.png
--------------------------------------------------------------------------------
/connector-wallet/imgs/wallet.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/connector-wallet/imgs/wallet.png
--------------------------------------------------------------------------------
/connector-wallet/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import Component from './Component';
21 | import i18nConfig from './i18n';
22 | import info from './info.yaml';
23 |
24 | export default {
25 | info: {
26 | slug_name: info.slug_name,
27 | type: info.type,
28 | route: info.route,
29 | },
30 | component: Component,
31 | i18nConfig,
32 | };
33 |
--------------------------------------------------------------------------------
/connector-wallet/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: wallet_connector
19 | type: route
20 | version: 1.0.1
21 | author: i-Lucifer,ourai
22 | link: https://github.com/apache/answer-plugins/tree/main/connector-wallet
23 | route: /connector-wallet-auth
24 |
--------------------------------------------------------------------------------
/connector-wallet/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "connector-wallet",
3 | "version": "1.0.1",
4 | "description": "Connect to Web3 wallet for third-party login",
5 | "author": "Ourai L. ",
6 | "type": "module",
7 | "files": [
8 | "dist",
9 | "README.md"
10 | ],
11 | "main": "./dist/connector-wallet.umd.js",
12 | "module": "./dist/connector-wallet.es.js",
13 | "types": "./dist/connector-wallet.d.ts",
14 | "exports": {
15 | ".": {
16 | "import": "./dist/connector-wallet.es.js",
17 | "require": "./dist/connector-wallet.umd.js"
18 | }
19 | },
20 | "scripts": {
21 | "dev": "vite build --mode development --watch",
22 | "build": "tsc && vite build",
23 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
24 | },
25 | "peerDependencies": {
26 | "@types/react": "^18.0.17",
27 | "js-sha256": "0.11.0",
28 | "react": "^18.2.0",
29 | "react-bootstrap": "^2.10.0",
30 | "react-dom": "^18.2.0",
31 | "react-i18next": "^11.18.3"
32 | },
33 | "peerDependenciesMeta": {
34 | "@types/react": {
35 | "optional": true
36 | }
37 | },
38 | "devDependencies": {
39 | "@modyfi/vite-plugin-yaml": "^1.1.0",
40 | "@typescript-eslint/eslint-plugin": "^6.0.0",
41 | "@typescript-eslint/parser": "^6.0.0",
42 | "@vitejs/plugin-react-swc": "^3.3.2",
43 | "eslint": "^8.45.0",
44 | "eslint-plugin-react-hooks": "^4.6.0",
45 | "eslint-plugin-react-refresh": "^0.4.3",
46 | "typescript": "^5.0.2",
47 | "vite": "^4.4.5",
48 | "vite-plugin-css-injected-by-js": "^3.3.0",
49 | "vite-plugin-dts": "^3.9.1"
50 | },
51 | "dependencies": {
52 | "@rainbow-me/rainbowkit": "^2.2.0",
53 | "@tanstack/react-query": "^5.59.15",
54 | "viem": "2.x",
55 | "wagmi": "^2.12.19"
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/connector-wallet/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "react-jsx",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true,
22 | "types": [
23 | "@modyfi/vite-plugin-yaml/modules"
24 | ]
25 | },
26 | "include": ["src"],
27 | "references": [{ "path": "./tsconfig.node.json" }]
28 | }
29 |
--------------------------------------------------------------------------------
/connector-wallet/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true,
8 | "strict": true
9 | },
10 | "include": ["vite.config.ts"]
11 | }
12 |
--------------------------------------------------------------------------------
/editor-chart/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | module.exports = {
21 | root: true,
22 | env: { browser: true, es2020: true },
23 | extends: [
24 | 'eslint:recommended',
25 | 'plugin:@typescript-eslint/recommended',
26 | 'plugin:react-hooks/recommended',
27 | ],
28 | ignorePatterns: ['dist', '.eslintrc.cjs'],
29 | parser: '@typescript-eslint/parser',
30 | plugins: ['react-refresh'],
31 | rules: {
32 | 'react-refresh/only-export-components': [
33 | 'warn',
34 | { allowConstantExport: true },
35 | ],
36 | },
37 | }
38 |
--------------------------------------------------------------------------------
/editor-chart/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/editor-chart/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "all",
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "jsxBracketSameLine": true,
6 | "printWidth": 80,
7 | "endOfLine": "auto"
8 | }
9 |
--------------------------------------------------------------------------------
/editor-chart/README.md:
--------------------------------------------------------------------------------
1 | # chart plugin
2 | This plugin is used to extend the toolbar of the markdown editor of the answer project.
3 | It provides a toolbar button to insert a chart into the markdown editor.
4 |
--------------------------------------------------------------------------------
/editor-chart/chart.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package chart
21 |
22 | import (
23 | "embed"
24 | "github.com/apache/answer-plugins/editor-chart/i18n"
25 | "github.com/apache/answer-plugins/util"
26 | "github.com/apache/answer/plugin"
27 | )
28 |
29 | //go:embed info.yaml
30 | var Info embed.FS
31 |
32 | type ChartPlugin struct {
33 | }
34 |
35 | func init() {
36 | plugin.Register(&ChartPlugin{})
37 | }
38 |
39 | func (d ChartPlugin) Info() plugin.Info {
40 | info := &util.Info{}
41 | info.GetInfo(Info)
42 |
43 | return plugin.Info{
44 | Name: plugin.MakeTranslator(i18n.InfoName),
45 | SlugName: info.SlugName,
46 | Description: plugin.MakeTranslator(i18n.InfoDescription),
47 | Author: info.Author,
48 | Version: info.Version,
49 | Link: info.Link,
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/editor-chart/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | chart_editor:
20 | backend:
21 | info:
22 | name:
23 | other: Chart Editor
24 | description:
25 | other: Render chart in editor
26 | frontend:
27 | title: Chart
28 | text: Chart
29 | flow_chart: Flow chart
30 | sequence_diagram: Sequence diagram
31 | class_diagram: Class diagram
32 | state_diagram: State diagram
33 | entity_relationship_diagram: Entity relationship diagram
34 | user_defined_diagram: User defined diagram
35 | gantt_chart: Gantt chart
36 | pie_chart: Pie chart
37 |
38 |
--------------------------------------------------------------------------------
/editor-chart/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/editor-chart/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.chart_editor.backend.info.name"
24 | InfoDescription = "plugin.chart_editor.backend.info.description"
25 | )
26 |
--------------------------------------------------------------------------------
/editor-chart/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | chart_editor:
20 | backend:
21 | info:
22 | name:
23 | other: 图表编辑器
24 | description:
25 | other: 在编辑器中渲染图表
26 | frontend:
27 | title: 图表
28 | text: 图表
29 | flow_chart: 流程图
30 | sequence_diagram: 时序图
31 | class_diagram: 类图
32 | state_diagram: 状态图
33 | entity_relationship_diagram: ER 图
34 | user_defined_diagram: 用户自定义图
35 | gantt_chart: 甘特图
36 | pie_chart: 饼图
37 |
--------------------------------------------------------------------------------
/editor-chart/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import Chart from './Chart';
21 | import i18nConfig from './i18n';
22 | import { useRenderChart } from './hooks';
23 | import info from './info.yaml'
24 |
25 | export default {
26 | info: {
27 | type: info.type,
28 | slug_name: info.slug_name,
29 | },
30 | component: Chart,
31 | i18nConfig,
32 | hooks: {
33 | useRender: [useRenderChart],
34 | },
35 | };
36 |
--------------------------------------------------------------------------------
/editor-chart/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: chart_editor
19 | type: editor
20 | version: 1.2.11
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/editor-chart
23 |
--------------------------------------------------------------------------------
/editor-chart/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "editor-chart",
3 | "private": true,
4 | "author": "Answer.dev",
5 | "version": "1.2.11",
6 | "files": [
7 | "dist",
8 | "README.md"
9 | ],
10 | "main": "./dist/editor-chart.umd.js",
11 | "module": "./dist/editor-chart.es.js",
12 | "types": "./dist/editor-chart.d.ts",
13 | "exports": {
14 | ".": {
15 | "import": "./dist/editor-chart.es.js",
16 | "require": "./dist/editor-chart.umd.js"
17 | }
18 | },
19 | "scripts": {
20 | "dev": "vite build --mode development --watch",
21 | "build": "tsc && vite build",
22 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23 | "preview": "vite preview"
24 | },
25 | "peerDependencies": {
26 | "react": "^18.2.0",
27 | "react-bootstrap": "^2.10.0",
28 | "react-dom": "^18.2.0",
29 | "react-i18next": "^11.18.3",
30 | "@types/react": "^18.0.17"
31 | },
32 | "peerDependenciesMeta": {
33 | "@types/react": {
34 | "optional": true
35 | }
36 | },
37 | "devDependencies": {
38 | "@modyfi/vite-plugin-yaml": "^1.1.0",
39 | "@typescript-eslint/eslint-plugin": "^6.0.0",
40 | "@typescript-eslint/parser": "^6.0.0",
41 | "@vitejs/plugin-react-swc": "^3.3.2",
42 | "eslint": "^8.45.0",
43 | "eslint-plugin-react-hooks": "^4.6.0",
44 | "eslint-plugin-react-refresh": "^0.4.3",
45 | "typescript": "5.4.2",
46 | "vite": "^4.4.5",
47 | "vite-plugin-dts": "^3.9.1"
48 | },
49 | "dependencies": {
50 | "mermaid": "^9.1.7"
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/editor-chart/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": [
6 | "ES2020",
7 | "DOM",
8 | "DOM.Iterable"
9 | ],
10 | "module": "ESNext",
11 | "skipLibCheck": true,
12 | /* Bundler mode */
13 | "moduleResolution": "bundler",
14 | "allowImportingTsExtensions": true,
15 | "resolveJsonModule": true,
16 | "isolatedModules": true,
17 | "noImplicitAny": false,
18 | "noEmit": true,
19 | "jsx": "react-jsx",
20 | /* Linting */
21 | "strict": true,
22 | "noUnusedLocals": true,
23 | "noUnusedParameters": true,
24 | "noFallthroughCasesInSwitch": true,
25 | "types": [
26 | "@modyfi/vite-plugin-yaml/modules"
27 | ],
28 | },
29 | "references": [
30 | {
31 | "path": "./tsconfig.node.json"
32 | }
33 | ]
34 | }
--------------------------------------------------------------------------------
/editor-chart/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 |
--------------------------------------------------------------------------------
/editor-chart/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | ///
21 |
--------------------------------------------------------------------------------
/editor-formula/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | module.exports = {
21 | root: true,
22 | env: { browser: true, es2020: true },
23 | extends: [
24 | 'eslint:recommended',
25 | 'plugin:@typescript-eslint/recommended',
26 | 'plugin:react-hooks/recommended',
27 | ],
28 | ignorePatterns: ['dist', '.eslintrc.cjs'],
29 | parser: '@typescript-eslint/parser',
30 | plugins: ['react-refresh'],
31 | rules: {
32 | 'react-refresh/only-export-components': [
33 | 'warn',
34 | { allowConstantExport: true },
35 | ],
36 | },
37 | }
38 |
--------------------------------------------------------------------------------
/editor-formula/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 | pnpm-debug.log*
8 | lerna-debug.log*
9 |
10 | node_modules
11 | dist
12 | dist-ssr
13 | *.local
14 |
15 | # Editor directories and files
16 | .vscode/*
17 | !.vscode/extensions.json
18 | .idea
19 | .DS_Store
20 | *.suo
21 | *.ntvs*
22 | *.njsproj
23 | *.sln
24 | *.sw?
25 |
--------------------------------------------------------------------------------
/editor-formula/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "all",
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "jsxBracketSameLine": true,
6 | "printWidth": 80,
7 | "endOfLine": "auto"
8 | }
9 |
--------------------------------------------------------------------------------
/editor-formula/README.md:
--------------------------------------------------------------------------------
1 | # formula plugin
2 | This plugin is used to extend the toolbar of the markdown editor of the answer project.
3 | It provides a toolbar button to insert a formula into the markdown editor.
4 |
--------------------------------------------------------------------------------
/editor-formula/formula.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package formula
21 |
22 | import (
23 | "embed"
24 | "github.com/apache/answer-plugins/editor-formula/i18n"
25 | "github.com/apache/answer-plugins/util"
26 | "github.com/apache/answer/plugin"
27 | )
28 |
29 | //go:embed info.yaml
30 | var Info embed.FS
31 |
32 | type FormulaPlugin struct {
33 | }
34 |
35 | func init() {
36 | plugin.Register(&FormulaPlugin{})
37 | }
38 |
39 | func (d FormulaPlugin) Info() plugin.Info {
40 | info := &util.Info{}
41 | info.GetInfo(Info)
42 |
43 | return plugin.Info{
44 | Name: plugin.MakeTranslator(i18n.InfoName),
45 | SlugName: info.SlugName,
46 | Description: plugin.MakeTranslator(i18n.InfoDescription),
47 | Author: info.Author,
48 | Version: info.Version,
49 | Link: info.Link,
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/editor-formula/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | formula_editor:
20 | backend:
21 | info:
22 | name:
23 | other: Formula Editor
24 | description:
25 | other: Render formula in editor
26 | frontend:
27 | title: Formula
28 | options:
29 | inline: Inline formula
30 | block: Block formula
31 |
--------------------------------------------------------------------------------
/editor-formula/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/editor-formula/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.formula_editor.backend.info.name"
24 | InfoDescription = "plugin.formula_editor.backend.info.description"
25 | )
26 |
--------------------------------------------------------------------------------
/editor-formula/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | formula_editor:
20 | backend:
21 | info:
22 | name:
23 | other: 公式编辑器
24 | description:
25 | other: 在编辑器中渲染公式
26 | frontend:
27 | title: 公式
28 | options:
29 | inline: 行内公式
30 | block: 块公式
31 |
--------------------------------------------------------------------------------
/editor-formula/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import Formula from './Formula';
21 | import i18nConfig from './i18n';
22 | import { useRenderFormula } from './hooks';
23 | import info from './info.yaml'
24 |
25 | export default {
26 | info: {
27 | type: info.type,
28 | slug_name: info.slug_name,
29 | },
30 | component: Formula,
31 | i18nConfig,
32 | hooks: {
33 | useRender: [useRenderFormula],
34 | },
35 | };
36 |
--------------------------------------------------------------------------------
/editor-formula/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: formula_editor
19 | type: editor
20 | version: 1.2.14
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/editor-formula
23 |
--------------------------------------------------------------------------------
/editor-formula/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "editor-formula",
3 | "private": true,
4 | "author": "Answer.dev",
5 | "version": "1.2.14",
6 | "files": [
7 | "dist",
8 | "README.md"
9 | ],
10 | "main": "./dist/editor-formula.umd.js",
11 | "module": "./dist/editor-formula.es.js",
12 | "types": "./dist/editor-formula.d.ts",
13 | "exports": {
14 | ".": {
15 | "import": "./dist/editor-formula.es.js",
16 | "require": "./dist/editor-formula.umd.js"
17 | }
18 | },
19 | "scripts": {
20 | "dev": "vite build --mode development --watch",
21 | "build": "tsc && vite build",
22 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23 | "preview": "vite preview"
24 | },
25 | "peerDependencies": {
26 | "react": "^18.2.0",
27 | "react-bootstrap": "^2.10.0",
28 | "react-dom": "^18.2.0",
29 | "react-i18next": "^11.18.3"
30 | },
31 | "devDependencies": {
32 | "@modyfi/vite-plugin-yaml": "^1.1.0",
33 | "@typescript-eslint/eslint-plugin": "^6.0.0",
34 | "@typescript-eslint/parser": "^6.0.0",
35 | "@vitejs/plugin-react-swc": "^3.3.2",
36 | "eslint": "^8.45.0",
37 | "eslint-plugin-react-hooks": "^4.6.0",
38 | "eslint-plugin-react-refresh": "^0.4.3",
39 | "typescript": "5.4.2",
40 | "vite": "^4.4.5",
41 | "vite-plugin-css-injected-by-js": "^3.3.0",
42 | "vite-plugin-dts": "^3.9.1"
43 | },
44 | "dependencies": {
45 | "katex": "^0.16.2"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/editor-formula/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noImplicitAny": false,
15 | "noEmit": true,
16 | "jsx": "react-jsx",
17 |
18 | /* Linting */
19 | "strict": true,
20 | "noUnusedLocals": true,
21 | "noUnusedParameters": true,
22 | "noFallthroughCasesInSwitch": true,
23 | "types": [
24 | "@modyfi/vite-plugin-yaml/modules"
25 | ]
26 | },
27 | "references": [{ "path": "./tsconfig.node.json" }],
28 | }
29 |
--------------------------------------------------------------------------------
/editor-formula/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 |
--------------------------------------------------------------------------------
/editor-formula/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | ///
21 |
--------------------------------------------------------------------------------
/embed-basic/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "all",
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "jsxBracketSameLine": true,
6 | "printWidth": 80,
7 | "endOfLine": "auto"
8 | }
9 |
--------------------------------------------------------------------------------
/embed-basic/README.md:
--------------------------------------------------------------------------------
1 | # embed plugin
2 | This plugin is used to extend the toolbar of the markdown editor of the answer project.
--------------------------------------------------------------------------------
/embed-basic/components/CodePenEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const CodePenEmbed = ({ penId }) => {
23 | return (
24 |
25 |
33 |
34 | );
35 | };
36 |
37 | export default CodePenEmbed;
38 |
--------------------------------------------------------------------------------
/embed-basic/components/DropboxEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const DropboxEmbed = ({ dropboxId }) => {
23 | return (
24 |
25 |
32 |
33 | );
34 | };
35 |
36 | export default DropboxEmbed;
37 |
--------------------------------------------------------------------------------
/embed-basic/components/ExcalidrawEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const ExcalidrawEmbed = ({ excalidrawId }) => {
23 | return (
24 |
25 |
32 |
33 | );
34 | };
35 |
36 | export default ExcalidrawEmbed;
37 |
--------------------------------------------------------------------------------
/embed-basic/components/FigmaEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const FigmaEmbed = ({ url }) => {
23 | return (
24 |
25 |
31 |
32 | );
33 | };
34 |
35 | export default FigmaEmbed;
36 |
--------------------------------------------------------------------------------
/embed-basic/components/GithubGistEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const GithubGistEmbed = ({ scriptUrl }) => {
23 | return (
24 |
25 |
30 | );
31 | };
32 |
33 | export default GithubGistEmbed;
34 |
--------------------------------------------------------------------------------
/embed-basic/components/JSFiddleEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const JSFiddleEmbed = ({ fiddleId }) => {
23 | return (
24 |
25 |
31 |
32 | );
33 | };
34 |
35 | export default JSFiddleEmbed;
36 |
--------------------------------------------------------------------------------
/embed-basic/components/LoomEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const LoomEmbed = ({ loomId }) => {
23 | return (
24 |
25 |
32 |
33 | );
34 | };
35 |
36 | export default LoomEmbed;
37 |
--------------------------------------------------------------------------------
/embed-basic/components/YouTubeEmbed/index.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import EmbedContainer from '../EmbedContainer';
21 |
22 | const YouTubeEmbed = ({ videoId }) => {
23 | return (
24 |
25 |
33 |
34 | );
35 | };
36 |
37 | export default YouTubeEmbed;
38 |
--------------------------------------------------------------------------------
/embed-basic/components/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import GithubGistEmbed from './GithubGistEmbed';
21 | import CodePenEmbed from './CodePenEmbed';
22 | import YouTubeEmbed from './YouTubeEmbed';
23 | import JSFiddleEmbed from './JSFiddleEmbed';
24 | import FigmaEmbed from './FigmaEmbed';
25 | import ExcalidrawEmbed from './ExcalidrawEmbed';
26 | import LoomEmbed from './LoomEmbed';
27 | import DropboxEmbed from './DropboxEmbed';
28 | import TwitterEmbed from './TwitterEmbed';
29 |
30 | export {
31 | GithubGistEmbed,
32 | CodePenEmbed,
33 | YouTubeEmbed,
34 | JSFiddleEmbed,
35 | FigmaEmbed,
36 | ExcalidrawEmbed,
37 | LoomEmbed,
38 | DropboxEmbed,
39 | TwitterEmbed,
40 | };
41 |
--------------------------------------------------------------------------------
/embed-basic/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/embed-basic/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import Component from './Component';
21 | import { useRenderEmbed } from './hooks';
22 | import i18nConfig from './i18n';
23 | import info from './info.yaml';
24 |
25 | export default {
26 | info: {
27 | slug_name: info.slug_name,
28 | type: info.type,
29 | },
30 | component: Component,
31 | i18nConfig,
32 | hooks: {
33 | useRender: [useRenderEmbed],
34 | },
35 | };
36 |
--------------------------------------------------------------------------------
/embed-basic/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: basic_embed
19 | type: editor
20 | version: 1.1.4
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/embed-basic
23 |
--------------------------------------------------------------------------------
/embed-basic/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "embed-basic",
3 | "version": "1.1.4",
4 | "description": "",
5 | "files": [
6 | "dist",
7 | "README.md"
8 | ],
9 | "main": "./dist/embed-basic.umd.js",
10 | "module": "./dist/embed-basic.es.js",
11 | "types": "./dist/embed-basic.d.ts",
12 | "exports": {
13 | ".": {
14 | "import": "./dist/embed-basic.es.js",
15 | "require": "./dist/embed-basic.umd.js"
16 | }
17 | },
18 | "scripts": {
19 | "dev": "vite build --mode development --watch",
20 | "build": "tsc && vite build",
21 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0"
22 | },
23 | "keywords": [],
24 | "author": "Answer.dev",
25 | "peerDependencies": {
26 | "react": "^18.2.0",
27 | "react-bootstrap": "^2.10.0",
28 | "react-dom": "^18.2.0",
29 | "react-i18next": "^11.18.3",
30 | "@types/react": "^18.0.17"
31 | },
32 | "peerDependenciesMeta": {
33 | "@types/react": {
34 | "optional": true
35 | }
36 | },
37 | "devDependencies": {
38 | "@modyfi/vite-plugin-yaml": "^1.1.0",
39 | "@typescript-eslint/eslint-plugin": "^6.0.0",
40 | "@typescript-eslint/parser": "^6.0.0",
41 | "@vitejs/plugin-react-swc": "^3.3.2",
42 | "eslint": "^8.45.0",
43 | "eslint-plugin-react-hooks": "^4.6.0",
44 | "eslint-plugin-react-refresh": "^0.4.3",
45 | "typescript": "5.4.2",
46 | "vite": "^4.4.5",
47 | "vite-plugin-dts": "^3.9.1"
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/embed-basic/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": [
6 | "ES2020",
7 | "DOM",
8 | "DOM.Iterable"
9 | ],
10 | "module": "ESNext",
11 | "skipLibCheck": true,
12 | /* Bundler mode */
13 | "moduleResolution": "bundler",
14 | "allowImportingTsExtensions": true,
15 | "resolveJsonModule": true,
16 | "isolatedModules": true,
17 | "noImplicitAny": false,
18 | "noEmit": true,
19 | "jsx": "react-jsx",
20 | /* Linting */
21 | "strict": true,
22 | "noUnusedLocals": true,
23 | "noUnusedParameters": true,
24 | "noFallthroughCasesInSwitch": true,
25 | "types": [
26 | "@modyfi/vite-plugin-yaml/modules"
27 | ]
28 | },
29 | "references": [
30 | {
31 | "path": "./tsconfig.node.json"
32 | }
33 | ]
34 | }
--------------------------------------------------------------------------------
/embed-basic/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 |
--------------------------------------------------------------------------------
/embed-basic/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | export interface Request {
21 | get: (url: string) => Promise;
22 | }
23 |
--------------------------------------------------------------------------------
/embed-basic/vite-env.d.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | ///
21 |
--------------------------------------------------------------------------------
/licenserc.toml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | headerPath = "Apache-2.0-ASF.txt"
19 |
20 | excludes = [
21 | ".vaunt/*",
22 | "ui/build/**",
23 | "answer-data/**",
24 | "LICENSE",
25 | "go.mod",
26 | "go.sum",
27 | "plugins_desc.json",
28 | ".eslintrc.cjs",
29 | ]
30 |
31 | [properties]
32 | inceptionYear = 2023
33 | copyrightOwner = "Kumfo "
--------------------------------------------------------------------------------
/notification-dingtalk/README.md:
--------------------------------------------------------------------------------
1 | # Ding talk Notification
2 |
3 | ## How to use
4 |
5 | To use the notification-dingtalk plugin with your application, install it using the following command:
6 |
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/notification-dingtalk
9 | ```
10 |
11 |
12 | ## Feature
13 |
14 | - Send message to Ding talk
15 |
16 | ## Config
17 |
18 | > Config Webhook URL and open the notification
19 |
20 | - Webhook URL: such as `https://oapi.dingtalk.com/robot/send?access_token=xxxxxx`
21 |
22 | ## Preview
23 |
24 | 
25 |
26 | ## Document
27 |
28 | - https://open.dingtalk.com/document/robots/custom-robot-access
29 | - https://open.dingtalk.com/document/orgapp/custom-bot-send-message-type
--------------------------------------------------------------------------------
/notification-dingtalk/docs/dingtalk-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-dingtalk/docs/dingtalk-config.png
--------------------------------------------------------------------------------
/notification-dingtalk/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: dingtalk_notification
19 | type: notification
20 | version: 1.0.2
21 | author: Luffy
22 | link: https://github.com/apache/answer-plugins/tree/main/notification-dingtalk
23 |
--------------------------------------------------------------------------------
/notification-dingtalk/schema.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package dingtalk
21 |
22 | type WebhookReq struct {
23 | MsgType string `json:"msgtype"`
24 | Markdown struct {
25 | Title string `json:"title"`
26 | Text string `json:"text"`
27 | } `json:"markdown"`
28 | }
29 |
30 | func NewWebhookReq(content string, title string) *WebhookReq {
31 | return &WebhookReq{
32 | MsgType: "markdown",
33 | Markdown: struct {
34 | Title string `json:"title"`
35 | Text string `json:"text"`
36 | }{
37 | Title: title,
38 | Text: content,
39 | },
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/notification-lark/README_CN.md:
--------------------------------------------------------------------------------
1 | # NotificationLark Plugin
2 |
3 | [English](./README.md) | [中文](./README_CN.md)
4 |
5 | ## 如何使用
6 |
7 | 要在应用程序中使用飞书通知插件,请使用以下命令进行安装:
8 |
9 | ```bash
10 | ./answer build --with github.com/apache/answer-plugins/notification-lark
11 | ```
12 |
13 | ## 如何配置
14 |
15 | ### 对于管理员
16 |
17 | #### 创建机器人
18 |
19 | 1. 在 Lark 或飞书中创建机器人:
20 | * 访问 [Lark](https://open.larksuite.com) 或 [飞书](https://open.feishu.cn) 创建一个新的机器人。
21 | * 添加 `im:message:send_as_bot` 权限在机器人的 `权限管理` 选项卡。
22 | * 在机器人设置中,启用自定义机器人菜单,并将操作类型设置为 `推送事件`。
23 | * 使用`10001`作为配置菜单事件代码。
24 | 
25 | 2. 配置事件和回调:
26 | * 导航到事件和回调选项卡。
27 | * 设置 `配置订阅方式` 为 `使用长连接接收事件`。
28 | * 将 `application.bot.menu_v6` 事件ID添加到您的事件配置中。
29 | 
30 |
31 | 3. 发布机器人版本:配置完上述设置后,发布机器人版本。
32 |
33 | #### 网站配置
34 |
35 | 根据您的需求设置以下参数:
36 |
37 | * 品牌:选择 `Lark` 或 `飞书` 作为通知渠道。
38 | * App ID:您的机器人AppID,通常格式为 `cli_xxx`。
39 | * App Secret:您的机器人密钥。
40 | * Verification Token:(可选)机器人 `事件与回调` => `加密策略` 中的 `Verification Token`。
41 | * Encrypt Key:(可选)机器人 `事件与回调` => `加密策略` 中的 `Encrypt Key`。
42 |
43 | ### 对于用户
44 |
45 | 1. 与机器人互动:
46 | * 在聊天界面中点击机器人菜单以触发互动。
47 | * 互动后,您将从机器人收到您的OpenID。
48 | 2. 用户设置:
49 | * 在用户设置中输入您的`OpenID`。
50 | * 在通知选项下选择您希望接收的通知。
51 |
--------------------------------------------------------------------------------
/notification-lark/docs/1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-lark/docs/1.png
--------------------------------------------------------------------------------
/notification-lark/docs/2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-lark/docs/2.png
--------------------------------------------------------------------------------
/notification-lark/docs/3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-lark/docs/3.png
--------------------------------------------------------------------------------
/notification-lark/docs/4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-lark/docs/4.png
--------------------------------------------------------------------------------
/notification-lark/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: lark_notification
19 | type: notification
20 | version: 1.0.3
21 | author: sonui
22 | link: https://github.com/apache/answer-plugins/tree/main/notification-lark
23 |
--------------------------------------------------------------------------------
/notification-lark/utils.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package lark
21 |
22 | import (
23 | "crypto/rand"
24 | "math/big"
25 | )
26 |
27 | type GenerateRandomStringArgs struct {
28 | Length uint64
29 | StringPool string
30 | }
31 |
32 | // GenerateRandomString use crypto to generate a random string
33 | func GenerateRandomString(args *GenerateRandomStringArgs) string {
34 | // check args
35 | if args.Length <= 0 || args.StringPool == "" {
36 | return ""
37 | }
38 |
39 | // generate random string
40 | b := make([]byte, args.Length)
41 | for i := uint64(0); i < args.Length; i++ {
42 | idx := RandomInt(0, int64(len(args.StringPool)))
43 | b[i] = args.StringPool[idx]
44 | }
45 |
46 | return string(b)
47 | }
48 |
49 | func RandomInt(min, max int64) int64 {
50 | result, _ := rand.Int(rand.Reader, big.NewInt(max-min))
51 | return result.Int64() + min
52 | }
53 |
54 | func PtrBool(b bool) *bool {
55 | return &b
56 | }
57 |
--------------------------------------------------------------------------------
/notification-lark/utils_test.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package lark_test
21 |
22 | import (
23 | "testing"
24 |
25 | answer "github.com/apache/answer-plugins/notification-lark"
26 | )
27 |
28 | func TestGenRandomStr(t *testing.T) {
29 | rs := answer.GenerateRandomString(&answer.GenerateRandomStringArgs{
30 | Length: 10,
31 | StringPool: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
32 | })
33 |
34 | t.Logf("Random string: %s", rs)
35 | }
36 |
37 | func TestPtrBool(t *testing.T) {
38 | b := true
39 | bp := answer.PtrBool(b)
40 | if *bp != b {
41 | t.Errorf("PtrBool failed")
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/notification-slack/README.md:
--------------------------------------------------------------------------------
1 | # Slack Notification
2 | ## Feature
3 | - Send message to Slack
4 |
5 | ## Config
6 | > Config Webhook URL and open the notification
7 |
8 | - Webhook URL: such as `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`
9 |
10 | ## Preview
11 | 
12 |
13 | ## Document
14 | - https://api.slack.com/messaging/webhooks
--------------------------------------------------------------------------------
/notification-slack/docs/slack-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-slack/docs/slack-config.png
--------------------------------------------------------------------------------
/notification-slack/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: slack_notification
19 | type: notification
20 | version: 1.0.4
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/notification-slack
23 |
--------------------------------------------------------------------------------
/notification-slack/schema.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package slack_notification
21 |
22 | type WebhookReq struct {
23 | Blocks []struct {
24 | Type string `json:"type"`
25 | Text struct {
26 | Type string `json:"type"`
27 | Text string `json:"text"`
28 | } `json:"text"`
29 | } `json:"blocks"`
30 | }
31 |
32 | func NewWebhookReq(content string) *WebhookReq {
33 | return &WebhookReq{
34 | Blocks: []struct {
35 | Type string `json:"type"`
36 | Text struct {
37 | Type string `json:"type"`
38 | Text string `json:"text"`
39 | } `json:"text"`
40 | }{
41 | {
42 | Type: "section",
43 | Text: struct {
44 | Type string `json:"type"`
45 | Text string `json:"text"`
46 | }{
47 | Type: "mrkdwn",
48 | Text: content,
49 | },
50 | },
51 | },
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/notification-wecom/README.md:
--------------------------------------------------------------------------------
1 | # Wecom Notification Plugin
2 |
3 | [English](./README.md) | [中文](./README_CN.md)
4 |
5 | ## How to use
6 |
7 | To use the notification-wecom plugin with your application, install it using the following command:
8 |
9 | ```bash
10 | ./answer build --with github.com/apache/answer-plugins/notification-wecom
11 | ```
12 |
13 |
14 | ## Feature
15 |
16 | - Send message to Wecom
17 |
18 | ## Config
19 |
20 | > Config Webhook URL and open the notification
21 |
22 | - Webhook URL: such as `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
23 |
24 | ## Preview
25 |
26 | 
27 |
28 | ## Document
29 |
30 | https://open.work.weixin.qq.com/help2/pc/14931
31 | https://developer.work.weixin.qq.com/document/path/91770
32 |
33 | ## Thanks
34 |
35 | Thanks for sharing the DingTalk notification plugin, it's a helpful reference for this plugin development.
36 |
--------------------------------------------------------------------------------
/notification-wecom/README_CN.md:
--------------------------------------------------------------------------------
1 | # 企业微信通知插件
2 |
3 | [English](./README.md) | [中文](./README_CN.md)
4 |
5 | ## 使用指南
6 |
7 | 要使用通知企业微信通知插件,请使用以下命令进行安装:
8 |
9 | ```bash
10 | ./answer build --with github.com/apache/answer-plugins/notification-wecom
11 | ```
12 |
13 |
14 | ## 功能
15 |
16 | - 通过企业微信群机器人发送信息到企业微信
17 |
18 | ## 配置
19 |
20 | > 配置Webhook URL并打开通知
21 |
22 | - Webhook 地址: 类似于 `https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
23 |
24 | ## 预览
25 |
26 | 
27 |
28 | ## 开发文档
29 |
30 | https://open.work.weixin.qq.com/help2/pc/14931
31 | https://developer.work.weixin.qq.com/document/path/91770
32 |
33 | ## 致谢
34 |
35 | 感谢钉钉通知插件的开发,本插件很多代码参考或者直接沿用了钉钉通知插件的代码。
--------------------------------------------------------------------------------
/notification-wecom/docs/wecom-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/notification-wecom/docs/wecom-config.png
--------------------------------------------------------------------------------
/notification-wecom/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: wecom_notification
19 | type: notification
20 | version: 1.0.2
21 | author: lihui
22 | link: https://github.com/apache/answer-plugins/tree/main/notification-wecom
23 |
--------------------------------------------------------------------------------
/notification-wecom/schema.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package wecom
21 |
22 | type WebhookReq struct {
23 | MsgType string `json:"msgtype"`
24 | Markdown struct {
25 | Text string `json:"content"`
26 | } `json:"markdown"`
27 | }
28 |
29 | func NewWebhookReq(content string) *WebhookReq {
30 | return &WebhookReq{
31 | MsgType: "markdown",
32 | Markdown: struct {
33 | Text string `json:"content"`
34 | }{
35 | Text: content,
36 | },
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/.eslintrc.cjs:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | root: true,
3 | env: { browser: true, es2020: true },
4 | extends: [
5 | 'eslint:recommended',
6 | 'plugin:@typescript-eslint/recommended',
7 | 'plugin:react-hooks/recommended',
8 | ],
9 | ignorePatterns: ['dist', '.eslintrc.cjs'],
10 | parser: '@typescript-eslint/parser',
11 | plugins: ['react-refresh'],
12 | rules: {
13 | 'react-refresh/only-export-components': [
14 | 'warn',
15 | { allowConstantExport: true },
16 | ],
17 | },
18 | }
19 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/.prettierrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "trailingComma": "all",
3 | "tabWidth": 2,
4 | "singleQuote": true,
5 | "jsxBracketSameLine": true,
6 | "printWidth": 80,
7 | "endOfLine": "auto"
8 | }
9 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/README.md:
--------------------------------------------------------------------------------
1 | # RenderMarkdownCodehighlight Plugin
2 | The `RenderMarkdownCodehighlight` plugin improves the readability of code snippets within Markdown content by integrating highlight.js for syntax highlighting. It supports dynamic theme switching, allowing code blocks to adapt seamlessly to either light or dark themes based on your application's current theme. This makes code blocks more visually appealing and easier to read.
3 |
4 | ### Features
5 | Dynamic Theme Switching: Automatically switches between light and dark modes for code highlighting based on the selected theme.
6 | Theme Support: Supports various highlight.js themes, with some themes designed for both light and dark modes, while others are specifically tailored for one mode.
7 |
8 | ### Theme Types
9 | theme-all: These themes support both light and dark modes, automatically adjusting based on the application's current theme.
10 | theme-light: These themes are optimized for light mode and will use default dark mode.
11 | theme-dark: These themes are designed specifically for dark mode and will use default light mode.
12 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | render_markdown_codehighlight:
20 | backend:
21 | info:
22 | name:
23 | other: Code Highlight
24 | description:
25 | other: Highlight code blocks in Markdown content
26 | config:
27 | css_filtering:
28 | title:
29 | other: Code Highlight Theme Selection
30 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/i18n/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import en_US from './en_US.yaml';
21 | import zh_CN from './zh_CN.yaml';
22 |
23 | export default {
24 | en_US,
25 | zh_CN,
26 | };
27 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.render_markdown_codehighlight.backend.info.name"
24 | InfoDescription = "plugin.render_markdown_codehighlight.backend.info.description"
25 | ConfigCssFilteringTitle = "plugin.render_markdown_codehighlight.backend.config.css_filtering.title"
26 | )
27 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | render_markdown_codehighlight:
20 | backend:
21 | info:
22 | name:
23 | other: 代码高亮
24 | description:
25 | other: 高亮显示 Markdown 内容中的代码块
26 | config:
27 | css_filtering:
28 | title:
29 | other: 代码高亮主题选择
30 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import i18nConfig from './i18n';
21 | import { useHighlightCode } from './hooks';
22 | import info from './info.yaml';
23 |
24 | export default {
25 | info: {
26 | slug_name: info.slug_name,
27 | type: info.type,
28 | },
29 | i18nConfig,
30 | hooks: {
31 | useRender: [useHighlightCode],
32 | },
33 | };
34 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: render_markdown_codehighlight
19 | type: render
20 | version: 1.0.0
21 | author: Chen Jiaji, Zhu Xuanlyu
22 | link: https://github.com/apache/answer-plugins/tree/main/render-markdown-codehighlight
23 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "render-markdown-codehighlight",
3 | "version": "1.0.0",
4 | "description": "",
5 | "type": "module",
6 | "files": [
7 | "dist",
8 | "README.md"
9 | ],
10 | "main": "./dist/render-markdown-codehighlight.umd.js",
11 | "module": "./dist/render-markdown-codehighlight.es.js",
12 | "types": "./dist/render-markdown-codehighlight.d.ts",
13 | "exports": {
14 | ".": {
15 | "import": "./dist/render-markdown-codehighlight.es.js",
16 | "require": "./dist/render-markdown-codehighlight.umd.js"
17 | }
18 | },
19 | "scripts": {
20 | "dev": "vite build --mode development --watch",
21 | "build": "tsc && vite build",
22 | "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23 | "postinstall": "node ./generate-theme.cjs"
24 | },
25 | "peerDependencies": {
26 | "react": "^18.2.0",
27 | "react-bootstrap": "^2.10.0",
28 | "react-dom": "^18.2.0",
29 | "react-i18next": "^11.18.3"
30 | },
31 | "devDependencies": {
32 | "@modyfi/vite-plugin-yaml": "^1.1.0",
33 | "@typescript-eslint/eslint-plugin": "^6.0.0",
34 | "@typescript-eslint/parser": "^6.0.0",
35 | "@vitejs/plugin-react-swc": "^3.3.2",
36 | "eslint": "^8.45.0",
37 | "eslint-plugin-react-hooks": "^4.6.0",
38 | "eslint-plugin-react-refresh": "^0.4.3",
39 | "typescript": "^5.0.2",
40 | "vite": "^4.4.5",
41 | "vite-plugin-css-injected-by-js": "^3.5.1",
42 | "vite-plugin-dts": "^3.9.1"
43 | },
44 | "dependencies": {
45 | "highlight.js": "^11.10.0"
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2020",
4 | "useDefineForClassFields": true,
5 | "lib": ["ES2020", "DOM", "DOM.Iterable"],
6 | "module": "ESNext",
7 | "skipLibCheck": true,
8 |
9 | /* Bundler mode */
10 | "moduleResolution": "bundler",
11 | "allowImportingTsExtensions": true,
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "noEmit": true,
15 | "jsx": "react-jsx",
16 |
17 | /* Linting */
18 | "strict": true,
19 | "noUnusedLocals": true,
20 | "noUnusedParameters": true,
21 | "noFallthroughCasesInSwitch": true,
22 | "types": [
23 | "@modyfi/vite-plugin-yaml/modules"
24 | ]
25 | },
26 | "include": ["src"],
27 | "references": [{ "path": "./tsconfig.node.json" }]
28 | }
29 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/tsconfig.node.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "composite": true,
4 | "skipLibCheck": true,
5 | "module": "ESNext",
6 | "moduleResolution": "bundler",
7 | "allowSyntheticDefaultImports": true,
8 | "strict": true
9 | },
10 | "include": ["vite.config.ts"]
11 | }
12 |
--------------------------------------------------------------------------------
/render-markdown-codehighlight/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | import { RefObject } from 'react';
21 |
22 | export type pluginHookProps = HTMLElement | RefObject | null;
23 |
24 | export interface Request {
25 | get: (url: string) => Promise;
26 | }
27 |
--------------------------------------------------------------------------------
/reviewer-akismet/README.md:
--------------------------------------------------------------------------------
1 | # Akismet Reviewer
2 | > The akismet is a spam filtering service that filters spam.
3 |
4 | ## Config
5 | - `akismet_key`: Akismet API key
--------------------------------------------------------------------------------
/reviewer-akismet/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | akismet_reviewer:
20 | backend:
21 | info:
22 | name:
23 | other: Akismet Anti-Spam
24 | description:
25 | other: Akismet Anti-Spam is used to check the content of posts and comments against the Akismet web service to see if they look like spam.
26 | config:
27 | api_key:
28 | title:
29 | other: API Key
30 | label:
31 | other: Enter your Akismet API key
32 | description:
33 | other: Your Akismet API key. Manage your API keys.
34 | span_filtering:
35 | title:
36 | other: Span Filtering
37 | review:
38 | other: Put spam in the review queue
39 | delete:
40 | other: Silently delete the spam
41 | comment:
42 | need_review: Needs approval.
--------------------------------------------------------------------------------
/reviewer-akismet/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.akismet_reviewer.backend.info.name"
24 | InfoDescription = "plugin.akismet_reviewer.backend.info.description"
25 | ConfigAPIKeyLabel = "plugin.akismet_reviewer.backend.config.api_key.label"
26 | ConfigAPIKeyTitle = "plugin.akismet_reviewer.backend.config.api_key.title"
27 | ConfigAPIKeyDescription = "plugin.akismet_reviewer.backend.config.api_key.description"
28 | CommentNeedReview = "plugin.akismet_reviewer.backend.comment.need_review"
29 | ConfigSpanFilteringTitle = "plugin.akismet_reviewer.backend.config.span_filtering.title"
30 | ConfigSpanFilteringLabel = "plugin.akismet_reviewer.backend.config.span_filtering.label"
31 | ConfigSpanFilteringReview = "plugin.akismet_reviewer.backend.config.span_filtering.review"
32 | ConfigSpanFilteringDelete = "plugin.akismet_reviewer.backend.config.span_filtering.delete"
33 | )
34 |
--------------------------------------------------------------------------------
/reviewer-akismet/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | akismet_reviewer:
20 | backend:
21 | info:
22 | name:
23 | other: Akismet 反垃圾
24 | description:
25 | other: Akismet 反垃圾用于检查帖子和评论内容,以确定它们是否像垃圾内容。
26 | config:
27 | api_key:
28 | title:
29 | other: API Key
30 | label:
31 | other: 输入你的 Akismet API key
32 | description:
33 | other: 你的 Akismet API key. 管理你的 API keys.
34 | span_filtering:
35 | title:
36 | other: 垃圾内容过滤
37 | review:
38 | other: 将垃圾内容放入审核队列
39 | delete:
40 | other: 静默地删除垃圾内容
41 | comment:
42 | need_review: 需要批准。
--------------------------------------------------------------------------------
/reviewer-akismet/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: akismet_reviewer
19 | type: reviewer
20 | version: 1.0.5
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/reviewer-akismet
23 |
--------------------------------------------------------------------------------
/reviewer-baidu/README.md:
--------------------------------------------------------------------------------
1 | # Baidu Reviewer
2 |
3 | > Baidu Content Audit Platform is a service platform for intelligent auditing of multimedia content. It can be used to filter spam.
4 |
5 | ## Config
6 |
7 | - `api_key`: Baidu App's API key
8 | - `secret_key`: Baidu App's Secret Key
9 |
10 | ## Document
11 |
12 | - https://cloud.baidu.com/doc/ANTIPORN/s/Vk3h6xaga
13 |
--------------------------------------------------------------------------------
/reviewer-baidu/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: baidu_reviewer
19 | type: reviewer
20 | version: 1.0.2
21 | author: Luffy
22 | link: https://github.com/apache/answer-plugins/tree/main/reviewer-baidu
23 |
--------------------------------------------------------------------------------
/reviewer-basic/README.md:
--------------------------------------------------------------------------------
1 | # Review Basic
2 | > Review the user's first post, and only after review will the post be visible to others.
3 |
4 | ## Config
5 | Just need to open the `Review question and answer` switch. After that, the user's first post will be reviewed by the administrator.
--------------------------------------------------------------------------------
/reviewer-basic/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: basic_reviewer
19 | type: reviewer
20 | version: 1.0.7
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/reviewer-basic
23 |
--------------------------------------------------------------------------------
/script/check-asf-header.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Licensed to the Apache Software Foundation (ASF) under one
3 | # or more contributor license agreements. See the NOTICE file
4 | # distributed with this work for additional information
5 | # regarding copyright ownership. The ASF licenses this file
6 | # to you under the Apache License, Version 2.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | # KIND, either express or implied. See the License for the
16 | # specific language governing permissions and limitations
17 | # under the License.
18 |
19 | docker run -it --rm -v $(pwd):/github/workspace ghcr.io/korandoru/hawkeye-native format
20 | gofmt -w -l .
--------------------------------------------------------------------------------
/script/clean.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | # Licensed to the Apache Software Foundation (ASF) under one
3 | # or more contributor license agreements. See the NOTICE file
4 | # distributed with this work for additional information
5 | # regarding copyright ownership. The ASF licenses this file
6 | # to you under the Apache License, Version 2.0 (the
7 | # "License"); you may not use this file except in compliance
8 | # with the License. You may obtain a copy of the License at
9 | #
10 | # http://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing,
13 | # software distributed under the License is distributed on an
14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | # KIND, either express or implied. See the License for the
16 | # specific language governing permissions and limitations
17 | # under the License.
18 |
19 |
20 | project_root="."
21 |
22 | for dir in $(find "$project_root" -type d); do
23 | if [[ "$dir" == *.git* ]] || [[ "$dir" == *.vscode* ]]; then
24 | continue
25 | fi
26 | if [[ "$dir" == *dist* ]]; then
27 | rm -rf "$dir"
28 | fi
29 |
30 | if [[ "$dir" == *node_modules* ]]; then
31 | rm -rf "$dir"
32 | fi
33 | done
--------------------------------------------------------------------------------
/script/create-tag.sh:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | #!/bin/bash
19 |
20 | project_root="."
21 |
22 | for dir in $(find "$project_root" -type d); do
23 | if [[ "$dir" == *node_modules* ]] || [[ "$dir" == *.git* ]] || [[ "$dir" == *.vscode* ]]; then
24 | continue
25 | fi
26 |
27 | # 当 info.yaml 不存在时,跳过
28 | if [ ! -f "$dir/info.yaml" ]; then
29 | continue
30 | fi
31 |
32 | if git diff HEAD^^ HEAD $dir/info.yaml | grep -q "^\+version:"; then
33 | project_name=$(echo $dir | awk -F'/' '{print $NF}')
34 | version=$(grep "version:" $dir/info.yaml | awk '{print $2}')
35 | commit_msg=$(git log -1 --pretty=%B)
36 | echo "create tag for $project_name/v$version"
37 | git tag -a $project_name/v$version -m "$commit_msg"
38 | fi
39 | done
--------------------------------------------------------------------------------
/search-algolia/README.md:
--------------------------------------------------------------------------------
1 | # Algolia Search (preview)
2 | > Algolia is a hosted search engine, offering full-text, numerical, and faceted search, capable of delivering real-time
3 | > results from the first keystroke. Algolia's powerful API lets you quickly and seamlessly implement search within your
4 | > websites and mobile applications. Our search API powers billions of queries for thousands of companies every month,
5 | > delivering relevant results in under 100ms anywhere in the world.
6 |
7 | ## How to use
8 |
9 | ### Algolia Official website
10 | [Algolia](https://www.algolia.com/)
11 |
12 | ### Build
13 | ```bash
14 | ./answer build --with github.com/apache/answer-plugins/search-algolia
15 | ```
16 |
17 | ### Configuration
18 | - `Application ID` - Your Algolia Application ID.
19 | - `Search-only API Key` - Your Algolia Search-only API Key (public).
20 | - `Admin API Key` - Your Algolia ADMIN API Key (kept private).
21 | - `Index name prefix` - This prefix will be prepended to your index names.
22 | - `Algolia logo` - Algolia requires that you keep the logo if you are using a free plan.
23 |
24 | ### Note
25 | - If you have a large amount of data, it will be synchronized to algolia server auto when plugin configuration completed. If you need to know the specific progress, you need to check the console log information yourself.
26 |
--------------------------------------------------------------------------------
/search-algolia/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: algolia-search
19 | type: search
20 | version: 1.2.11
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/search-algolia
23 |
--------------------------------------------------------------------------------
/search-elasticsearch/README.md:
--------------------------------------------------------------------------------
1 | # Elasticsearch Engine (preview)
2 | > The default Answer uses a built-in database such as MySQL as its search engine.
3 | > However, when dealing with large amounts of data, the speed and accuracy of searches can be affected.
4 | > Therefore, we provide a plugin that uses Elasticsearch as the search engine, which greatly improves search speed and accuracy.
5 |
6 | ## How to use
7 |
8 | ### Build
9 | ```bash
10 | ./answer build --with github.com/apache/answer-plugins/search-elasticsearch
11 | ```
12 |
13 | ### Configuration
14 | - `Endpoints` - Elasticsearch connection address, such as http://127.0.0.1:9200 or multiple addresses separated by ','
15 | - `Username` - Elasticsearch username
16 | - `Password` - Elasticsearch password
17 |
18 | ## Note
19 | - Only support Elasticsearch 7.x
20 | - Index name is `answer_post`. It will create automatically if not exists.
21 | - You also can create index manually if you want to specify `search_analyzer` or other settings(replicas and shards).
22 |
--------------------------------------------------------------------------------
/search-elasticsearch/es_log.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package es
21 |
22 | import (
23 | "github.com/olivere/elastic/v7"
24 | "github.com/segmentfault/pacman/log"
25 | "net/http"
26 | "net/http/httputil"
27 | )
28 |
29 | type LoggingHttpClient struct {
30 | c http.Client
31 | }
32 |
33 | func (l LoggingHttpClient) Do(r *http.Request) (*http.Response, error) {
34 | requestDump, err := httputil.DumpRequest(r, true)
35 | if err != nil {
36 | log.Errorf("dump request failed: %s", err.Error())
37 | return nil, err
38 | }
39 | log.Debugf("es search request: %s", string(requestDump))
40 | return l.c.Do(r)
41 | }
42 |
43 | type ErrLogger struct {
44 | }
45 |
46 | func (l ErrLogger) Printf(format string, v ...interface{}) {
47 | log.Errorf(format, v...)
48 | }
49 |
50 | func NewErrLogger() elastic.Logger {
51 | return &ErrLogger{}
52 | }
53 |
--------------------------------------------------------------------------------
/search-elasticsearch/i18n/en_US.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | es_search:
20 | backend:
21 | info:
22 | name:
23 | other: Elasticsearch Engine
24 | description:
25 | other: Use Elasticsearch as search engine
26 | config:
27 | endpoints:
28 | title:
29 | other: Endpoints
30 | description:
31 | other: Elasticsearch connection address, such as http://127.0.0.1:9200 or multiple addresses separated by ','
32 | username:
33 | title:
34 | other: Username
35 | description:
36 | other: Elasticsearch username
37 | password:
38 | title:
39 | other: Password
40 | description:
41 | other: Elasticsearch password
42 |
--------------------------------------------------------------------------------
/search-elasticsearch/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.es_search.backend.info.name"
24 | InfoDescription = "plugin.es_search.backend.info.description"
25 |
26 | ConfigEndpointsTitle = "plugin.es_search.backend.config.endpoints.title"
27 | ConfigEndpointsDescription = "plugin.es_search.backend.config.endpoints.description"
28 |
29 | ConfigUsernameTitle = "plugin.es_search.backend.config.username.title"
30 | ConfigUsernameDescription = "plugin.es_search.backend.config.username.description"
31 |
32 | ConfigPasswordTitle = "plugin.es_search.backend.config.password.title"
33 | ConfigPasswordDescription = "plugin.es_search.backend.config.password.description"
34 | )
35 |
--------------------------------------------------------------------------------
/search-elasticsearch/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | es_search:
20 | backend:
21 | info:
22 | name:
23 | other: Elasticsearch 引擎
24 | description:
25 | other: 使用 Elasticsearch 作为搜索引擎
26 | config:
27 | endpoints:
28 | title:
29 | other: 连接地址
30 | description:
31 | other: Elasticsearch 连接地址,如 http://127.0.0.1:9200 或多个地址以 ',' 分隔
32 | username:
33 | title:
34 | other: 用户名
35 | description:
36 | other: Elasticsearch 用户名
37 | password:
38 | title:
39 | other: 密码
40 | description:
41 | other: Elasticsearch 密码
--------------------------------------------------------------------------------
/search-elasticsearch/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: es_search
19 | type: search
20 | version: 1.2.10
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/search-elasticsearch
23 |
--------------------------------------------------------------------------------
/search-meilisearch/README.md:
--------------------------------------------------------------------------------
1 | # Meilisearch (preview)
2 | > Meilisearch is A lightning-fast search engine that fits effortlessly into your apps, websites, and workflow 🔍
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/search-meilisearch
9 | ```
10 |
11 | ### Configuration
12 | - `Host` - Meilisearch connection address, such as http://127.0.0.1:7700
13 | - `ApiKey` - Meilisearch api key
14 | - `IndexName` - The index answer will use. Default is `answer_post`
15 | - `Async` - Should answer use async mode to send data to Meilisearch. Default is `false`. use Async means you will not get any error message if Meilisearch task failed.
16 |
--------------------------------------------------------------------------------
/search-meilisearch/i18n/translation.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package i18n
21 |
22 | const (
23 | InfoName = "plugin.meilisearch_search.backend.info.name"
24 | InfoDescription = "plugin.meilisearch_search.backend.info.description"
25 |
26 | ConfigHostTitle = "plugin.meilisearch_search.backend.config.host.title"
27 | ConfigHostDescription = "plugin.meilisearch_search.backend.config.host.description"
28 | ConfigIndexTitle = "plugin.meilisearch_search.backend.config.index_name.title"
29 | ConfigIndexDescription = "plugin.meilisearch_search.backend.config.index_name.description"
30 | ConfigAsyncTitle = "plugin.meilisearch_search.backend.config.async.title"
31 | ConfigAsyncDescription = "plugin.meilisearch_search.backend.config.async.description"
32 | ConfigApiKeyTitle = "plugin.meilisearch_search.backend.config.api_key.title"
33 | ConfigApiKeyDescription = "plugin.meilisearch_search.backend.config.api_key.description"
34 | )
35 |
--------------------------------------------------------------------------------
/search-meilisearch/i18n/zh_CN.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | plugin:
19 | meilisearch_search:
20 | backend:
21 | info:
22 | name:
23 | other: MeiliSearch
24 | description:
25 | other: MeiliSearch 是一个强大、快速、开源、易于使用和部署的搜索引擎。
26 | config:
27 | host:
28 | title:
29 | other: 服务地址
30 | description:
31 | other: MeiliSearch 服务的地址,如:http://127.0.0.1:7700
32 | api_key:
33 | title:
34 | other: API密钥
35 | description:
36 | other: MeiliSearch 服务的API Key
37 | index_name:
38 | title:
39 | other: 索引名称
40 | description:
41 | other: 索引不存在时会自动被创建
42 | async:
43 | title:
44 | other: 阻塞
45 | description:
46 | other: 开启时,将阻塞等待直至 Meilisearch 的任务完成
47 |
--------------------------------------------------------------------------------
/search-meilisearch/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: meilisearch_search
19 | type: search
20 | version: 1.2.9
21 | author: sivdead
22 | link: https://github.com/apache/answer-plugins/tree/main/search-meilisearch
23 |
--------------------------------------------------------------------------------
/storage-aliyunoss/README.md:
--------------------------------------------------------------------------------
1 | # Aliyun OSS Storage
2 | > This plugin can be used to store attachments and avatars to Aliyun OSS.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/storage-aliyunoss
9 | ```
10 |
11 | ### Configuration
12 | - `Endpoint` - Endpoint of AliCloud OSS storage, such as oss-cn-hangzhou.aliyuncs.com
13 | - `Bucket Name` - Your bucket name
14 | - `Object Key Prefix` - Prefix of the object key like 'answer/data/' that ending with '/'
15 | - `Access Key Id` - AccessKeyID of the AliCloud OSS storage
16 | - `Access Key Secret` - AccessKeySecret of the AliCloud OSS storage
17 | - `Visit Url Prefix` - Prefix of access address for the uploaded file, ending with '/' such as https://example.com/xxx/
--------------------------------------------------------------------------------
/storage-aliyunoss/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: aliyunoss_storage
19 | type: storage
20 | version: 1.2.13
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/storage-aliyunoss
23 |
--------------------------------------------------------------------------------
/storage-s3/README.md:
--------------------------------------------------------------------------------
1 | # S3 Storage
2 | > This plugin can be used to store attachments and avatars to AWS S3.
3 |
4 | ## How to use
5 |
6 | ### Build
7 | ```bash
8 | ./answer build --with github.com/apache/answer-plugins/storage-s3
9 | ```
10 |
11 | ### Configuration
12 | - `Endpoint` - Endpoint of the AWS S3 storage
13 | - `Bucket Name` - Your bucket name
14 | - `Object Key Prefix` - Prefix of the object key like 'answer/data/' that ending with '/'
15 | - `Access Key Id` - AccessKeyId of the S3
16 | - `Access Key Secret` - AccessKeySecret of the S3
17 | - `Access Token` - AccessToken of the S3
18 | - `Visit Url Prefix` - Prefix of access address for the uploaded file, ending with '/' such as https://example.com/xxx/
--------------------------------------------------------------------------------
/storage-s3/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: s3_storage
19 | type: storage
20 | version: 1.2.12
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/storage-s3
23 |
--------------------------------------------------------------------------------
/storage-tencentyuncos/README.md:
--------------------------------------------------------------------------------
1 | # Tencent COS Storage
2 |
3 | > This plugin can be used to store attachments and avatars to Tencent COS.
4 |
5 | ## How to use
6 |
7 | ### Build
8 |
9 | ```bash
10 | ./answer build --with github.com/apache/answer-plugins/storage-tencentyuncos
11 | ```
12 |
13 | ### Configuration
14 |
15 | - `Region` - Region of Tencent COS storage, like 'ap-beijing'
16 | - `Bucket Name` - Your bucket name
17 | - `Object Key Prefix` - Prefix of the object key like 'answer/data/' that ending with '/'
18 | - `Secret ID` - Secret ID of the Tencent COS storage
19 | - `Secret Key` - Secret Key of the Tencent COS storage
20 | - `Visit Url Prefix` - Prefix of access address for the uploaded file, ending with '/' such as https://example.com/xxx/
21 |
--------------------------------------------------------------------------------
/storage-tencentyuncos/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: tencentyuncos_storage
19 | type: storage
20 | version: 1.0.4
21 | author: Luffy
22 | link: https://github.com/apache/answer-plugins/tree/main/storage-tencentyuncos
23 |
--------------------------------------------------------------------------------
/user-center-slack/README.md:
--------------------------------------------------------------------------------
1 | # Slack User Center
2 |
3 | ## Feature
4 |
5 | - User login via slack Account
6 |
7 | ## Config
8 |
9 | To use this plugin, you need to create [a Slack App](https://api.slack.com/quickstart) first, set the Scope and Redirect URL correctly, and copy the `Client ID`, `Client Secrect`, `Signing Secret` and `Webhook URL`. To activate the Slash Command function, you also need to set the `slash command` in your app. Here are default settings you can try:
10 |
11 | > Scope: chat:write, commands, groups:write, im:write, incoming-webhook, mpim:write, users:read, users:read.email
12 | >
13 | > RedirectURL: https://Your_Site_URL/answer/api/v1/user-center/login/callback
14 | >
15 | > Slash command:
16 | >
17 | > * Command: /ask
18 | > * Requesti URL: https://Your_Site_URL/answer/api/v1/slack/slash
19 | > * Usage Hint: [Title][Content\][Tag1,Tag2...\]
20 |
21 |
22 |
23 | - `Client ID`: Slack App Client ID
24 |
25 | - `Client Secret`: Slack App Secret
26 |
27 | - `Signing Secret`: Slack App Signing Secret
28 |
29 | - `Webhook URL`: find in the `Incoming Webhooks` feature, such as `https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX`
30 |
31 |
32 | Note: A Redirect URL must also use HTTPS. You can configure a Redirect URL and scope in the **App Management** page under **OAuth & Permissions**.
33 |
34 | ## Document
35 | - https://api.slack.com/quickstart
36 | - https://api.slack.com/authentication/oauth-v2
37 | - https://api.slack.com/messaging/webhooks
38 | - https://api.slack.com/interactivity/slash-commands
--------------------------------------------------------------------------------
/user-center-slack/cron.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package slack_user_center
21 |
22 | import (
23 | "time"
24 |
25 | "github.com/segmentfault/pacman/log"
26 | )
27 |
28 | func (uc *UserCenter) CronSyncData() {
29 | go func() {
30 | ticker := time.NewTicker(time.Hour)
31 | // defer ticker.Stop()
32 |
33 | for {
34 | select {
35 | case <-ticker.C:
36 | log.Infof("UserCenter is syncing Slack user data")
37 | uc.syncSlackClient()
38 | }
39 | }
40 | }()
41 | }
42 |
--------------------------------------------------------------------------------
/user-center-slack/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: slack_user_center
19 | type: user_center
20 | version: 1.0.4
21 | author: AnanChen
22 | link: https://github.com/apache/answer-plugins/tree/main/user-center-slack
23 |
--------------------------------------------------------------------------------
/user-center-wecom/README.md:
--------------------------------------------------------------------------------
1 | # WeCom User Center
2 | ## Feature
3 | - User login via WeCom QRCode
4 |
5 | ## Config
6 | > You need to create a WeCom App first, and then get the `Corp ID`, `Agent ID` and `App Secret` from the App.
7 |
8 | - `Company ID`: WeCom Corp ID
9 | - `App Secret`: WeCom App Secret
10 | - `App Agent ID`: WeCom App Agent ID
11 |
12 | Note: WeCom restricts the ip address of the callback url, so you need to add the ip address of the server where the project is located to the callback url.
13 |
14 | ## Preview
15 | 
16 | 
17 | 
18 |
19 | ## Document
20 | - https://developer.work.weixin.qq.com/document/path/90664
--------------------------------------------------------------------------------
/user-center-wecom/cron.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package wecom
21 |
22 | import (
23 | "time"
24 |
25 | "github.com/segmentfault/pacman/log"
26 | )
27 |
28 | func (uc *UserCenter) CronSyncData() {
29 | go func() {
30 | ticker := time.NewTicker(time.Hour)
31 | for {
32 | select {
33 | case <-ticker.C:
34 | log.Infof("user center try to sync data")
35 | uc.syncCompany()
36 | }
37 | }
38 | }()
39 | }
40 |
--------------------------------------------------------------------------------
/user-center-wecom/docs/wecom-config.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/user-center-wecom/docs/wecom-config.png
--------------------------------------------------------------------------------
/user-center-wecom/docs/wecom-login.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/user-center-wecom/docs/wecom-login.png
--------------------------------------------------------------------------------
/user-center-wecom/docs/wecom-qrcode.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/apache/answer-plugins/80072ff8cc4523fb87538d3a57eb56f1da9a1a9c/user-center-wecom/docs/wecom-qrcode.png
--------------------------------------------------------------------------------
/user-center-wecom/info.yaml:
--------------------------------------------------------------------------------
1 | # Licensed to the Apache Software Foundation (ASF) under one
2 | # or more contributor license agreements. See the NOTICE file
3 | # distributed with this work for additional information
4 | # regarding copyright ownership. The ASF licenses this file
5 | # to you under the Apache License, Version 2.0 (the
6 | # "License"); you may not use this file except in compliance
7 | # with the License. You may obtain a copy of the License at
8 | #
9 | # http://www.apache.org/licenses/LICENSE-2.0
10 | #
11 | # Unless required by applicable law or agreed to in writing,
12 | # software distributed under the License is distributed on an
13 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 | # KIND, either express or implied. See the License for the
15 | # specific language governing permissions and limitations
16 | # under the License.
17 |
18 | slug_name: wecom_user_center
19 | type: user_center
20 | version: 1.2.9
21 | author: answerdev
22 | link: https://github.com/apache/answer-plugins/tree/main/user-center-wecom
23 |
--------------------------------------------------------------------------------
/util/go.mod:
--------------------------------------------------------------------------------
1 | module github.com/apache/answer-plugins/util
2 |
3 | go 1.22.0
4 |
5 | require gopkg.in/yaml.v3 v3.0.1
6 |
--------------------------------------------------------------------------------
/util/go.sum:
--------------------------------------------------------------------------------
1 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
3 | gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
4 | gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
5 |
--------------------------------------------------------------------------------
/util/util.go:
--------------------------------------------------------------------------------
1 | /*
2 | * Licensed to the Apache Software Foundation (ASF) under one
3 | * or more contributor license agreements. See the NOTICE file
4 | * distributed with this work for additional information
5 | * regarding copyright ownership. The ASF licenses this file
6 | * to you under the Apache License, Version 2.0 (the
7 | * "License"); you may not use this file except in compliance
8 | * with the License. You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing,
13 | * software distributed under the License is distributed on an
14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | * KIND, either express or implied. See the License for the
16 | * specific language governing permissions and limitations
17 | * under the License.
18 | */
19 |
20 | package util
21 |
22 | import (
23 | "embed"
24 | "fmt"
25 | "gopkg.in/yaml.v3"
26 | )
27 |
28 | type Info struct {
29 | SlugName string `yaml:"slug_name"`
30 | Type string `yaml:"type"`
31 | Version string `yaml:"version"`
32 | Author string `yaml:"author"`
33 | Link string `yaml:"link"`
34 | }
35 |
36 | func (c *Info) GetInfo(info embed.FS) *Info {
37 | yamlFile, err := info.ReadFile("info.yaml")
38 | if err != nil {
39 | fmt.Println(err)
40 | }
41 | err = yaml.Unmarshal(yamlFile, c)
42 | if err != nil {
43 | fmt.Println(err)
44 | }
45 | return c
46 | }
47 |
--------------------------------------------------------------------------------