decap-cms-backend-gitea 3.1.6-beta.0 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,7 +3,13 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [3.1.6-beta.0](https://github.com/decaporg/decap-cms/compare/decap-cms-backend-gitea@3.1.5...decap-cms-backend-gitea@3.1.6-beta.0) (2024-08-14)
6
+ # [3.3.0](https://github.com/decaporg/decap-cms/compare/decap-cms-backend-gitea@3.1.5...decap-cms-backend-gitea@3.3.0) (2025-07-15)
7
+
8
+ ### Features
9
+
10
+ - add logo to header ([#7487](https://github.com/decaporg/decap-cms/issues/7487)) ([b540ace](https://github.com/decaporg/decap-cms/commit/b540acec943eb231df6aac7b1d515d9b4b84fa5d))
11
+
12
+ # [3.2.0](https://github.com/decaporg/decap-cms/compare/decap-cms-backend-gitea@3.1.5...decap-cms-backend-gitea@3.2.0) (2025-06-26)
7
13
 
8
14
  **Note:** Version bump only for package decap-cms-backend-gitea
9
15
 
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DecapCmsBackendGitea",[],t):"object"==typeof exports?exports.DecapCmsBackendGitea=t():e.DecapCmsBackendGitea=t()}(window,(()=>(()=>{"use strict";var e={};return e.DecapCmsBackendGitea})()));
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("DecapCmsBackendGitea",[],t):"object"==typeof exports?exports.DecapCmsBackendGitea=t():e.DecapCmsBackendGitea=t()}(window,()=>(()=>{"use strict";var e={};return e.DecapCmsBackendGitea})());
2
2
  //# sourceMappingURL=decap-cms-backend-gitea.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"decap-cms-backend-gitea.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,uBAAwB,GAAIH,GACT,iBAAZC,QACdA,QAA8B,qBAAID,IAElCD,EAA2B,qBAAIC,GAChC,CATD,CASGK,QAAQ,I","sources":["webpack://DecapCmsBackendGitea/webpack/universalModuleDefinition"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DecapCmsBackendGitea\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DecapCmsBackendGitea\"] = factory();\n\telse\n\t\troot[\"DecapCmsBackendGitea\"] = factory();\n})(window, () => {\nreturn "],"names":["root","factory","exports","module","define","amd","window"],"sourceRoot":""}
1
+ {"version":3,"file":"decap-cms-backend-gitea.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,uBAAwB,GAAIH,GACT,iBAAZC,QACdA,QAA8B,qBAAID,IAElCD,EAA2B,qBAAIC,GAChC,CATD,CASGK,OAAQ,I","sources":["webpack://DecapCmsBackendGitea/webpack/universalModuleDefinition"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"DecapCmsBackendGitea\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"DecapCmsBackendGitea\"] = factory();\n\telse\n\t\troot[\"DecapCmsBackendGitea\"] = factory();\n})(window, () => {\nreturn "],"names":["root","factory","exports","module","define","amd","window"],"sourceRoot":""}
package/dist/esm/API.js CHANGED
@@ -1,46 +1,20 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = exports.API_NAME = void 0;
7
- var _initial2 = _interopRequireDefault(require("lodash/initial"));
8
- var _last2 = _interopRequireDefault(require("lodash/last"));
9
- var _partial2 = _interopRequireDefault(require("lodash/partial"));
10
- var _result2 = _interopRequireDefault(require("lodash/result"));
11
- var _trim2 = _interopRequireDefault(require("lodash/trim"));
12
- var _trimStart2 = _interopRequireDefault(require("lodash/trimStart"));
13
- var _jsBase = require("js-base64");
14
- var _decapCmsLibUtil = require("decap-cms-lib-util");
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
20
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
21
- const API_NAME = exports.API_NAME = 'Gitea';
1
+ import { Base64 } from 'js-base64';
2
+ import trimStart from 'lodash/trimStart';
3
+ import trim from 'lodash/trim';
4
+ import result from 'lodash/result';
5
+ import partial from 'lodash/partial';
6
+ import last from 'lodash/last';
7
+ import initial from 'lodash/initial';
8
+ import { APIError, basename, generateContentKey, getAllResponses, localForage, parseContentKey, readFileMetadata, requestWithBackoff, unsentRequest } from 'decap-cms-lib-util';
9
+ export const API_NAME = 'Gitea';
22
10
  var FileOperation = /*#__PURE__*/function (FileOperation) {
23
11
  FileOperation["CREATE"] = "create";
24
12
  FileOperation["DELETE"] = "delete";
25
13
  FileOperation["UPDATE"] = "update";
26
14
  return FileOperation;
27
15
  }(FileOperation || {});
28
- class API {
16
+ export default class API {
29
17
  constructor(config) {
30
- _defineProperty(this, "apiRoot", void 0);
31
- _defineProperty(this, "token", void 0);
32
- _defineProperty(this, "branch", void 0);
33
- _defineProperty(this, "repo", void 0);
34
- _defineProperty(this, "originRepo", void 0);
35
- _defineProperty(this, "repoOwner", void 0);
36
- _defineProperty(this, "repoName", void 0);
37
- _defineProperty(this, "originRepoOwner", void 0);
38
- _defineProperty(this, "originRepoName", void 0);
39
- _defineProperty(this, "repoURL", void 0);
40
- _defineProperty(this, "originRepoURL", void 0);
41
- _defineProperty(this, "_userPromise", void 0);
42
- _defineProperty(this, "_metadataSemaphore", void 0);
43
- _defineProperty(this, "commitAuthor", void 0);
44
18
  this.apiRoot = config.apiRoot || 'https://try.gitea.io/api/v1';
45
19
  this.token = config.token || '';
46
20
  this.branch = config.branch || 'master';
@@ -54,6 +28,7 @@ class API {
54
28
  this.originRepoOwner = originRepoParts[0];
55
29
  this.originRepoName = originRepoParts[1];
56
30
  }
31
+ static DEFAULT_COMMIT_MESSAGE = 'Automatically generated by Static CMS';
57
32
  user() {
58
33
  if (!this._userPromise) {
59
34
  this._userPromise = this.getUser();
@@ -78,9 +53,10 @@ class API {
78
53
  // no op
79
54
  }
80
55
  requestHeaders(headers = {}) {
81
- const baseHeader = _objectSpread({
82
- 'Content-Type': 'application/json; charset=utf-8'
83
- }, headers);
56
+ const baseHeader = {
57
+ 'Content-Type': 'application/json; charset=utf-8',
58
+ ...headers
59
+ };
84
60
  if (this.token) {
85
61
  baseHeader.Authorization = `token ${this.token}`;
86
62
  return Promise.resolve(baseHeader);
@@ -120,23 +96,25 @@ class API {
120
96
  return textPromise;
121
97
  }
122
98
  handleRequestError(error, responseStatus) {
123
- throw new _decapCmsLibUtil.APIError(error.message, responseStatus, API_NAME);
99
+ throw new APIError(error.message, responseStatus, API_NAME);
124
100
  }
125
101
  buildRequest(req) {
126
102
  return req;
127
103
  }
128
104
  async request(path, options = {}, parser = response => this.parseResponse(response)) {
129
- options = _objectSpread({
130
- cache: 'no-cache'
131
- }, options);
105
+ options = {
106
+ cache: 'no-cache',
107
+ ...options
108
+ };
132
109
  const headers = await this.requestHeaders(options.headers || {});
133
110
  const url = this.urlFor(path, options);
134
111
  let responseStatus = 500;
135
112
  try {
136
- const req = _decapCmsLibUtil.unsentRequest.fromFetchArguments(url, _objectSpread(_objectSpread({}, options), {}, {
113
+ const req = unsentRequest.fromFetchArguments(url, {
114
+ ...options,
137
115
  headers
138
- }));
139
- const response = await (0, _decapCmsLibUtil.requestWithBackoff)(this, req);
116
+ });
117
+ const response = await requestWithBackoff(this, req);
140
118
  responseStatus = response.status;
141
119
  const parsedResponse = await parser(response);
142
120
  return parsedResponse;
@@ -149,22 +127,24 @@ class API {
149
127
  return url => url;
150
128
  }
151
129
  async requestAllPages(url, options = {}) {
152
- options = _objectSpread({
153
- cache: 'no-cache'
154
- }, options);
130
+ options = {
131
+ cache: 'no-cache',
132
+ ...options
133
+ };
155
134
  const headers = await this.requestHeaders(options.headers || {});
156
135
  const processedURL = this.urlFor(url, options);
157
- const allResponses = await (0, _decapCmsLibUtil.getAllResponses)(processedURL, _objectSpread(_objectSpread({}, options), {}, {
136
+ const allResponses = await getAllResponses(processedURL, {
137
+ ...options,
158
138
  headers
159
- }), 'next', this.nextUrlProcessor());
139
+ }, 'next', this.nextUrlProcessor());
160
140
  const pages = await Promise.all(allResponses.map(res => this.parseResponse(res)));
161
141
  return [].concat(...pages);
162
142
  }
163
143
  generateContentKey(collectionName, slug) {
164
- return (0, _decapCmsLibUtil.generateContentKey)(collectionName, slug);
144
+ return generateContentKey(collectionName, slug);
165
145
  }
166
146
  parseContentKey(contentKey) {
167
- return (0, _decapCmsLibUtil.parseContentKey)(contentKey);
147
+ return parseContentKey(contentKey);
168
148
  }
169
149
  async readFile(path, sha, {
170
150
  branch = this.branch,
@@ -208,7 +188,7 @@ class API {
208
188
  };
209
189
  }
210
190
  };
211
- const fileMetadata = await (0, _decapCmsLibUtil.readFileMetadata)(sha, fetchFileMetadata, _decapCmsLibUtil.localForage);
191
+ const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
212
192
  return fileMetadata;
213
193
  }
214
194
  async fetchBlobContent({
@@ -221,11 +201,11 @@ class API {
221
201
  });
222
202
  if (parseText) {
223
203
  // treat content as a utf-8 string
224
- const content = _jsBase.Base64.decode(result.content);
204
+ const content = Base64.decode(result.content);
225
205
  return content;
226
206
  } else {
227
207
  // treat content as binary and convert to blob
228
- const content = _jsBase.Base64.atob(result.content);
208
+ const content = Base64.atob(result.content);
229
209
  const byteArray = new Uint8Array(content.length);
230
210
  for (let i = 0; i < content.length; i++) {
231
211
  byteArray[i] = content.charCodeAt(i);
@@ -239,7 +219,7 @@ class API {
239
219
  branch = this.branch,
240
220
  depth = 1
241
221
  } = {}, folderSupport) {
242
- const folder = (0, _trim2.default)(path, '/');
222
+ const folder = trim(path, '/');
243
223
  try {
244
224
  const result = await this.request(`${repoURL}/git/trees/${branch}:${encodeURIComponent(folder)}`, {
245
225
  // Gitea API supports recursive=1 for getting the entire recursive tree
@@ -253,7 +233,7 @@ class API {
253
233
  .filter(file => (!folderSupport ? file.type === 'blob' : true) && decodeURIComponent(file.path).split('/').length <= depth).map(file => ({
254
234
  type: file.type,
255
235
  id: file.sha,
256
- name: (0, _decapCmsLibUtil.basename)(file.path),
236
+ name: basename(file.path),
257
237
  path: `${folder}/${file.path}`,
258
238
  size: file.size
259
239
  }));
@@ -285,18 +265,18 @@ class API {
285
265
  }
286
266
  async getChangeFileOperations(files, branch) {
287
267
  const items = await Promise.all(files.map(async file => {
288
- const content = await (0, _result2.default)(file, 'toBase64', (0, _partial2.default)(this.toBase64, file.raw));
268
+ const content = await result(file, 'toBase64', partial(this.toBase64, file.raw));
289
269
  let sha;
290
270
  let operation;
291
271
  let from_path;
292
- let path = (0, _trimStart2.default)(file.path, '/');
272
+ let path = trimStart(file.path, '/');
293
273
  try {
294
274
  sha = await this.getFileSha(file.path, {
295
275
  branch
296
276
  });
297
277
  operation = FileOperation.UPDATE;
298
278
  from_path = file.newPath && path;
299
- path = file.newPath ? (0, _trimStart2.default)(file.newPath, '/') : path;
279
+ path = file.newPath ? trimStart(file.newPath, '/') : path;
300
280
  } catch {
301
281
  sha = undefined;
302
282
  operation = FileOperation.CREATE;
@@ -322,8 +302,8 @@ class API {
322
302
  */
323
303
 
324
304
  const pathArray = path.split('/');
325
- const filename = (0, _last2.default)(pathArray);
326
- const directory = (0, _initial2.default)(pathArray).join('/');
305
+ const filename = last(pathArray);
306
+ const directory = initial(pathArray).join('/');
327
307
  const fileDataPath = encodeURIComponent(directory);
328
308
  const fileDataURL = `${repoURL}/git/trees/${branch}:${fileDataPath}`;
329
309
  const result = await this.request(fileDataURL);
@@ -331,7 +311,7 @@ class API {
331
311
  if (file) {
332
312
  return file.sha;
333
313
  } else {
334
- throw new _decapCmsLibUtil.APIError('Not Found', 404, API_NAME);
314
+ throw new APIError('Not Found', 404, API_NAME);
335
315
  }
336
316
  }
337
317
  async deleteFiles(paths, message) {
@@ -348,8 +328,6 @@ class API {
348
328
  });
349
329
  }
350
330
  toBase64(str) {
351
- return Promise.resolve(_jsBase.Base64.encode(str));
331
+ return Promise.resolve(Base64.encode(str));
352
332
  }
353
- }
354
- exports.default = API;
355
- _defineProperty(API, "DEFAULT_COMMIT_MESSAGE", 'Automatically generated by Static CMS');
333
+ }
@@ -1,21 +1,11 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _base = _interopRequireDefault(require("@emotion/styled/base"));
8
- var _react = _interopRequireDefault(require("react"));
9
- var _propTypes = _interopRequireDefault(require("prop-types"));
10
- var _decapCmsLibAuth = require("decap-cms-lib-auth");
11
- var _decapCmsUiDefault = require("decap-cms-ui-default");
12
- var _react2 = require("@emotion/react");
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
16
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
+ import _styled from "@emotion/styled/base";
17
2
  function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
18
- const LoginButtonIcon = /*#__PURE__*/(0, _base.default)(_decapCmsUiDefault.Icon, {
3
+ import React from 'react';
4
+ import PropTypes from 'prop-types';
5
+ import { PkceAuthenticator } from 'decap-cms-lib-auth';
6
+ import { AuthenticationPage, Icon } from 'decap-cms-ui-default';
7
+ import { jsx as ___EmotionJSX } from "@emotion/react";
8
+ const LoginButtonIcon = /*#__PURE__*/_styled(Icon, {
19
9
  target: "es1j68m0",
20
10
  label: "LoginButtonIcon"
21
11
  })(process.env.NODE_ENV === "production" ? {
@@ -23,35 +13,25 @@ const LoginButtonIcon = /*#__PURE__*/(0, _base.default)(_decapCmsUiDefault.Icon,
23
13
  styles: "margin-right:18px"
24
14
  } : {
25
15
  name: "1gnqu05",
26
- styles: "margin-right:18px",
27
- map: "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9BdXRoZW50aWNhdGlvblBhZ2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBTW9DIiwiZmlsZSI6Ii4uLy4uL3NyYy9BdXRoZW50aWNhdGlvblBhZ2UuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUmVhY3QgZnJvbSAncmVhY3QnO1xuaW1wb3J0IFByb3BUeXBlcyBmcm9tICdwcm9wLXR5cGVzJztcbmltcG9ydCBzdHlsZWQgZnJvbSAnQGVtb3Rpb24vc3R5bGVkJztcbmltcG9ydCB7IFBrY2VBdXRoZW50aWNhdG9yIH0gZnJvbSAnZGVjYXAtY21zLWxpYi1hdXRoJztcbmltcG9ydCB7IEF1dGhlbnRpY2F0aW9uUGFnZSwgSWNvbiB9IGZyb20gJ2RlY2FwLWNtcy11aS1kZWZhdWx0JztcblxuY29uc3QgTG9naW5CdXR0b25JY29uID0gc3R5bGVkKEljb24pYFxuICBtYXJnaW4tcmlnaHQ6IDE4cHg7XG5gO1xuXG5leHBvcnQgZGVmYXVsdCBjbGFzcyBHaXRlYUF1dGhlbnRpY2F0aW9uUGFnZSBleHRlbmRzIFJlYWN0LkNvbXBvbmVudCB7XG4gIHN0YXRpYyBwcm9wVHlwZXMgPSB7XG4gICAgaW5Qcm9ncmVzczogUHJvcFR5cGVzLmJvb2wsXG4gICAgY29uZmlnOiBQcm9wVHlwZXMub2JqZWN0LmlzUmVxdWlyZWQsXG4gICAgb25Mb2dpbjogUHJvcFR5cGVzLmZ1bmMuaXNSZXF1aXJlZCxcbiAgICB0OiBQcm9wVHlwZXMuZnVuYy5pc1JlcXVpcmVkLFxuICB9O1xuXG4gIHN0YXRlID0ge307XG5cbiAg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c2V0U3RhdGUoeyBsb2dpbkVycm9yOiBlcnIudG9TdHJpbmcoKSB9KTtcbiAgICAgICAgcmV0dXJuO1xuICAgICAgfVxuICAgICAgdGhpcy5wcm9wcy5vbkxvZ2luKGRhdGEpO1xuICAgIH0pO1xuICB9O1xuXG4gIHJlbmRlcigpIHtcbiAgICBjb25zdCB7IGluUHJvZ3Jlc3MsIGNvbmZpZywgdCB9ID0gdGhpcy5wcm9wcztcbiAgICByZXR1cm4gKFxuICAgICAgPEF1dGhlbnRpY2F0aW9uUGFnZVxuICAgICAgICBvbkxvZ2luPXt0aGlzLmhhbmRsZUxvZ2lufVxuICAgICAgICBsb2dpbkRpc2FibGVkPXtpblByb2dyZXNzfVxuICAgICAgICBsb2dpbkVycm9yTWVzc2FnZT17dGhpcy5zdGF0ZS5sb2dpbkVycm9yfVxuICAgICAgICBsb2dvVXJsPXtjb25maWcubG9nb191cmx9XG4gICAgICAgIHNpdGVVcmw9e2NvbmZpZy5zaXRlX3VybH1cbiAgICAgICAgcmVuZGVyQnV0dG9uQ29udGVudD17KCkgPT4gKFxuICAgICAgICAgIDxSZWFjdC5GcmFnbWVudD5cbiAgICAgICAgICAgIDxMb2dpbkJ1dHRvbkljb24gdHlwZT1cImdpdGVhXCIgLz57JyAnfVxuICAgICAgICAgICAge2luUHJvZ3Jlc3MgPyB0KCdhdXRoLmxvZ2dpbmdJbicpIDogdCgnYXV0aC5sb2dpbldpdGhHaXRlYScpfVxuICAgICAgICAgIDwvUmVhY3QuRnJhZ21lbnQ+XG4gICAgICAgICl9XG4gICAgICAgIHQ9e3R9XG4gICAgICAvPlxuICAgICk7XG4gIH1cbn1cbiJdfQ== */",
16
+ styles: "margin-right:18px/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9BdXRoZW50aWNhdGlvblBhZ2UuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBTW9DIiwiZml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gKGVyciwgZGF0YSkgPT4ge1xuICAgICAgaWYgKGVycikge1xuICAgICAgICB0aGlzLnNldFN0YXRlKHsgbG9naW5FcnJvcjogZXJyLnRvU3RyaW5nKCkgfSk7XG4gICAgICAgIHJldHVybjtcbiAgICAgIH1cbiAgICAgIHRoaXMucHJvcHMub25Mb2dpbihkYXRhKTtcbiAgICB9KTtcbiAgfTtcblxuICByZW5kZXIoKSB7XG4gICAgY29uc3QgeyBpblByb2dyZXNzLCBjb25maWcsIHQgfSA9IHRoaXMucHJvcHM7XG4gICAgcmV0dXJuIChcbiAgICAgIDxBdXRoZW50aWNhdGlvblBhZ2VcbiAgICAgICAgb25Mb2dpbj17dGhpcy5oYW5kbGVMb2dpbn1cbiAgICAgICAgbG9naW5EaXNhYmxlZD17aW5Qcm9ncmVzc31cbiAgICAgICAgbG9naW5FcnJvck1lc3NhZ2U9e3RoaXMuc3RhdGUubG9naW5FcnJvcn1cbiAgICAgICAgbG9nb1VybD17Y29uZmlnLmxvZ29fdXJsfSAvLyBEZXByZWNhdGVkLCByZXBsYWNlZCBieSBgbG9nby5zcmNgXG4gICAgICAgIGxvZ289e2NvbmZpZy5sb2dvfVxuICAgICAgICBzaXRlVXJsPXtjb25maWcuc2l0ZV91cmx9XG4gICAgICAgIHJlbmRlckJ1dHRvbkNvbnRlbnQ9eygpID0+IChcbiAgICAgICAgICA8UmVhY3QuRnJhZ21lbnQ+XG4gICAgICAgICAgICA8TG9naW5CdXR0b25JY29uIHR5cGU9XCJnaXRlYVwiIC8+eycgJ31cbiAgICAgICAgICAgIHtpblByb2dyZXNzID8gdCgnYXV0aC5sb2dnaW5nSW4nKSA6IHQoJ2F1dGgubG9naW5XaXRoR2l0ZWEnKX1cbiAgICAgICAgICA8L1JlYWN0LkZyYWdtZW50PlxuICAgICAgICApfVxuICAgICAgICB0PXt0fVxuICAgICAgLz5cbiAgICApO1xuICB9XG59XG4iXX0= */",
28
17
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
29
18
  });
30
- class GiteaAuthenticationPage extends _react.default.Component {
31
- constructor(...args) {
32
- super(...args);
33
- _defineProperty(this, "state", {});
34
- _defineProperty(this, "handleLogin", e => {
35
- e.preventDefault();
36
- this.auth.authenticate({
37
- scope: 'repository'
38
- }, (err, data) => {
39
- if (err) {
40
- this.setState({
41
- loginError: err.toString()
42
- });
43
- return;
44
- }
45
- this.props.onLogin(data);
46
- });
47
- });
48
- }
19
+ export default class GiteaAuthenticationPage extends React.Component {
20
+ static propTypes = {
21
+ inProgress: PropTypes.bool,
22
+ config: PropTypes.object.isRequired,
23
+ onLogin: PropTypes.func.isRequired,
24
+ t: PropTypes.func.isRequired
25
+ };
26
+ state = {};
49
27
  componentDidMount() {
28
+ // Manually validate PropTypes - React 19 breaking change
29
+ PropTypes.checkPropTypes(GiteaAuthenticationPage.propTypes, this.props, 'prop', 'GiteaAuthenticationPage');
50
30
  const {
51
31
  base_url = 'https://try.gitea.io',
52
32
  app_id = ''
53
33
  } = this.props.config.backend;
54
- this.auth = new _decapCmsLibAuth.PkceAuthenticator({
34
+ this.auth = new PkceAuthenticator({
55
35
  base_url,
56
36
  auth_endpoint: 'login/oauth/authorize',
57
37
  app_id,
@@ -70,29 +50,38 @@ class GiteaAuthenticationPage extends _react.default.Component {
70
50
  }
71
51
  });
72
52
  }
53
+ handleLogin = e => {
54
+ e.preventDefault();
55
+ this.auth.authenticate({
56
+ scope: 'repository'
57
+ }, (err, data) => {
58
+ if (err) {
59
+ this.setState({
60
+ loginError: err.toString()
61
+ });
62
+ return;
63
+ }
64
+ this.props.onLogin(data);
65
+ });
66
+ };
73
67
  render() {
74
68
  const {
75
69
  inProgress,
76
70
  config,
77
71
  t
78
72
  } = this.props;
79
- return (0, _react2.jsx)(_decapCmsUiDefault.AuthenticationPage, {
73
+ return ___EmotionJSX(AuthenticationPage, {
80
74
  onLogin: this.handleLogin,
81
75
  loginDisabled: inProgress,
82
76
  loginErrorMessage: this.state.loginError,
83
- logoUrl: config.logo_url,
77
+ logoUrl: config.logo_url // Deprecated, replaced by `logo.src`
78
+ ,
79
+ logo: config.logo,
84
80
  siteUrl: config.site_url,
85
- renderButtonContent: () => (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)(LoginButtonIcon, {
81
+ renderButtonContent: () => ___EmotionJSX(React.Fragment, null, ___EmotionJSX(LoginButtonIcon, {
86
82
  type: "gitea"
87
83
  }), ' ', inProgress ? t('auth.loggingIn') : t('auth.loginWithGitea')),
88
84
  t: t
89
85
  });
90
86
  }
91
- }
92
- exports.default = GiteaAuthenticationPage;
93
- _defineProperty(GiteaAuthenticationPage, "propTypes", {
94
- inProgress: _propTypes.default.bool,
95
- config: _propTypes.default.object.isRequired,
96
- onLogin: _propTypes.default.func.isRequired,
97
- t: _propTypes.default.func.isRequired
98
- });
87
+ }
@@ -1,78 +1,21 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _commonTags = require("common-tags");
8
- var _trimStart = _interopRequireDefault(require("lodash/trimStart"));
9
- var _semaphore = _interopRequireDefault(require("semaphore"));
10
- var _decapCmsLibUtil = require("decap-cms-lib-util");
11
- var _API = _interopRequireWildcard(require("./API"));
12
- var _AuthenticationPage = _interopRequireDefault(require("./AuthenticationPage"));
13
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
18
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
19
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
20
- function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
+ import { stripIndent } from 'common-tags';
2
+ import trimStart from 'lodash/trimStart';
3
+ import semaphore from 'semaphore';
4
+ import { asyncLock, basename, blobToFileObj, Cursor, CURSOR_COMPATIBILITY_SYMBOL, entriesByFiles, entriesByFolder, filterByExtension, getBlobSHA, getMediaAsBlob, getMediaDisplayURL, runWithLock, unsentRequest } from 'decap-cms-lib-util';
5
+ import API, { API_NAME } from './API';
6
+ import AuthenticationPage from './AuthenticationPage';
21
7
  const MAX_CONCURRENT_DOWNLOADS = 10;
22
8
  const {
23
9
  fetchWithTimeout: fetch
24
- } = _decapCmsLibUtil.unsentRequest;
25
- class Gitea {
10
+ } = unsentRequest;
11
+ export default class Gitea {
26
12
  constructor(config, options = {}) {
27
- var _config$backend$branc;
28
- _defineProperty(this, "lock", void 0);
29
- _defineProperty(this, "api", void 0);
30
- _defineProperty(this, "options", void 0);
31
- _defineProperty(this, "originRepo", void 0);
32
- _defineProperty(this, "repo", void 0);
33
- _defineProperty(this, "branch", void 0);
34
- _defineProperty(this, "apiRoot", void 0);
35
- _defineProperty(this, "mediaFolder", void 0);
36
- _defineProperty(this, "token", void 0);
37
- _defineProperty(this, "_currentUserPromise", void 0);
38
- _defineProperty(this, "_userIsOriginMaintainerPromises", void 0);
39
- _defineProperty(this, "_mediaDisplayURLSem", void 0);
40
- _defineProperty(this, "getCursorAndFiles", (files, page) => {
41
- const pageSize = 20;
42
- const count = files.length;
43
- const pageCount = Math.ceil(files.length / pageSize);
44
- const actions = [];
45
- if (page > 1) {
46
- actions.push('prev');
47
- actions.push('first');
48
- }
49
- if (page < pageCount) {
50
- actions.push('next');
51
- actions.push('last');
52
- }
53
- const cursor = _decapCmsLibUtil.Cursor.create({
54
- actions,
55
- meta: {
56
- page,
57
- count,
58
- pageSize,
59
- pageCount
60
- },
61
- data: {
62
- files
63
- }
64
- });
65
- const pageFiles = files.slice((page - 1) * pageSize, page * pageSize);
66
- return {
67
- cursor,
68
- files: pageFiles
69
- };
70
- });
71
- this.options = _objectSpread({
13
+ this.options = {
72
14
  proxied: false,
73
15
  API: null,
74
- useWorkflow: false
75
- }, options);
16
+ useWorkflow: false,
17
+ ...options
18
+ };
76
19
  if (!this.options.proxied && (config.backend.repo === null || config.backend.repo === undefined)) {
77
20
  throw new Error('The Gitea backend needs a "repo" in the backend configuration.');
78
21
  }
@@ -81,21 +24,20 @@ class Gitea {
81
24
  }
82
25
  this.api = this.options.API || null;
83
26
  this.repo = this.originRepo = config.backend.repo || '';
84
- this.branch = ((_config$backend$branc = config.backend.branch) === null || _config$backend$branc === void 0 ? void 0 : _config$backend$branc.trim()) || 'master';
27
+ this.branch = config.backend.branch?.trim() || 'master';
85
28
  this.apiRoot = config.backend.api_root || 'https://try.gitea.io/api/v1';
86
29
  this.token = '';
87
30
  this.mediaFolder = config.media_folder;
88
- this.lock = (0, _decapCmsLibUtil.asyncLock)();
31
+ this.lock = asyncLock();
89
32
  }
90
33
  isGitBackend() {
91
34
  return true;
92
35
  }
93
36
  async status() {
94
- var _this$api;
95
- const auth = (await ((_this$api = this.api) === null || _this$api === void 0 ? void 0 : _this$api.user().then(user => !!user).catch(e => {
37
+ const auth = (await this.api?.user().then(user => !!user).catch(e => {
96
38
  console.warn('[StaticCMS] Failed getting Gitea user', e);
97
39
  return false;
98
- }))) || false;
40
+ })) || false;
99
41
  return {
100
42
  auth: {
101
43
  status: auth
@@ -107,7 +49,7 @@ class Gitea {
107
49
  };
108
50
  }
109
51
  authComponent() {
110
- return _AuthenticationPage.default;
52
+ return AuthenticationPage;
111
53
  }
112
54
  restoreUser(user) {
113
55
  return this.authenticate(user);
@@ -145,7 +87,7 @@ class Gitea {
145
87
  }
146
88
  async authenticate(state) {
147
89
  this.token = state.token;
148
- const apiCtor = _API.default;
90
+ const apiCtor = API;
149
91
  this.api = new apiCtor({
150
92
  token: this.token,
151
93
  branch: this.branch,
@@ -155,7 +97,7 @@ class Gitea {
155
97
  });
156
98
  const user = await this.api.user();
157
99
  const isCollab = await this.api.hasWriteAccess().catch(error => {
158
- error.message = (0, _commonTags.stripIndent)`
100
+ error.message = stripIndent`
159
101
  Repo "${this.repo}" not found.
160
102
 
161
103
  Please ensure the repo information is spelled correctly.
@@ -190,6 +132,37 @@ class Gitea {
190
132
  getToken() {
191
133
  return Promise.resolve(this.token);
192
134
  }
135
+ getCursorAndFiles = (files, page) => {
136
+ const pageSize = 20;
137
+ const count = files.length;
138
+ const pageCount = Math.ceil(files.length / pageSize);
139
+ const actions = [];
140
+ if (page > 1) {
141
+ actions.push('prev');
142
+ actions.push('first');
143
+ }
144
+ if (page < pageCount) {
145
+ actions.push('next');
146
+ actions.push('last');
147
+ }
148
+ const cursor = Cursor.create({
149
+ actions,
150
+ meta: {
151
+ page,
152
+ count,
153
+ pageSize,
154
+ pageCount
155
+ },
156
+ data: {
157
+ files
158
+ }
159
+ });
160
+ const pageFiles = files.slice((page - 1) * pageSize, page * pageSize);
161
+ return {
162
+ cursor,
163
+ files: pageFiles
164
+ };
165
+ };
193
166
  async entriesByFolder(folder, extension, depth) {
194
167
  const repoURL = this.api.originRepoURL;
195
168
  let cursor;
@@ -197,7 +170,7 @@ class Gitea {
197
170
  repoURL,
198
171
  depth
199
172
  }).then(files => {
200
- const filtered = files.filter(file => (0, _decapCmsLibUtil.filterByExtension)(file, extension));
173
+ const filtered = files.filter(file => filterByExtension(file, extension));
201
174
  const result = this.getCursorAndFiles(filtered, 1);
202
175
  cursor = result.cursor;
203
176
  return result.files;
@@ -205,10 +178,10 @@ class Gitea {
205
178
  const readFile = (path, id) => this.api.readFile(path, id, {
206
179
  repoURL
207
180
  });
208
- const files = await (0, _decapCmsLibUtil.entriesByFolder)(listFiles, readFile, this.api.readFileMetadata.bind(this.api), _API.API_NAME);
181
+ const files = await entriesByFolder(listFiles, readFile, this.api.readFileMetadata.bind(this.api), API_NAME);
209
182
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
210
183
  // @ts-ignore
211
- files[_decapCmsLibUtil.CURSOR_COMPATIBILITY_SYMBOL] = cursor;
184
+ files[CURSOR_COMPATIBILITY_SYMBOL] = cursor;
212
185
  return files;
213
186
  }
214
187
  async allEntriesByFolder(folder, extension, depth) {
@@ -216,13 +189,13 @@ class Gitea {
216
189
  const listFiles = () => this.api.listFiles(folder, {
217
190
  repoURL,
218
191
  depth
219
- }).then(files => files.filter(file => (0, _decapCmsLibUtil.filterByExtension)(file, extension)));
192
+ }).then(files => files.filter(file => filterByExtension(file, extension)));
220
193
  const readFile = (path, id) => {
221
194
  return this.api.readFile(path, id, {
222
195
  repoURL
223
196
  });
224
197
  };
225
- const files = await (0, _decapCmsLibUtil.entriesByFolder)(listFiles, readFile, this.api.readFileMetadata.bind(this.api), _API.API_NAME);
198
+ const files = await entriesByFolder(listFiles, readFile, this.api.readFileMetadata.bind(this.api), API_NAME);
226
199
  return files;
227
200
  }
228
201
  entriesByFiles(files) {
@@ -230,7 +203,7 @@ class Gitea {
230
203
  const readFile = (path, id) => this.api.readFile(path, id, {
231
204
  repoURL
232
205
  }).catch(() => '');
233
- return (0, _decapCmsLibUtil.entriesByFiles)(files, readFile, this.api.readFileMetadata.bind(this.api), _API.API_NAME);
206
+ return entriesByFiles(files, readFile, this.api.readFileMetadata.bind(this.api), API_NAME);
234
207
  }
235
208
 
236
209
  // Fetches a single entry.
@@ -277,11 +250,11 @@ class Gitea {
277
250
  }));
278
251
  }
279
252
  async getMediaFile(path) {
280
- const blob = await (0, _decapCmsLibUtil.getMediaAsBlob)(path, null, this.api.readFile.bind(this.api));
281
- const name = (0, _decapCmsLibUtil.basename)(path);
282
- const fileObj = (0, _decapCmsLibUtil.blobToFileObj)(name, blob);
253
+ const blob = await getMediaAsBlob(path, null, this.api.readFile.bind(this.api));
254
+ const name = basename(path);
255
+ const fileObj = blobToFileObj(name, blob);
283
256
  const url = URL.createObjectURL(fileObj);
284
- const id = await (0, _decapCmsLibUtil.getBlobSHA)(blob);
257
+ const id = await getBlobSHA(blob);
285
258
  return {
286
259
  id,
287
260
  displayURL: url,
@@ -293,12 +266,12 @@ class Gitea {
293
266
  };
294
267
  }
295
268
  getMediaDisplayURL(displayURL) {
296
- this._mediaDisplayURLSem = this._mediaDisplayURLSem || (0, _semaphore.default)(MAX_CONCURRENT_DOWNLOADS);
297
- return (0, _decapCmsLibUtil.getMediaDisplayURL)(displayURL, this.api.readFile.bind(this.api), this._mediaDisplayURLSem);
269
+ this._mediaDisplayURLSem = this._mediaDisplayURLSem || semaphore(MAX_CONCURRENT_DOWNLOADS);
270
+ return getMediaDisplayURL(displayURL, this.api.readFile.bind(this.api), this._mediaDisplayURLSem);
298
271
  }
299
272
  persistEntry(entry, options) {
300
273
  // persistEntry is a transactional operation
301
- return (0, _decapCmsLibUtil.runWithLock)(this.lock, () => this.api.persistFiles(entry.dataFiles, entry.assets, options), 'Failed to acquire persist entry lock');
274
+ return runWithLock(this.lock, () => this.api.persistFiles(entry.dataFiles, entry.assets, options), 'Failed to acquire persist entry lock');
302
275
  }
303
276
  async persistMedia(mediaFile, options) {
304
277
  try {
@@ -314,7 +287,7 @@ class Gitea {
314
287
  name: fileObj.name,
315
288
  size: fileObj.size,
316
289
  displayURL,
317
- path: (0, _trimStart.default)(path, '/')
290
+ path: trimStart(path, '/')
318
291
  };
319
292
  } catch (error) {
320
293
  console.error(error);
@@ -358,7 +331,7 @@ class Gitea {
358
331
  const readFile = (path, id) => this.api.readFile(path, id, {
359
332
  repoURL: this.api.originRepoURL
360
333
  }).catch(() => '');
361
- const entries = await (0, _decapCmsLibUtil.entriesByFiles)(result.files, readFile, this.api.readFileMetadata.bind(this.api), _API.API_NAME);
334
+ const entries = await entriesByFiles(result.files, readFile, this.api.readFileMetadata.bind(this.api), API_NAME);
362
335
  return {
363
336
  entries,
364
337
  cursor: result.cursor
@@ -393,5 +366,4 @@ class Gitea {
393
366
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
394
367
  return {};
395
368
  }
396
- }
397
- exports.default = Gitea;
369
+ }
package/dist/esm/index.js CHANGED
@@ -1,27 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "API", {
7
- enumerable: true,
8
- get: function () {
9
- return _API.default;
10
- }
11
- });
12
- Object.defineProperty(exports, "AuthenticationPage", {
13
- enumerable: true,
14
- get: function () {
15
- return _AuthenticationPage.default;
16
- }
17
- });
18
- Object.defineProperty(exports, "GiteaBackend", {
19
- enumerable: true,
20
- get: function () {
21
- return _implementation.default;
22
- }
23
- });
24
- var _implementation = _interopRequireDefault(require("./implementation"));
25
- var _API = _interopRequireDefault(require("./API"));
26
- var _AuthenticationPage = _interopRequireDefault(require("./AuthenticationPage"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
1
+ export { default as GiteaBackend } from './implementation';
2
+ export { default as API } from './API';
3
+ export { default as AuthenticationPage } from './AuthenticationPage';
package/dist/esm/types.js CHANGED
@@ -1,5 +1 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
1
+ export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "decap-cms-backend-gitea",
3
3
  "description": "Gitea backend for Decap CMS",
4
- "version": "3.1.6-beta.0",
4
+ "version": "3.3.0",
5
5
  "repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-backend-gitea",
6
6
  "bugs": "https://github.com/decaporg/decap-cms/issues",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "immutable": "^3.7.6",
32
32
  "lodash": "^4.17.11",
33
33
  "prop-types": "^15.7.2",
34
- "react": "17.x || 18.x"
34
+ "react": "^19.1.0"
35
35
  },
36
- "gitHead": "0f91300093c3c074f50c7af8f20a4ad331806e62"
36
+ "gitHead": "d3465f53b7f056ad5d872948a07eaa8e4ae63315"
37
37
  }
package/src/API.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import { Base64 } from 'js-base64';
2
- import { trimStart, trim, result, partial, last, initial } from 'lodash';
2
+ import trimStart from 'lodash/trimStart';
3
+ import trim from 'lodash/trim';
4
+ import result from 'lodash/result';
5
+ import partial from 'lodash/partial';
6
+ import last from 'lodash/last';
7
+ import initial from 'lodash/initial';
3
8
  import {
4
9
  APIError,
5
10
  basename,
@@ -19,6 +19,14 @@ export default class GiteaAuthenticationPage extends React.Component {
19
19
  state = {};
20
20
 
21
21
  componentDidMount() {
22
+ // Manually validate PropTypes - React 19 breaking change
23
+ PropTypes.checkPropTypes(
24
+ GiteaAuthenticationPage.propTypes,
25
+ this.props,
26
+ 'prop',
27
+ 'GiteaAuthenticationPage',
28
+ );
29
+
22
30
  const { base_url = 'https://try.gitea.io', app_id = '' } = this.props.config.backend;
23
31
  this.auth = new PkceAuthenticator({
24
32
  base_url,
@@ -56,7 +64,8 @@ export default class GiteaAuthenticationPage extends React.Component {
56
64
  onLogin={this.handleLogin}
57
65
  loginDisabled={inProgress}
58
66
  loginErrorMessage={this.state.loginError}
59
- logoUrl={config.logo_url}
67
+ logoUrl={config.logo_url} // Deprecated, replaced by `logo.src`
68
+ logo={config.logo}
60
69
  siteUrl={config.site_url}
61
70
  renderButtonContent={() => (
62
71
  <React.Fragment>