1423 Commits

Author SHA1 Message Date
init
a391ae08f9 fix api bug 2025-06-03 20:11:57 -07:00
init
6b85dc6a4d feature-permission 2025-06-03 20:11:57 -07:00
Levi Yan
cd2d2a4d25 devcontainer works
- localhost doesn't work,you should config domain name or IP Address
2025-03-29 06:26:42 +00:00
孟宁
75343aca1e !53 整理了devcontainer的部分代码,只是修改了文件目录结构和命名,没有对代码进行本质上的改动
* fixed /api/devcontainer/user
* 修改了models/devcontainer目录下的文件命名
* 整理了devcontainer的部分代码,只是修改了文件目录结构和命名,没有对代码进行本质上的改动
2025-02-17 05:36:49 +00:00
孟宁
0557a744c0 !52 通过场景码SceneStr区分用户登录不同的部署版本,优化了代码
* 修改了微信公众号关注事件和文本消息的响应
* 通过场景码SceneStr区分用户登录不同的部署版本,优化了代码
* 兼容线上/api/wechat/official-account相关API
* 对第三方依赖中的PowerWeChat和officialAccount等字符串进行了本地化抽象,以Wechat和wechat_sdk命名可读性更好
* Merge branch 'dev' into refactoring-wechat-qr-code
* 梳理了routers到auth_service的代码,wechat_service还需要进一步整理
* 对代码文件目录结构进行了重构,内在逻辑还没有重构
* wechat相关路径中删掉了无意义的official-account字符串
2025-02-14 10:41:45 +00:00
xinitx
e31075b296 !50 devcontainer页面功能实现及代码结构优化
### devcontainer页面功能实现

- devcontainer.json 可以正常编辑
- 可以创建devcontainer, **但是首次创建需要docker pull 容器镜像会造成系统卡死的情况,需要后续优化** 
- 可以open with WebTerminal, **但是进入的WebTerminal当前目录并不是当前项目目录下**
- 修改后的容器可以docker commit为新的容器镜像

### devcontainer代码结构优化

docker相关操作都放在了modules/docker/docker_api.go
2025-02-13 05:56:32 +00:00
xinitx
e6d1dbb381 !46 [DIP-2][DevContainer] 添加 WebSSH 和 保存镜像功能、更新了DevContainer相关的配置
* 合并devcontainer web相关的源文件,简化目录结构
* devcontainer、ssh_key_pair和devcontainer.cloud
* fixed bug:创建容器时Host为localhost时创建失败的问题
* 删除了死代码,更新了一些命名(主要是去掉devstar字符串)
* 常量名全大写
* devcontainer HOST改为用户设置的域名或IP
* 安装时如没有配置devcontainer则默认设置为docker方式
* 直接使用kubernetes和docker简化代码提高可读性
* 去除services/devstar_devcontainer文件夹名中不必要的devstar字符串
* 去除services/devstar_devcontainer文件夹名中不必要的devstar字符串
* 文件名中去掉不必要的devstar字符串
* 变量名中删除不必要的Devstar字符串
* Merge branch 'dev' into feature-websshAndUpdateImage
* change pages style
* change Structure
* fix bug
* websshAndUpdateImage
2025-01-07 01:25:54 +00:00
戴明辰
0f3ad27e7f [Feature][API] Added GET /api/v1/label/templates2
* Added GET /api/v1/label/templates2
2024-12-24 03:07:04 +00:00
戴明辰
40a41ac3e2 [Feature][API] 增加API用于创建仓库获取预定义选项列表:ReadMe, Object Format
* Added APIs to display creating repo option lists
2024-12-23 08:46:56 +00:00
孟宁
3edc4ce1e4 [DIP-1] 微信公众号二维码登录:本地部署与线上部署双端共用代码
* 恢复误删了的从未登录状态下的页面登录后跳转到当前页的功能
* secret是敏感信息,不能打印在日志里面
* fixed bug: 根据配置AppID和AppSecret来createPowerWechatApp
* 完成本地部署微信二维码登录功能,用户设置绑定微信的功能本地测试正常
* 本地部署可以扫码跳转注册页面,尚未查询用户数据
* 本地部署的后端已经可以和devstar.cn上的微信代理API打通,但是还没有调用本地用户认证相关代码,功能上还不完整
* 优化了signin navbar前端显示逻辑,根据app.ini配置使能wechat qr和openid
* 增加wechat配置项,以便同时支持直接和间接的微信二维码登录
* 恢复openid原有的初始配置方法
* 默认支持微信二维码登录(仅在安装配置上实现,功能上尚未实现),默认disabled openid
* "Initial commit from " + gitURL + " ( " + sha1 + " ) "
2024-12-10 08:41:20 +00:00
戴明辰
c96928b972 [DIP-1][WeChat] WeChat QR Signup, Login, and Unbind
* WeChat QR Sign Up, Login, and Unbind
* Add QR Refresh Icon
* refactor wechat QR login, and apply Gitea `APIContexter`
* GET /api/wechat/official-account/generate-qr-code?qrExpireSeconds=${qrExpireSeconds}&sceneStr=${sceneStr}
2024-11-07 10:12:13 +00:00
xinitx
71e6803a6d !19 [Doc][Fix] 修改 ReadMe 和 CORS相关代码
* change ReadMe
* change cors api
2024-11-05 01:36:52 +00:00
xinitx
8d5b34e07e !16 [Feature] DevContainer 适配 Docker
* [Chore] format code style
* [Chore] go mod tidy
* remove deprecated config
* Update services/devstar_devcontainer/docker_agent/AssignDevcontainerCr…
2024-10-31 03:00:11 +00:00
戴明辰
c92eeecf06 !15 [Fix] WeChat QR Login
* [Fix] QR Expiration Mask too dark
* [Refactor] Deprecated in-memory cache, ready for Redis
* [Doc] Resolve WeChat QR config conflict in k8s mode
* [Fix] WeChat QR Login by default
2024-10-30 01:17:59 +00:00
戴明辰
e73016cfe7 !11 [Fix] changed API Field name and mitigated defunct(zombie) processes
* [Fix] zombie processes caused by `tail -f /dev/null`
* [Fix] Rename field in API **GET** `/api/devstar_ssh/key_pair/new_temp`: `publicKeyFingerprint` -> `publicKeySsh`
2024-10-28 04:09:09 +00:00
戴明辰
c1ea93e233 !10 [Feature][Fix][Doc] Tencent NAT Auto-Portforwarding
* [Fix] Relocate User Permanent SSH Public Key queries to DevcontainerService Layer
* [Fix] Add Unix Timestamps in DB table `devstar_devcontainer`
* [Feature] Tencent NAT port forwarding
* [Doc] k8s Operator RBAC: ServiceAccount, ClusterRole, ClusterRoleBinding, etc.
* [fix] k8s Operator Reconciler error while converting YAML to JSON
* [Doc] Added DevStar API Doc
* [fix] detailed errors while listing user devcontainers
* [fix] Invalid metadata.labels: value must be no more than 63 characters
2024-10-23 03:05:44 +00:00
戴明辰
1fa57bca2d !9 [Feature] git clone repo before opening DevContainer
* [fix] SSH Connection refused
* [fix] retrieve NodePort upon ready
* [feature] git clone repo upon initialization
2024-10-14 06:58:43 +00:00
戴明辰
6bb8bba3aa !8 Added SSH Public Key Login For DevContainer
* [Feature] Added DevContainer Public Key Login, and deprecated SSH Password login
* [Improvement] Anti-spam
* GET /api/devstar_ssh/key_pair/new_temp: SSH Keypair Gen
* fix HTTP 500 error while deleting Repo
* updated DevContainer WorkDIR
* updated warn msg
2024-10-13 12:07:28 +00:00
戴明辰
4b6f1b9cb5 !6 k8s Agent for DevStar DevContainer
* DELETE /api/devcontainer?repoId=${repoId} 删除 DevContainer
* refactor
* GET /api/devcontainer?repoId=${repoId}&wait=true 阻塞式等待打开就绪的 DevContainer
* POST /api/devcontainer 创建 DevContainer
* refactored the code
* Updated context usage with cancel function
* 预留接口,适配单机版 DevStar DevContainer
* bugFix: context canceled while deleting k8s CRD DevcontainerApp
* 用户界面删除 k8s CRD DevContainer
* 用户界面创建 DevContainer 并更新 NodePort
* 完成用户界面创建 DevContainer
* transplant test code into DevStar Studio
* refactored API router to /routers/api
* 更改 DevContainer Doc
* 更改 DevContainer namespace
* 特殊仓库重定向
* [Doc] 更新 Kubernetes 部署 DevStar Studio 文档说明,特别是 namespace 管理
* [Doc] 更新 CI脚本说明
* Revert "optimized CI workflow"
* optimized CI workflow
* fix typo
* [feature test]: 测试 Pod 内使用 Kubernetes Operator 功能
* [Optimization] error msg for archived repo
* [Optimization]: display detailed err msg on creating devContainer for …
2024-09-30 06:48:01 +00:00
wxiaoguang
43c7a2e7b1 Refactor names (#31405)
This PR only does "renaming":

* `Route` should be `Router` (and chi router is also called "router")
* `Params` should be `PathParam` (to distingush it from URL query param, and to match `FormString`)
* Use lower case for private functions to avoid exposing or abusing
2024-06-19 06:32:45 +08:00
wxiaoguang
0f09c22663 Improve rubygems package registry (#31357)
To make it work with Bundler:
https://guides.rubygems.org/rubygems-org-compact-index-api/

It only adds 2 new API endpoints and improves some tests, existing logic
is not changed.
2024-06-17 08:42:46 +00:00
Brecht Van Lommel
597d1da96b Fix missing images in editor preview due to wrong links (#31299)
Parse base path and tree path so that media links can be correctly
created with /media/.

Resolves #31294

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-06-17 14:16:14 +08:00
6543
78e8296e11 Rename repo_model.SearchOrderByMap to repo_model.OrderByMap (#31359)
https://github.com/go-gitea/gitea/pull/30876#discussion_r1637112394
2024-06-15 06:45:02 +00:00
wxiaoguang
84cbb6c4d2 Fix duplicate sub-path for avatars (#31365)
Fix #31361, and add tests

And this PR introduces an undocumented & debug-purpose-only config
option: `USE_SUB_URL_PATH`. It does nothing for end users, it only helps
the development of sub-path related problems.

And also fix #31366

Co-authored-by: @ExplodingDragon
2024-06-15 11:43:57 +08:00
mzroot
d4e4226c3c Add tag protection via rest api #17862 (#31295)
Add tag protection manage via rest API.

---------

Co-authored-by: Alexander Kogay <kogay.a@citilink.ru>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-06-14 18:56:10 +02:00
6543
bb04311b0b [Refactor] Unify repo search order by logic (#30876)
have repo OrderBy definitions defined in one place and use a single type
for OrderBy database options
2024-06-13 09:13:11 +00:00
Rowan Bohde
45dbeb5600 Reduce memory usage for chunked artifact uploads to MinIO (#31325)
When using the MinIO storage driver for Actions Artifacts, we found that
the chunked artifact required significantly more memory usage to both
upload and merge than the local storage driver. This seems to be related
to hardcoding a value of `-1` for the size to the MinIO client [which
has a warning about memory usage in the respective
docs](https://pkg.go.dev/github.com/minio/minio-go/v7#Client.PutObject).
Specifying the size in both the upload and merge case reduces memory
usage of the MinIO client.

Co-authored-by: Kyle D <kdumontnu@gmail.com>
2024-06-12 11:34:35 +00:00
silverwind
fc2d75f86d Enable unparam linter (#31277)
Enable [unparam](https://github.com/mvdan/unparam) linter.

Often I could not tell the intention why param is unused, so I put
`//nolint` for those cases like webhook request creation functions never
using `ctx`.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2024-06-11 18:47:45 +00:00
wxiaoguang
6106a61eff Remove sub-path from container registry realm (#31293)
Container registry requires that the "/v2" must be in the root, so the
sub-path in AppURL should be removed
2024-06-09 16:29:29 +08:00
Thomas Desveaux
c888c933a9 Fix NuGet Package API for $filter with Id equality (#31188)
Fixes issue when running `choco info pkgname` where `pkgname` is also a
substring of another package Id.

Relates to #31168

---

This might fix the issue linked, but I'd like to test it with more choco
commands before closing the issue in case I find other problems if
that's ok.

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-06-04 06:45:56 +00:00
Lunny Xiao
352a2cae24 Performance improvements for pull request list API (#30490)
Fix #30483

---------

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2024-05-31 12:10:11 +00:00
Lunny Xiao
fb7b743bd0 Azure blob storage support (#30995)
This PR implemented object storages(LFS/Packages/Attachments and etc.)
for Azure Blob Storage. It depends on azure official golang SDK and can
support both the azure blob storage cloud service and azurite mock
server.

Replace #25458
Fix #22527 

- [x] CI Tests
- [x] integration test, MSSQL integration tests will now based on
azureblob
  - [x] unit test 
- [x] CLI Migrate Storage
- [x] Documentation for configuration added

------

TODO (other PRs):
- [ ] Improve performance of `blob download`.

---------

Co-authored-by: yp05327 <576951401@qq.com>
2024-05-30 07:33:50 +00:00
Jörg Thalheim
4fe415683e Add an immutable tarball link to archive download headers for Nix (#31139)
This allows `nix flake metadata` and nix in general to lock a *branch*
tarball link in a manner that causes it to fetch the correct commit even
if the branch is updated with a newer version.

Co-authored-by: Jade Lovelace <software@lfcode.ca>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-05-28 15:30:34 +00:00
Lunny Xiao
b6f15c7948 Add missed return after ctx.ServerError (#31130) 2024-05-28 12:31:59 +03:00
metiftikci
aa92b13164 Prevent simultaneous editing of comments and issues (#31053)
fixes #22907 

Tested:
- [x] issue content edit
- [x] issue content change tasklist
- [x] pull request content edit
- [x] pull request change tasklist

![issue-content-edit](https://github.com/go-gitea/gitea/assets/29250154/a0828889-fb96-4bc4-8600-da92e3205812)
2024-05-27 15:34:18 +00:00
wxiaoguang
edbf74c418 Fix "force private" logic (#31012)
When creating a repo, the "FORCE_PRIVATE" config option should be
respected, `readonly` doesn't work for checkbox, so it should use
`disabled` attribute.
2024-05-20 00:56:45 +00:00
wxiaoguang
339bc8bc8f Improve reverse proxy documents and clarify the AppURL guessing behavior (#31003)
Fix #31002

1. Mention Make sure `Host` and `X-Fowarded-Proto` headers are correctly passed to Gitea
2. Clarify the basic requirements and move the "general configuration" to the top
3. Add a comment for the "container registry"
4. Use 1.21 behavior if the reverse proxy is not correctly configured

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-05-19 14:56:08 +00:00
Lunny Xiao
58a03e9fad Fix bug on avatar (#31008)
Co-authored-by: silverwind <me@silverwind.io>
2024-05-19 12:58:39 +08:00
wxiaoguang
821d2fc2a3 Simplify mirror repository API logic (#30963)
Fix #30921
2024-05-17 16:07:41 +00:00
KN4CK3R
b1d8f13bd0 Protected tag is no internal server error (#30962)
Fixes #30959

Adds an API test for protected tags.
Fix existing tag in combination with fixtures.
2024-05-14 06:48:21 +00:00
Zettat123
b3beaed147 Support using label names when changing issue labels (#30943)
Resolve #30917

Make the APIs for adding labels and replacing labels support both label
IDs and label names so the
[`actions/labeler`](https://github.com/actions/labeler) action can work
in Gitea.

<img width="600px"
src="https://github.com/go-gitea/gitea/assets/15528715/7835c771-f637-4c57-9ce5-e4fbf56fa0d3"
/>
2024-05-13 04:28:53 +00:00
Jason Song
b9396a9b85 Remove deprecated stuff for runners (#30930)
It's time (maybe somewhat late) to remove some deprecated stuff for the
runner.

- `x-runner-version`: runners needn't to report version in every
request, they will call `Declare`.
- `AgentLabels`: runners will report them as `Labels`.
2024-05-10 16:23:47 +08:00
yp05327
f7d2f695a4 Fix misspelling of mergable (#30896)
https://github.com/go-gitea/gitea/pull/25812#issuecomment-2099833692
Follow #30573
2024-05-08 16:11:43 +00:00
wxiaoguang
67c1a07285 Refactor AppURL usage (#30885)
Fix #30883
Fix #29591

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
2024-05-07 08:26:13 +00:00
Kemal Zebari
9f0ef3621a Don't only list code-enabled repositories when using repository API (#30817)
We should be listing all repositories by default.

Fixes #28483.
2024-05-03 15:58:31 +08:00
yp05327
a50026e2f3 Fix no edit history after editing issue's title and content (#30814)
Fix #30807

reuse functions in services
2024-05-03 14:11:51 +08:00
wxiaoguang
53b55223d1 Ignore useless error message "broken pipe" (#30801)
Fix #30792
2024-05-03 02:39:36 +00:00
Bo-Yi Wu
e67fbe4f15 refactor: merge ListActionTasks func to action.go file (#30811)
Just merge actions.go file to action.go

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2024-05-02 17:43:29 +00:00
Kemal Zebari
872caa17c0 Catch and handle unallowed file type errors in issue attachment API (#30791)
Before, we would just throw 500 if a user passes an attachment that is
not an allowed type. This commit catches this error and throws a 422
instead since this should be considered a validation error.
2024-05-02 16:33:31 +00:00
Chester
6709e28da7 Add API endpoints for getting action jobs status (#26673)
Sample of response, it is similar to Github actions

ref
https://docs.github.com/en/rest/actions/workflow-runs?apiVersion=2022-11-28#list-workflow-runs-for-a-repository

``` json
{
    "workflow_runs": [
        {
            "id": 3,
            "name": "Explore-Gitea-Actions",
            "head_branch": "main",
            "head_sha": "6d8d29a9f7a01ded8f8aeb64341cb31ee1ab5f19",
            "run_number": 3,
            "event": "push",
            "display_title": "More job",
            "status": "success",
            "workflow_id": "demo2.yaml",
            "url": "/chester/test/actions/runs/3",
            "created_at": "2023-08-22T13:41:33-04:00",
            "updated_at": "2023-08-22T13:41:37-04:00",
            "run_started_at": "2023-08-22T13:41:33-04:00"
        },
        {
            "id": 2,
            "name": "Explore-Gitea-Actions",
            "head_branch": "main",
            "head_sha": "6d8d29a9f7a01ded8f8aeb64341cb31ee1ab5f19",
            "run_number": 2,
            "event": "push",
            "display_title": "More job",
            "status": "success",
            "workflow_id": "demo.yaml",
            "url": "/chester/test/actions/runs/2",
            "created_at": "2023-08-22T13:41:30-04:00",
            "updated_at": "2023-08-22T13:41:33-04:00",
            "run_started_at": "2023-08-22T13:41:30-04:00"
        },
        {
            "id": 1,
            "name": "Explore-Gitea-Actions",
            "head_branch": "main",
            "head_sha": "e5369ab054cae79899ba36e45ee82811a6e0acd5",
            "run_number": 1,
            "event": "push",
            "display_title": "Add job",
            "status": "failure",
            "workflow_id": "demo.yaml",
            "url": "/chester/test/actions/runs/1",
            "created_at": "2023-08-22T13:15:21-04:00",
            "updated_at": "2023-08-22T13:18:10-04:00",
            "run_started_at": "2023-08-22T13:15:21-04:00"
        }
    ],
    "total_count": 3
}
```

---------

Co-authored-by: yp05327 <576951401@qq.com>
Co-authored-by: puni9869 <80308335+puni9869@users.noreply.github.com>
2024-05-01 09:40:23 +08:00