Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(backend): add gitea backend #6808

Merged
merged 12 commits into from
Oct 19, 2023
Merged
63 changes: 63 additions & 0 deletions dev-test/backends/gitea/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
backend:
name: gitea
app_id: a582de8c-2459-4e5f-b671-80f99a0592cc
branch: master
repo: owner/repo

media_folder: static/media
public_folder: /media
collections:
- name: posts
label: Posts
label_singular: 'Post'
folder: content/posts
create: true
slug: '{{year}}-{{month}}-{{day}}-{{slug}}'
fields:
- label: Template
name: template
widget: hidden
default: post
- label: Title
name: title
widget: string
- label: 'Cover Image'
name: 'image'
widget: 'image'
required: false
- label: Publish Date
name: date
widget: datetime
- label: Description
name: description
widget: text
- label: Category
name: category
widget: string
- label: Body
name: body
widget: markdown
- label: Tags
name: tags
widget: list
- name: pages
label: Pages
label_singular: 'Page'
folder: content/pages
create: true
slug: '{{slug}}'
fields:
- label: Template
name: template
widget: hidden
default: page
- label: Title
name: title
widget: string
- label: Draft
name: draft
widget: boolean
default: true
- label: Body
name: body
widget: markdown
41 changes: 41 additions & 0 deletions dev-test/backends/gitea/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />

<title>Decap CMS Development Test</title>
</head>
<body>
<script src="/dist/decap-cms.js"></script>
<script>
var PostPreview = createClass({
render: function() {
var entry = this.props.entry;
return h(
'div',
{},
h('div', { className: 'cover' }, h('h1', {}, entry.getIn(['data', 'title']))),
h('p', {}, h('small', {}, 'Written ' + entry.getIn(['data', 'date']))),
h('div', { className: 'text' }, this.props.widgetFor('body')),
);
},
});

var PagePreview = createClass({
render: function() {
var entry = this.props.entry;
return h(
'div',
{},
h('div', { className: 'cover' }, h('h1', {}, entry.getIn(['data', 'title']))),
h('p', {}, h('small', {}, 'Written ' + entry.getIn(['data', 'date']))),
h('div', { className: 'text' }, this.props.widgetFor('body')),
);
},
});

CMS.registerPreviewTemplate('posts', PostPreview);
CMS.registerPreviewTemplate('pages', PagePreview);
</script>
</body>
</html>
2 changes: 2 additions & 0 deletions packages/decap-cms-app/src/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { DecapCmsCore as CMS } from 'decap-cms-core';
import { AzureBackend } from 'decap-cms-backend-azure';
import { GitHubBackend } from 'decap-cms-backend-github';
import { GitLabBackend } from 'decap-cms-backend-gitlab';
import { GiteaBackend } from 'decap-cms-backend-gitea';
import { GitGatewayBackend } from 'decap-cms-backend-git-gateway';
import { BitbucketBackend } from 'decap-cms-backend-bitbucket';
import { TestBackend } from 'decap-cms-backend-test';
Expand Down Expand Up @@ -34,6 +35,7 @@ CMS.registerBackend('git-gateway', GitGatewayBackend);
CMS.registerBackend('azure', AzureBackend);
CMS.registerBackend('github', GitHubBackend);
CMS.registerBackend('gitlab', GitLabBackend);
CMS.registerBackend('gitea', GiteaBackend);
CMS.registerBackend('bitbucket', BitbucketBackend);
CMS.registerBackend('test-repo', TestBackend);
CMS.registerBackend('proxy', ProxyBackend);
Expand Down
36 changes: 36 additions & 0 deletions packages/decap-cms-backend-gitea/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "decap-cms-backend-gitea",
"description": "Gitea backend for Decap CMS",
"version": "3.0.2",
"repository": "https://github.com/decaporg/decap-cms/tree/master/packages/decap-cms-backend-gitea",
"bugs": "https://github.com/decaporg/decap-cms/issues",
"license": "MIT",
"module": "dist/esm/index.js",
"main": "dist/decap-cms-backend-gitea.js",
"keywords": [
"decap-cms",
"backend",
"gitea"
],
"sideEffects": false,
"scripts": {
"develop": "yarn build:esm --watch",
"build": "cross-env NODE_ENV=production webpack",
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
},
"dependencies": {
"js-base64": "^3.0.0",
"semaphore": "^1.1.0"
},
"peerDependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"immutable": "^3.7.6",
"lodash": "^4.17.11",
"decap-cms-lib-auth": "^3.0.0",
"decap-cms-lib-util": "^3.0.0",
"decap-cms-ui-default": "^3.0.0",
"prop-types": "^15.7.2",
"react": "^16.8.4 || ^17.0.0"
}
}
Loading
Loading