├── .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 | ![./imgs/install.png](./imgs/install.png) 16 | 17 | - Step 2: Generate your web3 wallet. 18 | 19 | ![./imgs/create.png](./imgs/create.png) 20 | 21 | ![./imgs/wallet.png](./imgs/wallet.png) 22 | 23 | 24 | - Step3: Build your answer with golang and register the plugin. 25 | 26 | ![./imgs/activate.png](./imgs/activate.png) 27 | 28 | - Step4: Log in through your wallet and bind to your email. 29 | ![./imgs/click1.png](./imgs/click1.png) 30 | 31 | ![./imgs/click2.png](./imgs/click2.png) 32 | 33 | ![./imgs/bind.png](./imgs/bind.png) 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 | 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 | 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 |