Compare commits

..

212 Commits

Author SHA1 Message Date
孟宁
766656adb0 减少不必要更改,恢复GenerateGitContent 2025-08-09 15:27:43 +08:00
孟宁
f32e198fa8 清理一些不必要的格式差异 2025-08-09 15:17:25 +08:00
孟宁
13c274afd6 add DevStar模板 in /repo/create 2025-08-09 14:35:17 +08:00
孟宁
bdefb59a5b !91 porting wechat login from dev branch
Merge pull request !91 from 孟宁/feature/wechat
2025-07-29 07:20:46 +00:00
孟宁
5d0d30fba8 !90 fixed-bug: unknown flag: --disable-content-trust
Merge pull request !90 from 孟宁/custom/devstar
2025-07-24 09:26:11 +00:00
孟宁
3cf1fe3fcb fixed-bug: unknown flag: --disable-content-trust 2025-07-24 17:24:42 +08:00
孟宁
b6b762e9b5 !89 fixed-bug: CI脚本
Merge pull request !89 from 孟宁/custom/devstar
2025-07-24 08:54:16 +00:00
孟宁
f8c63c80b7 fixed-bug: CI脚本 2025-07-24 16:52:59 +08:00
root
4bb00e7017 fixed-bug: CI脚本 2025-07-24 16:49:00 +08:00
root
812373d716 开发环境配置方法、CI脚本、安装脚本 2025-07-24 15:50:17 +08:00
孟宁
ec0f63e362 备案号可配置BEIAN_NUMBER = 苏ICP备888888888号-1 in [server] of app.ini 2025-07-21 17:15:34 +08:00
孟宁
abccf0f174 custom logo feature in -/admin/config/settings 2025-07-20 13:26:57 +08:00
孟宁
dee60671e2 !85 devcontainer /root /etc/ssh 改为持久化
Merge pull request !85 from panshuxiao/fix-devcontainer
2025-07-05 02:07:48 +00:00
panshuxiao
d33b8057cb devcontainer /root /etc/ssh 改为持久化
修改open with vscode返回连接
2025-07-03 08:24:54 +08:00
孟宁
162eee261a !81 让devcontainer相关功能在 k8s上工作起来
Merge pull request !81 from panshuxiao/k8s-devcontainer
2025-06-28 06:44:20 +00:00
panshuxiao
9e568020ed devcontainer加回端口 2025-06-28 09:34:02 +08:00
away
8b77dbb369 !82 feat: 自定义logo功能
* !1 fixed-bug:更正操作结果提示信息与操作页面不一致,更改为都在/admin/config/settings 页面上
* fixed-bug:更正操作结果提示信息与操作页面不一致,更改为都在/admin/config/settings 页面上
* refactor(admin): 移动自定义logo上传表单位置
* style: 还原管理后台仪表盘模板代码格式
* style: 调整注释格式和规范国际化语言文件的标签文本
* style: 还原管理后台仪表盘模板代码格式
* feat: 添加单个设置的获取和设置函数
* feat: 自定义logo功能
2025-06-27 06:04:14 +00:00
panshuxiao
b2b80b25b9 Merge branch 'dev' into delete-nat 2025-06-25 13:19:09 +08:00
孟宁
aa01ae3e39 !74 vscode插件相关功能
Merge pull request !74 from Levi Yan/feature-vscode-home
2025-06-25 03:20:10 +00:00
panshuxiao
2403ca1c08 Merge branch 'dev' into add-nat 2025-06-19 10:14:55 +08:00
init
bf3a5db127 fix bug 2025-06-18 09:23:01 +08:00
孟宁
9fa387895c set default port is 80 2025-06-17 18:41:36 +08:00
孟宁
26c90510b3 Merge branch 'feature-vscode-home' of https://gitee.com/devstar/devstar into feature-vscode-home 2025-06-17 17:32:49 +08:00
Levi Yan
d822525bb0 Merge branch 'dev' into feature-vscode-home 2025-06-17 01:43:12 -07:00
panshuxiao
f69aaa099d 删除k8s-agent的NAT相关代码 2025-06-17 13:15:06 +08:00
孟宁
c2952ee49f !79 fixed-bug:修复持续部署CD功能,可以直接使用kubectl 升级部署DevStar到dev.devstar.cn上
Merge pull request !79 from vecmatex/fix-cd-bug
2025-06-16 02:36:14 +00:00
vecmatex
c11b6628bc 修改cd脚本bug 2025-06-16 10:29:53 +08:00
孟宁
cf375f4b59 !78 fixed-bug:修复持续部署CD功能,可以直接使用kubectl 升级部署DevStar到dev.devstar.cn上
Merge pull request !78 from vecmatex/fix_cd
2025-06-15 04:14:13 +00:00
vecmatex
e4c4e98392 修复cd脚本 2025-06-15 12:10:44 +08:00
孟宁
e5ffe7529d !77 fixed-bug:修复持续部署CD功能,可以直接使用kubectl 升级部署DevStar到dev.devstar.cn上
Merge pull request !77 from vecmatex/fix-cd
2025-06-15 02:56:36 +00:00
vecmatex
1a072589ee 修复cd脚本 2025-06-15 10:49:16 +08:00
vecmatex
7cf3bb8441 !76 修复持续部署CD功能,可以直接使用kubectl 升级部署DevStar到dev.devstar,cn上
* 修复cd功能
2025-06-14 07:09:44 +00:00
孟宁
8b9efb787d !75 实现了修改runner的标签的功能
Merge pull request !75 from vecmatex/can_change_runner_tag
2025-06-14 06:05:55 +00:00
孟宁
0d53d4fc78 Merge branch 'feature-vscode-home' of https://gitee.com/devstar/devstar into feature-vscode-home 2025-06-12 13:25:34 +08:00
Levi Yan
9bba618c1b revert: 取消功能【避免打开同一个项目】 2025-06-11 09:18:39 -07:00
孟宁
b5acc1e0f3 Merge branch 'feature-vscode-home' of https://gitee.com/devstar/devstar into feature-vscode-home 2025-06-05 14:20:24 +08:00
Levi Yan
68c9648353 feat: 根据devcontainerStatus确定容器是否准备完成 2025-06-03 20:11:57 -07:00
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
9fbecc81b9 feat: repolist不显示已打开项目的按钮 2025-06-03 20:11:35 -07:00
Levi Yan
214e101049 feat: create container button's disable to represent waiting when waiting project completion 2025-06-03 20:11:24 -07:00
vecmatex
25ac0b8163 实现了修改runner的标签的功能 2025-06-02 21:29:28 +08:00
vecmatex
8e960069cf 删除了不必要的内容 2025-06-02 13:03:18 +08:00
panshuxiao
72a526c65a 完善了webterminal功能 2025-05-28 01:30:51 +08:00
panshuxiao
475b1d0c22 添加了devcontainer的NAT映射 2025-05-26 10:20:57 +08:00
Levi Yan
092d46fcaf Merge branch 'feature-vscode-home' of https://gitee.com/devstar/devstar into feature-vscode-home 2025-05-22 03:24:43 -07:00
Levi Yan
13d926316c feat: provide repo name for firstOpenProject in vscode 2025-05-22 03:17:18 -07:00
Levi Yan
0bebc5c0b0 Merge branch 'feature-vscode-home' of https://gitee.com/devstar/devstar into feature-vscode-home 2025-05-22 01:23:54 +08:00
Levi Yan
501bdbae0d feat: create container button's disable to represent waiting when waiting project completion 2025-05-22 00:55:48 +08:00
Levi Yan
5e0031e26a feat: language support for zh-cn and english 2025-05-22 00:55:48 +08:00
Levi Yan
3eb2c6f11a refactor: keep footer code in devstar-home-vscode.tmpl 2025-05-22 00:55:48 +08:00
Levi Yan
24a16e92b5 refactor: separate js code from html 2025-05-22 00:55:48 +08:00
Levi Yan
9f69cd4cc1 feat: create container button's disable to represent waiting when waiting project completion 2025-05-21 09:31:22 -07:00
Levi Yan
070acc8483 feat: language support for zh-cn and english 2025-05-21 09:31:22 -07:00
Levi Yan
500245ca01 refactor: keep footer code in devstar-home-vscode.tmpl 2025-05-21 09:31:22 -07:00
Levi Yan
63566f4ad5 refactor: separate js code from html 2025-05-21 09:31:22 -07:00
panshuxiao
b68457f442 Merge branch 'dev' into fix-online-devcontainer 2025-05-20 12:08:32 +08:00
panshuxiao
404132dac5 修复devcontainer配置加载和controller-manager的问题
•增添了日志
2025-05-20 12:06:35 +08:00
孟宁
b9720a9419 !73 单机部署环境下实现Web界面上启动和删除runner
Merge pull request !73 from vecmatex/can_create_runner
2025-05-19 08:52:52 +00:00
vecmatex
cf787b837c fixbug 2025-05-19 16:40:56 +08:00
nimesulide
6c5aef664b 添加删除runner功能 2025-05-17 22:15:29 +08:00
vecmatex
76f87176d0 修改部分文本 2025-05-14 16:46:16 +08:00
vecmatex
04c8eb59e1 再次修改了布局 2025-05-14 16:37:47 +08:00
vecmatex
35e5d763cf 修改了一下页面布局 2025-05-14 16:36:03 +08:00
vecmatex
f8a8af4ec6 添加从页面注册runner功能 2025-05-14 15:35:15 +08:00
孟宁
2923b1bbd8 !72 暂时删除了modules/k8s/controller/devcontainer/suite_test
Merge pull request !72 from panshuxiao/devcontainer-on-k8s
2025-05-14 02:37:35 +00:00
panshuxiao
81fd66e634 暂时删除了modules/k8s/controller/devcontainer/suite_test 2025-05-14 10:25:03 +08:00
孟宁
1150dfd408 !71 将make test 从CI脚本中移除,恢复到Dockerfile.rootless中,原因是CI脚本的执行环境中缺少开发环境
Merge pull request !71 from 孟宁/dev-for-ci-make-test
2025-05-13 11:28:26 +00:00
孟宁
491f3cc447 update Dockerfile.rootless.
Signed-off-by: 孟宁 <mengning997@163.com>
2025-05-13 11:27:21 +00:00
孟宁
00fce5c941 update .gitea/workflows/devstar-studio-dev-ci.yaml.
Signed-off-by: 孟宁 <mengning997@163.com>
2025-05-13 11:26:49 +00:00
孟宁
62d9c893be !70 将make test 从CI脚本中移除,恢复到Dockerfile.rootless中,原因是CI脚本的执行环境中缺少开发环境
Merge pull request !70 from 孟宁/devcontainer-on-k8s
2025-05-13 11:07:01 +00:00
孟宁
fb508af19a update Dockerfile.rootless.
Signed-off-by: 孟宁 <mengning997@163.com>
2025-05-13 11:03:55 +00:00
孟宁
b12e64ccc8 update .gitea/workflows/devstar-studio-dev-ci.yaml.
Signed-off-by: 孟宁 <mengning997@163.com>
2025-05-13 11:02:58 +00:00
panshuxiao
33a4a54e85 !68 添加了devcontainer在k8s下的重启、暂停、webTerminal功能
* 修复k8s/devcontainer/suite_test
* 改进了DevStar Controller Manager镜像相关代码
* 修改了Dockerfile.rootless以解决go版本问题
* 移动Dockerfile.cotroller-manager位置
* Merge remote-tracking branch 'origin/dev' into devcontainer-on-k8s
* Merge remote-tracking branch 'origin/add_k8s' into AppOnK8s
* Merge remote-tracking branch 'origin/add-dockerfile-method-and-start-s…
*  添加了k8s下的停止、重启devcontainer和webterminal
* Merge branch 'add-dockerfile-method-and-start-stop-container' of https…
* 更新了容器镜像方式的构建、安装和使用方法,但是devcontainer功能还有问题
* fix run postCreateCommand bug
* sh文件方式管理启动脚本
* Merge branch 'add-dockerfile-method-and-start-stop-container' of https…
* add restart command and fix bug
* chore: 补充添加k8s controller的go.mod和go.sum文件
* Merge branch 'add-dockerfile-method-and-start-stop-container' of https…
* 为devstar添加k8s上的controller-manager
* add dockerfile method to create container and save container .restart …
2025-05-13 10:50:26 +00:00
panshuxiao
d506f11dd3 修复k8s/devcontainer/suite_test
• 添加了测试需要的bin
• 补充了devcontainer crd定义文件
2025-05-13 13:27:59 +08:00
孟宁
b938e71a82 改进了DevStar Controller Manager镜像相关代码 2025-05-12 19:24:35 +08:00
panshuxiao
3fbd87746e 修改了Dockerfile.rootless以解决go版本问题
• 取消了make test
2025-05-12 17:58:45 +08:00
Levi Yan
bec104a44c feat: create container button's disable to represent waiting when waiting project completion 2025-05-11 20:34:28 +08:00
Levi Yan
f95a209bc1 feat: language support for zh-cn and english 2025-05-11 20:34:28 +08:00
Levi Yan
bac5754314 refactor: keep footer code in devstar-home-vscode.tmpl 2025-05-11 20:34:28 +08:00
Levi Yan
e0b5450e99 refactor: separate js code from html 2025-05-11 20:34:28 +08:00
panshuxiao
d237dbe201 移动Dockerfile.cotroller-manager位置
• 添加了controller-manager的README.md
2025-05-08 19:44:21 +08:00
panshuxiao
d2c2a6e363 Merge remote-tracking branch 'origin/dev' into devcontainer-on-k8s 2025-05-08 10:16:12 +08:00
xinitx
02baa3b7af !67 增加了重启停止容器、dockerfile方式创建保存容器功能
* change initializeScript path
* Merge branch 'add-dockerfile-method-and-start-stop-container' of https…
* 更新了容器镜像方式的构建、安装和使用方法,但是devcontainer功能还有问题
* fix run postCreateCommand bug
* sh文件方式管理启动脚本
* add restart command and fix bug
* add dockerfile method to create container and save container .restart …
2025-05-07 11:10:30 +00:00
孟宁
fbd405af67 !69 修改ci脚本能让其自动更新dev.devstar.cn
Merge pull request !69 from vecmatex/add_k8s
2025-05-07 10:56:27 +00:00
panshuxiao
685878afd1 Merge remote-tracking branch 'origin/add_k8s' into AppOnK8s 2025-05-06 10:13:01 +08:00
panshuxiao
574ebd7f61 Merge remote-tracking branch 'origin/add-dockerfile-method-and-start-stop-container' into AppOnK8s 2025-05-06 10:12:48 +08:00
nimesulide
9293b45886 修改ci脚本能让其自动更新dev.devstar.cn 2025-04-30 16:01:40 +08:00
panshuxiao
234a5087fc 添加了k8s下的停止、重启devcontainer和webterminal
• 修改了Makefile添加了controller-manager
• 添加了controller-manager的Dockerfile
2025-04-29 20:18:28 +08:00
孟宁
16c75737f0 Merge branch 'add-dockerfile-method-and-start-stop-container' of https://gitee.com/devstar/devstar into add-dockerfile-method-and-start-stop-container 2025-04-29 16:52:01 +08:00
孟宁
4cc2aa5419 更新了容器镜像方式的构建、安装和使用方法,但是devcontainer功能还有问题 2025-04-29 16:51:26 +08:00
init
3d19432e47 fix run postCreateCommand bug 2025-04-29 16:43:11 +08:00
init
324c85215c sh文件方式管理启动脚本 2025-04-28 21:28:16 +08:00
panshuxiao
a28f802bd8 Merge branch 'add-dockerfile-method-and-start-stop-container' of https://gitee.com/devstar/devstar into AppOnK8s 2025-04-28 10:14:01 +08:00
init
d5f6a103e8 add restart command and fix bug 2025-04-22 22:24:16 +08:00
panshuxiao
3b81b02a66 chore: 补充添加k8s controller的go.mod和go.sum文件 2025-04-19 16:55:14 +08:00
panshuxiao
76974d2067 Merge branch 'add-dockerfile-method-and-start-stop-container' of https://gitee.com/devstar/devstar into AppOnK8s 2025-04-19 16:50:48 +08:00
panshuxiao
73935fba8e 为devstar添加k8s上的controller-manager
• manager入口为modules/k8s/cmd/controller-manager/controller-manager.go
• 修改了k8s.go的 CreateDevcontainer 函数以本地测试
2025-04-19 16:41:17 +08:00
init
03c76a7212 add dockerfile method to create container and save container .restart container.stop container 2025-04-16 23:25:04 +08: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
江舟水洲
4907b3cc4f !64 update public/assets/install.sh.
* update public/assets/install.sh.
* 用户可以使用--ssh-port参数指定端口号,默认2222
* update public/assets/install.sh.
2025-03-19 07:17:56 +00:00
xinitx
cd856c72bc !62 json管理和日志输出
* 合并输出按阶段显示
* ttyd初始目录
* 访问数据库放在services层
* 端口指定映射
* vscode链接
* 去掉devstar字符串
* Devcontainer前端页面显示进行了整理优化
* 修复 数据库 bug
* 增加容器output
2025-03-18 15:52:08 +00:00
孟宁
40258dbdfe !63 fixed-bug:在devstar.cn上微信二维码扫码查询用户时错误处理了已绑定用户
Merge pull request !63 from 孟宁/fixed-wechat-login-bug
2025-03-13 07:24:16 +00:00
孟宁
9512382ff7 fixed-bug:在devstar.cn上微信二维码扫码查询用户时错误处理了已绑定用户 2025-03-13 15:22:11 +08:00
孟宁
72e38d0913 !61 启动时能够自动启动act_runner
Merge pull request !61 from vecmatex/feature_add_runner
2025-02-20 01:28:04 +00:00
vecmatex
c944cd0e2a 启动时能够自动启动act_runner 2025-02-19 20:06:33 +08:00
孟宁
635238b3b7 !60 让运行时环境支持docker客户端,以便可以创建devcontainer
Merge pull request !60 from 孟宁/for-runtime-docker
2025-02-19 09:47:45 +00:00
孟宁
bc492dc881 让运行时环境支持docker客户端,以便可以创建devcontainer 2025-02-19 17:42:21 +08:00
孟宁
5cfec8e7b8 !59 !58 docker.io无法访问,换成devstar.cn上的容器镜像来运行CI脚本,但是ubuntu-latest是匹配runner的标签,还不能直接写完整的镜像地址;
Merge pull request !59 from 孟宁/revert-merge-57-dev
2025-02-18 10:47:25 +00:00
孟宁
51462e8538 回退 'Pull Request !57 : docker.io无法访问,换成devstar.cn上的容器镜像来运行CI脚本' 2025-02-18 10:45:48 +00:00
孟宁
90b3742145 !58 增加了将devstar-studio:latest同步到docker.io的触发Github工作流的脚本
* 增加了将devstar-studio:latest同步到docker.io的触发Github工作流的脚本
* docker.io无法访问,换成devstar.cn上的容器镜像来运行CI脚本,但是ubuntu-latest是匹配runner的标签,还不能直接写完整的镜像地址;
2025-02-18 10:41:19 +00:00
孟宁
b1c7db5255 !57 docker.io无法访问,换成devstar.cn上的容器镜像来运行CI脚本
* docker.io无法访问,换成devstar.cn上的容器镜像来运行CI脚本
2025-02-18 09:07:00 +00:00
孟宁
333a30ccf3 !56 fixed bug:误修改了测试用例导致make test无法通过
Merge pull request !56 from 孟宁/reset-for-make-test-pass
2025-02-18 03:57:51 +00:00
孟宁
d8d6c5e8ec fixed bug:误修改了测试用例导致make test无法通过 2025-02-18 10:46:29 +08:00
孟宁
ff588d6257 !55 fixed bug 安装后跳转到微信登录路径有误
Merge pull request !55 from 孟宁/fixed-install-bug-wechat

1. fixed bug 安装后跳转到微信登录路径有误

将.../wechat/official-account 相关路径简化为.../wechat
2025-02-18 02:36:30 +00:00
孟宁
675f337e50 fixed bug 安装后跳转到微信登录路径有误 2025-02-18 10:33:40 +08:00
孟宁
8f2a6dd48d !54 gitea.com相关链接无法访问,替换为gitea.cn
* https://gitea.com相关链接无法访问,替换为https://gitea.cn 部分替换为了https://devstar.cn
* https://docs.gitea.com相关链接无法访问,替换为https://docs.gitea.cn
2025-02-18 02:11:43 +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
Levi Yan
82fc70a29a !49 [VSCode] DevStar Home
* clean: remove unused function openProject
* refactor: refactor the repo list loading, adjust button display based …
* format: align divs
* perf: prioritize loading the content that users can see first
* refactor: separate the openDevContainer function
* refactor: createDevContainer return Promise
* fix: hasDevContainer function doesn't work
* clean: remove useless function that get default public key from vscode
* refactor: apply new notification method
* refactor: add prefix for all vscode login tokens' name
* feat: show all notification by vscode and add new communication method…
* refactor: remove global error notification from gitea
2025-01-22 02:02:35 +00:00
孟宁
0442763bd9 !48 [VSCode] DevStar Home
Merge pull request !48 from Levi Yan/feature-devstar-home-vscode
2025-01-09 10:25:45 +00:00
Levi Yan
ca0f0885e5 Merge remote-tracking branch 'origin/feature-devstar-home-vscode' into feature-devstar-home-vscode 2025-01-08 09:27:20 +08:00
Levi Yan
c1b17a6ae3 feat: ssh key title format: username-machine-timestamp 2025-01-08 01:17:46 +08:00
Levi Yan
e67b621288 Merge branch 'dev' into feature-devstar-home-vscode 2025-01-07 12:27:26 +08: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
Levi Yan
4496c4ba0a Merge branch 'dev' into feature-devstar-home-vscode
# Conflicts:
#	templates/devstar-home-vscode.tmpl
2025-01-06 19:42:31 +08:00
Levi Yan
d36c073f2a fix: the close icon for loginModal does not disappear after the interface is stretched 2025-01-02 11:03:53 +08:00
Levi Yan
ac2a063ad7 feat: focus message when it appear 2025-01-02 10:47:45 +08:00
Levi Yan
04b71a37a6 feat: add varible DEVSTAR_DOMAIN_TEST_URL to facilitate development 2025-01-01 23:38:49 +08:00
Levi Yan
171bc80cd7 [DIP-3][VSCode] Add DevStar Home Web UI For VSCode Extension
* use single quote
* fix: incorrectly set up devstar domain
* fix: incorrectly set up devstar domain
* clean: remove unused code
* fix: the close icon does not disappear after the interface is stretched
* refactor: unify style and call of message notification
* temporarily does not support signup-link
* refactor: replace DEVSTAR_HOME with DEVSTAR_DOMAIN, and read it from c…
* refactor: remove auto_init option for user
* temporarily does not support private
* [Fix] auto repo initialization after creation
* refactor: unified the interface changes after the login status change
* clean: remove unused code
* feat: the interface for creating a repository is similar to that on th…
* merge code from home.html
* en route /devstar-home
* init devstar-home-vscode.tmpl
2024-12-27 06:56:36 +00:00
Levi Yan
edc921239a fix: incorrectly set up devstar domain 2024-12-27 13:13:24 +08:00
Levi Yan
7cf0cb776c fix: incorrectly set up devstar domain 2024-12-27 13:00:28 +08:00
Levi Yan
5b45eaa30f clean: remove unused code 2024-12-27 12:37:10 +08:00
Levi Yan
d2684ce73f fix: the close icon does not disappear after the interface is stretched 2024-12-27 12:36:33 +08:00
Levi Yan
080e113d79 refactor: unify style and call of message notification 2024-12-27 12:30:41 +08:00
Levi Yan
a02a9a22a6 temporarily does not support signup-link 2024-12-27 12:25:20 +08:00
Levi Yan
7550f6a13f refactor: replace DEVSTAR_HOME with DEVSTAR_DOMAIN, and read it from config in vscode 2024-12-27 12:24:06 +08:00
Levi Yan
55b2bc6d06 refactor: remove auto_init option for user 2024-12-27 12:18:34 +08:00
Levi Yan
83d45c06d6 temporarily does not support private 2024-12-27 12:03:38 +08:00
戴明辰
46337e8077 [Fix] auto repo initialization after creation
auto init repo after creating it
2024-12-25 09:25:59 +00:00
Levi Yan
2cf41279a4 refactor: unified the interface changes after the login status change 2024-12-25 08:26:20 +00:00
Levi Yan
ac76dec6dc clean: remove unused code 2024-12-25 08:26:20 +00:00
Levi Yan
4dfb8c97fa feat: the interface for creating a repository is similar to that on the web (except for the interface after choosing repo template) 2024-12-25 08:26:20 +00:00
Levi Yan
36a2f71dc7 merge code from home.html 2024-12-25 08:26:20 +00:00
DAI Mingchen
52fbc5c556 en route /devstar-home 2024-12-25 08:26:20 +00:00
Levi Yan
4e509e94c2 init devstar-home-vscode.tmpl 2024-12-25 08:26:20 +00:00
戴明辰
90a460599b [Feature] Added DevContainerJSON to unmarshal /.devcontainer/devcontainer.json
* fix `nil` parsed of `postCreateCommand`
* parse undefined fields to `nil` ptr
* Added JSON Unmarshaler with default values
* Refactored DevContainer Model Errors
* Added `DevContainerJSON` to unmarshal devcontainer.json
2024-12-25 04:13:51 +00:00
孟宁
de546fd294 [DIP-1] 完善微信二维码安装跳转用户注册过程
* 完善了微信扫码注册流程,注册过程中绑定微信用户可见
* 安装完成后可以直接跳转到二维码登录,完善了enable/disable微信二维码功能
2024-12-24 07:25:30 +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
孟宁
47d7a1cc04 [Chore] public/assets/install.sh: 指定版本镜像拉取,用户数据目录权限问题
* 支持docker.io镜像拉取和指定镜像版本;fixed bug: 用户数据目录权限问题
* fixed bug: 用户数据目录权限问题
* 支持docker.io镜像拉取和指定镜像版本
* add install.sh
2024-12-21 11:32:45 +00:00
戴明辰
9c4131623b [Chore] Use Tabao NPM Mirror in CI
* Updated `.npmrc`: add Tabao NPM Mirror
* Updated `Makefile`: display npm config list to validate NODE_MIRROR
* Updated `Dockerfile.rootless`: Removed trivial NPM Mirror settings, and added reference to `/.npmrc`::`registry`
2024-12-20 02:27:19 +00:00
孟宁
cd3bf834ac [Chore] 添加DevStar安装使用脚本
* add install.sh
2024-12-19 09:54:21 +00:00
孟宁
a57b4af354 [Doc] 更新REAME.md中的开发构建流程
* 更新REAME.md中的开发流程,放弃本地构建容器镜像
2024-12-11 10:25:05 +00:00
戴明辰
8123bdf277 [Fix] Cloud NAT Rule Deletion Upon DevContainer Deletion
* NAT Rule deletion upon DevContainer deletion
* NAT Port query and delete
2024-12-11 02:55:26 +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
孟宁
4a55a192bb [Fix] 修复repo/migrate页面报错 Uncaught TypeError: Cannot read properties of undefined (reading 'match')
* 修复repo/migrate页面报错repo-template.js:22 Uncaught TypeError: Cannot read …
2024-12-05 08:31:14 +00:00
戴明辰
294175a836 !31 [Chore] Use CI Actions Proxy
* 使用 GitHub Actions 本地镜像代理
2024-12-05 07:16:03 +00:00
孟宁
72adae1757 [Fix][DIP-4] 修复了devstar.cn上的js bug及增加了模板创建仓库时提交日志中记录版本号
* commit msg中增加了模板仓库的版本号
* fixed bug in devstar.cn but not test
2024-12-05 06:42:57 +00:00
孟宁
b23094d410 [DIP-4]支持DevStar模板及Git URL作为模板及其他杂项
* 支持从Git URL初始化新建的仓库
* 前端支持Git URL commit id为模板创建项目,并优化了前端代码footer等
* 在DevStar.cn上不必支持DevStar Template
* 在前端扩展方式支持了DevStar Template
* 增加了数据持久化存储配置方法
* 本地部署时不显示底部的API及devstar.cn的网站备案号
* update LICENSE
* 完善README.md 恢复了可执行文件名称gitea
2024-12-02 01:43:39 +00:00
戴明辰
1a0bb2f28a Revert "!28 [Refactor][Doc][Chore] 将Gitea改名为Devstar,补充README.md开发环境安装指南"
This reverts commit 05e37d8da7.
2024-11-19 09:58:22 +00:00
孟宁
05e37d8da7 !28 [Refactor][Doc][Chore] 将Gitea改名为Devstar,补充README.md开发环境安装指南
* 名称改为devstar,并在README.md中添加了开发环境的安装指南
2024-11-19 09:25:17 +00:00
孟宁
d919045a41 update README.md.
Signed-off-by: 孟宁 <mengning997@163.com>
2024-11-10 02:17:09 +00:00
孟宁
f15d1f25d7 update docs/content/installation/on-kubernetes.zh-cn.md.
Signed-off-by: 孟宁 <mengning997@163.com>
2024-11-10 02:01:24 +00:00
戴明辰
2da936ba8c [DIP-1][Fix][WeChat] SignUp before Sending Activation Email
* [Fix] wechat signup before sending activation email
2024-11-08 04:03:21 +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
戴明辰
09aff0c0cf !24 [Fix] Nil pointer dereference in DevContainer Docker Agent
* [Lint] Replace 4 spaces with 1 Tab (in accordance with `/.editorconfig`)
* [Fix] Fix nullptr dereference
2024-11-06 10:05:11 +00:00
xinitx
b5f8d41d34 !20 [Fix] OpenDevcontainer docker获取端口号
* add error info
* change readme
* change readme
* add docker getting api
2024-11-05 12:13:42 +00:00
xinitx
71e6803a6d !19 [Doc][Fix] 修改 ReadMe 和 CORS相关代码
* change ReadMe
* change cors api
2024-11-05 01:36:52 +00:00
戴明辰
a6dbe1f813 !18 [Fix][CI] Invalid CI Workflow YAML
* [Fix] indentation error
* [Fix] yaml: line 22: did not find expected key
* [Fix] Replaced ambiguous Unicode characters
2024-10-31 08:39:42 +00:00
戴明辰
009fd55b89 !17 [CI] Renamed tag of output artifact
* [CI] delete obsolete CI Workflow
* [CI] define default branch as `dev`
* [CI] rename tag of output artifact, and add `latest`
2024-10-31 07:37:36 +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
戴明辰
1ae0357913 !14 [Fix] Regenerate SSH Private Keys 2024-10-28 13:01:59 +00:00
DAI Mingchen
f10c5305ee [Fix] DevContainer Completed and then CrashLoopBackOff 2024-10-28 20:48:42 +08:00
戴明辰
6967ba9889 !12 [Feature][Fix][Doc] repo devcontainer.json parser, WeChat QR Expiration Mask, Zombie Process Mitigation
* [Fix] Zombie/Defunct Processes caused by SSH Daemon
* [Fix]  WeChat QR Expiration Mask with a refresh button
* [Doc] Updated API response field `publicKeySsh` of GET `/api/devstar_ssh/key_pair/new_temp`
* [Feature] Get or default DevContainer image from `.devcontainer/devcontainer.json` parser
2024-10-28 11:35:35 +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
戴明辰
ddd4109dbc !7 fix app.ini parser
* fix app.ini parser
2024-10-01 05:55:12 +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
戴明辰
fada46777a !5 Gitea Actions Runner Workflow Interface
Merge pull request !5 from xinitx/feature-actions-runner
2024-09-17 02:44:52 +00:00
xinitx
44ed5fc8ad 添加工作流接口 2024-09-11 19:45:23 +08:00
DAI Mingchen
498c399d1a change docker registry 2024-09-03 13:01:06 +08:00
DAI Mingchen
18485260b5 Squashed commit of the following:
commit 78017d7525ec4f0dad83a96e5bd11032c1f351bb
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Tue Sep 3 11:16:17 2024 +0800

    bugFix: org repo devContainer page HTTP 404
2024-09-03 11:17:15 +08:00
戴明辰
d44bd153c2 !4 完成Repo DevContainer 增、删、查
Merge pull request !4 from 戴明辰/feature-repo-devcontainer-panel
2024-08-30 12:28:59 +00:00
DAI Mingchen
624032c3c5 Fixed wrong PageTotalNum, and removed redundant SQL LEFT JOIN 2024-08-29 13:09:56 +08:00
DAI Mingchen
2f5dfd3196 开发容器分页查询:
* 用户设置-> 开发容器列表
* GET /api/devcontainer/user?page=1&page_size=10
2024-08-29 12:53:07 +08:00
DAI Mingchen
475e742e53 optimization 2024-08-28 15:36:22 +08:00
DAI Mingchen
1580897210 bugFix: wrong SQL condition 2024-08-27 20:04:51 +08:00
DAI Mingchen
32760a30f5 获取已登录用户 devContainer 列表 2024-08-27 19:03:07 +08:00
DAI Mingchen
ae6d2f6ea2 devContainer 前后端对接mock数据 2024-08-27 11:10:31 +08:00
DAI Mingchen
bdd9c7e515 bugFix: autologin for WeChat QR 2024-08-24 18:23:40 +08:00
DAI Mingchen
fc2b8c287a [Doc] 部署指南 2024-08-24 16:34:40 +08:00
DAI Mingchen
72433d05fc 仓库上限达到提示:如需扩容请联系管理员 2024-08-23 21:06:19 +08:00
DAI Mingchen
2530394a2d [Optimization] 将微信扫码登录方式剥离,并设置为默认登录页,若无法使用微信扫码登录,则回退到密码登录页 2024-08-23 17:23:23 +08:00
DAI Mingchen
62705595a0 bugFix: cannot show out-of-site images due to CORS Header Content-Security-Policy 2024-08-23 15:31:32 +08:00
DAI Mingchen
05a7e0eb4f bugFix: 微信公众号迁移可能导致微信绑定失败 2024-08-23 15:28:07 +08:00
DAI Mingchen
a125592b4d * Added app.ini importer for the CORS header Content-Security-Policy
* Marked header `X-Frame-Options` as obsolete
2024-08-22 20:39:37 +08:00
DAI Mingchen
dab7418671 修改CSP默认安全策略: 允许 vscode-webview://* 2024-08-22 14:54:57 +08:00
DAI Mingchen
218cf22469 Updated CI script to show the artifact address 2024-08-13 19:42:17 +08:00
DAI Mingchen
64843e5786 removed stale DB tests 2024-08-13 19:23:05 +08:00
戴明辰
f63fe93e92 Revert "Bypass the wall"
This reverts commit 869f0ee023.
2024-08-13 10:34:46 +00:00
DAI Mingchen
869f0ee023 Bypass the wall 2024-08-13 18:22:52 +08:00
戴明辰
ce153fc768 !3 完成微信扫码登录数据库交互
* Improvement: use commit SHA to tag artifact
* bugFix: inconsistent collation
* Added Database migration for DevStar Studio 1.0
* Updated Transaction for table `user_wechat_official_account_openid`
* WeChat Official Account binding/updating done
* WeChat Official Account QR login Success
2024-08-13 10:06:35 +00:00
DAI Mingchen
3fb1f1708f Updated Wechat QR Login Prototype: both Frontend and Backend
------
Squashed commit of the following:

commit b6108854f87c72832b4ccf65f2b02cfa79818d28
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Tue Jul 30 11:43:27 2024 +0000

    Wechat QR scan prototype done: frontend and backend

commit ace0cbbc75c5441c77121463a658115c59292727
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Tue Jul 30 07:53:47 2024 +0000

    Updated ICP license for https://*.devstar.cn

commit eab20f110c1f89447ad7bea9dd1f325a99e1f196
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Tue Jul 30 04:14:11 2024 +0000

    updated wechat callback and changed sceneStr with higher entropy

commit dd04b3b21b613d470d0ae27edbcead9aa2958861
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Mon Jul 29 14:33:04 2024 +0000

    WeChat callback interfaces

commit 320ba2225a420feb58c3668d4afca96fcbfe5c79
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Mon Jul 29 13:16:16 2024 +0000

    updated env settings

commit 2ed4e3e307
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 11:48:00 2024 +0000

    resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA

commit 690157811b
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 10:21:39 2024 +0000

    fix: checkout the corresponding branch(master or dev)

commit 046ff63e42
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 10:01:24 2024 +0000

    test new CI pipeline workflow in the org repo, with a bunch of ENV vars

commit faf7f51d85
Author: 戴明辰 <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 07:59:31 2024 +0000

    !1 DevStar Studio 界面原型 + CI流水线测试通过
    * finalize this PoC repo, and migrate to the main repo (as a dev branch)
    * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go
    * bugFix: CAPTCHA needs manual reloading
    * Updated UI
    * Changed logo and favicon
    * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and …
    * Added Unit Test in CI workflow, and removed redundant tests in dev container
    * Compliance with open source licensing requirements
    * Fix workflow: only exec 'docker rm' if there are dangling volumes
    * Removed Magic values about: Docker registry(URL, username), k8s(nanesp…
    * fix mistakes: git checkout branch should be master rather than the sta…
    * Updated UI layouts and build scripts
    * Updated copyright info and ICP License ID at page footer
    * Updated ICP License ID at page footer
    * Updated code ownership: web footer,  logo and favicon
    * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:57:46 +00:00
DAI Mingchen
3b768dac65 Squashed commit of the following:
commit 2ed4e3e307
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 11:48:00 2024 +0000

    resolved WARN NoEmptyContinuation (grammar mistakes), and removed trivial unit test for hCAPTCHA

commit 690157811b
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 10:21:39 2024 +0000

    fix: checkout the corresponding branch(master or dev)

commit 046ff63e42
Author: DAI Mingchen <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 10:01:24 2024 +0000

    test new CI pipeline workflow in the org repo, with a bunch of ENV vars

commit faf7f51d85
Author: 戴明辰 <daimingchen@mail.ustc.edu.cn>
Date:   Thu Jul 25 07:59:31 2024 +0000

    !1 DevStar Studio 界面原型 + CI流水线测试通过
    * finalize this PoC repo, and migrate to the main repo (as a dev branch)
    * bugFix: nullptr dereference @ routers/web/auth/wechat_utils.go
    * bugFix: CAPTCHA needs manual reloading
    * Updated UI
    * Changed logo and favicon
    * Made WeChat QR optional (will not cause HTTP 500 Internal Error), and …
    * Added Unit Test in CI workflow, and removed redundant tests in dev container
    * Compliance with open source licensing requirements
    * Fix workflow: only exec 'docker rm' if there are dangling volumes
    * Removed Magic values about: Docker registry(URL, username), k8s(nanesp…
    * fix mistakes: git checkout branch should be master rather than the sta…
    * Updated UI layouts and build scripts
    * Updated copyright info and ICP License ID at page footer
    * Updated ICP License ID at page footer
    * Updated code ownership: web footer,  logo and favicon
    * Updated Internationalization(i18n): removed languages other than CN an…
2024-07-30 12:46:01 +00:00
qcloud
f64a922bdf Merge remote-tracking branch 'gitea-origin/main' 2024-06-27 17:45:15 +08:00
qcloud
073ee30b95 Remove all files from master branch 2024-06-27 17:45:06 +08:00
孟宁
c822f0b98c Initial commit 2024-06-25 12:26:55 +00:00
repo.diff.stats_desc%!(EXTRA int=10, int=431, int=12)

repo.diff.view_file

@@ -37,11 +37,11 @@ jobs:
- name: 🔍 Check out repository code
uses: https://devstar.cn/actions/checkout@v4
with:
ref: dev
ref: main
- name: 🔧 Test Codes and Build an Artifact
run: |
echo "Prepare to build repository code ${{ gitea.repository }}:${{ gitea.ref }}."
make docker
docker build -t gitea/gitea:latest .
- name: 🚀 Push Artifact to devstar.cn and docker.io Registry
run: |
docker tag gitea/gitea:latest ${{ vars.DOCKER_REGISTRY_ADDRESS }}/${{ vars.DOCKER_REPOSITORY_ARTIFACT}}:rootless-dev-${{ gitea.sha }}

repo.diff.view_file

@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
"regexp"
"slices"
"strings"
@@ -169,13 +170,14 @@ func Create(ctx *context.Context) {
ctx.Data["private"] = getRepoPrivate(ctx)
ctx.Data["default_branch"] = setting.Repository.DefaultBranch
ctx.Data["repo_template_name"] = ctx.Tr("repo.template_select")
ctx.Data["devstar_template_name"] = ctx.Tr("repo.template_select")
templateID := ctx.FormInt64("template_id")
if templateID > 0 {
templateRepo, err := repo_model.GetRepositoryByID(ctx, templateID)
if err == nil && access_model.CheckRepoUnitUser(ctx, templateRepo, ctxUser, unit.TypeCode) {
ctx.Data["repo_template"] = templateID
ctx.Data["repo_template_name"] = templateRepo.Name
ctx.Data["repo_template_name"] = templateRepo.FullName
ctx.Data["devstar_template_name"] = false
}
}
@@ -214,6 +216,79 @@ func handleCreateError(ctx *context.Context, owner *user_model.User, err error,
}
}
// isValidCommitUrl checks whether a given URL is a valid Git URL with a commit reference.
func isValidCommitUrl(url string) bool {
// 正则表达式用于匹配包含 commit 的 Git URL
regex := `^https?:\/\/([a-zA-Z0-9.-]+)\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)(\/commit\/([a-f0-9]{40}))?$`
// 编译正则表达式
pattern, err := regexp.Compile(regex)
if err != nil {
fmt.Println("Invalid regex for commit URL:", err)
return false
}
// 测试 URL 是否匹配正则表达式
return pattern.MatchString(url)
}
// isValidGitPath checks whether a given URL is a valid Git URL ending with .git.
func isValidGitPath(url string) bool {
// 正则表达式用于匹配以 .git 结尾的 Git URL
regexWithGit := `^https?:\/\/([a-zA-Z0-9.-]+)\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)\.git$`
// 编译正则表达式
pattern, err := regexp.Compile(regexWithGit)
if err != nil {
fmt.Println("Invalid regex for .git URL:", err)
return false
}
// 测试 URL 是否匹配正则表达式
return pattern.MatchString(url)
}
// ExtractCommitID 从给定的 URL 中提取 commitID
func ExtractCommitID(url string) (string, error) {
// 正则表达式匹配 commit URL 中的 commitID
regex := `^https?:\/\/[a-zA-Z0-9.-]+\/[a-zA-Z0-9._-]+\/[a-zA-Z0-9._-]+\/commit\/([a-f0-9]{40})$`
// 编译正则表达式
commitPattern, err := regexp.Compile(regex)
if err != nil {
return "", err
}
// 尝试匹配 URL
if commitPattern.MatchString(url) {
// 提取 commitID
matches := commitPattern.FindStringSubmatch(url)
if len(matches) >= 2 {
return matches[1], nil // 返回 commitID
}
}
// 如果匹配失败,返回错误
return "", fmt.Errorf("URL does not match expected format: %s", url)
}
// ReplaceCommitWithGit 将 commit URL 中的 /commit/<commitID> 替换为 .git
func ReplaceCommitWithGit(url string) (string, error) {
// 定义正则表达式匹配 URL 中的 /commit/<commitID> 部分
regex := `(/commit/[a-f0-9]{40})$`
// 编译正则表达式
commitPattern, err := regexp.Compile(regex)
if err != nil {
return "", err
}
// 替换为 .git
replacedURL := commitPattern.ReplaceAllString(url, ".git")
return replacedURL, nil
}
// CreatePost response for creating repository
func CreatePost(ctx *context.Context) {
createCommon(ctx)
@@ -292,6 +367,54 @@ func CreatePost(ctx *context.Context) {
})
if err == nil {
log.Trace("Repository created [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
if strings.TrimSpace(repo.DefaultBranch) == "" {
repo.DefaultBranch = setting.Repository.DefaultBranch
}
if isValidGitPath(form.DevstarTemplate) {
log.Info("init repo from %s", form.DevstarTemplate)
repo, err = repo_service.InitRepoFromGitURL(ctx, ctx.Doer, ctxUser, form.DevstarTemplate, "", repo)
if err != nil {
log.Error("Error initializing repo from DevstarTemplate: %v", err)
return
}
if repo == nil {
log.Error("repo is nil after initializing from DevstarTemplate")
}
}
if isValidGitPath(form.GitUrlTemplate) {
log.Info("init repo from %s", form.GitUrlTemplate)
repo, err = repo_service.InitRepoFromGitURL(ctx, ctx.Doer, ctxUser, form.GitUrlTemplate, "", repo)
if err != nil {
log.Error("Error initializing repo from GitUrlTemplate: %v", err)
return
}
if repo == nil {
log.Error("repo is nil after initializing from GitUrlTemplate")
}
}
if isValidCommitUrl(form.GitUrlTemplate) {
log.Info("init repo from %s", form.GitUrlTemplate)
commitID, err := ExtractCommitID(form.GitUrlTemplate)
if err != nil {
log.Error("Error:", err)
}
gitURL, err := ReplaceCommitWithGit(form.GitUrlTemplate)
if err != nil {
log.Error("Error:", err)
}
repo, err = repo_service.InitRepoFromGitURL(ctx, ctx.Doer, ctxUser, gitURL, commitID, repo)
if err != nil {
log.Error("Error initializing repo from GitUrlTemplate (commit): %v", err)
return
}
if repo == nil {
log.Error("repo is nil after initializing from GitUrlTemplate (commit)")
}
}
ctx.Redirect(repo.Link())
return
}

repo.diff.view_file

@@ -32,6 +32,8 @@ type CreateRepoForm struct {
Readme string
Template bool
DevstarTemplate string
GitUrlTemplate string
RepoTemplate int64
GitContent bool
Topics bool

repo.diff.view_file

@@ -160,7 +160,7 @@ func initRepository(ctx context.Context, u *user_model.User, repo *repo_model.Re
}
// Apply changes and commit.
if err = initRepoCommit(ctx, tmpDir, repo, u, opts.DefaultBranch); err != nil {
if err = initRepoCommit(ctx, tmpDir, repo, u, opts.DefaultBranch, "Initial commit"); err != nil {
return fmt.Errorf("initRepoCommit: %w", err)
}
}

repo.diff.view_file

@@ -9,6 +9,7 @@ import (
"context"
"fmt"
"os"
"path"
"path/filepath"
"regexp"
"strconv"
@@ -250,7 +251,7 @@ func generateRepoCommit(ctx context.Context, repo, templateRepo, generateRepo *r
defaultBranch = templateRepo.DefaultBranch
}
return initRepoCommit(ctx, tmpDir, repo, repo.Owner, defaultBranch)
return initRepoCommit(ctx, tmpDir, repo, repo.Owner, defaultBranch, "Initial commit")
}
// GenerateGitContent generates git content from a template repository
@@ -292,6 +293,81 @@ func GenerateGitContent(ctx context.Context, templateRepo, generateRepo *repo_mo
return nil
}
// GenerateGitContent generates git content from a Git URL
func GenerateGitContentFromGitURL(ctx context.Context, gitURL, commitID string, repo *repo_model.Repository) error {
tmpDir, err := os.MkdirTemp(os.TempDir(), "gitea-"+repo.Name)
if err != nil {
return fmt.Errorf("Failed to create temp dir for repository %s: %w", gitURL, err)
}
defer func() {
if err := util.RemoveAll(tmpDir); err != nil {
log.Error("RemoveAll: %v", err)
}
}()
// generateRepoCommit
commitTimeStr := time.Now().Format(time.RFC3339)
authorSig := repo.Owner.NewGitSig()
// Because this may call hooks we should pass in the environment
env := append(os.Environ(),
"GIT_AUTHOR_NAME="+authorSig.Name,
"GIT_AUTHOR_EMAIL="+authorSig.Email,
"GIT_AUTHOR_DATE="+commitTimeStr,
"GIT_COMMITTER_NAME="+authorSig.Name,
"GIT_COMMITTER_EMAIL="+authorSig.Email,
"GIT_COMMITTER_DATE="+commitTimeStr,
)
// Clone to temporary path with a specified depth.
if err := git.Clone(ctx, gitURL, tmpDir, git.CloneRepoOptions{
Depth: 1, // 仍然可以保持深度克隆以优化性能
}); err != nil {
return fmt.Errorf("git clone: %w", err)
}
// Change to the specified commit ID after cloning
if commitID != "" {
if err := git.NewCommand("checkout").AddDynamicArguments(commitID).Run(ctx, &git.RunOpts{Dir: tmpDir}); err != nil {
return fmt.Errorf("git checkout %s: %w", commitID, err)
}
}
// Get the current SHA1 version of the working directory
var sha1Buffer bytes.Buffer
if err := git.NewCommand("rev-parse", "HEAD").Run(ctx, &git.RunOpts{
Dir: tmpDir,
Stdout: &sha1Buffer, // 使用 bytes.Buffer
}); err != nil {
return fmt.Errorf("git rev-parse HEAD: %w", err)
}
// 获取SHA1字符串并修整空白
sha1 := strings.TrimSpace(sha1Buffer.String())
if err := util.RemoveAll(path.Join(tmpDir, ".git")); err != nil {
return fmt.Errorf("remove git dir: %w", err)
}
if err := git.InitRepository(ctx, tmpDir, false, repo.ObjectFormatName); err != nil {
return err
}
repoPath := repo.RepoPath()
if stdout, _, err := git.NewCommand("remote", "add", "origin").AddDynamicArguments(repoPath).
//SetDescription(fmt.Sprintf("generateRepoCommit (git remote add): %s to %s", gitURL, tmpDir)).
RunStdString(ctx, &git.RunOpts{Dir: tmpDir, Env: env}); err != nil {
log.Error("Unable to add %v as remote origin to temporary repo to %s: stdout %s\nError: %v", repo, tmpDir, stdout, err)
return fmt.Errorf("git remote add: %w", err)
}
commitMessage := "Initial commit from " + gitURL + " ( " + sha1 + " ) "
initRepoCommit(ctx, tmpDir, repo, repo.Owner, repo.DefaultBranch, commitMessage)
if err := repo_module.UpdateRepoSize(ctx, repo); err != nil {
return fmt.Errorf("failed to update size for repository: %w", err)
}
log.Info("GenerateGitContentFromGitURL init repo from %s : %s", gitURL, commitID)
return nil
}
// GenerateRepoOptions contains the template units to generate
type GenerateRepoOptions struct {
Name string

repo.diff.view_file

@@ -19,9 +19,9 @@ import (
)
// initRepoCommit temporarily changes with work directory.
func initRepoCommit(ctx context.Context, tmpPath string, repo *repo_model.Repository, u *user_model.User, defaultBranch string) (err error) {
func initRepoCommit(ctx context.Context, tmpPath string, repo *repo_model.Repository, u *user_model.User, defaultBranch string, commitMessage string) (err error) {
commitTimeStr := time.Now().Format(time.RFC3339)
commitMsg := "--message=" + commitMessage
sig := u.NewGitSig()
// Because this may call hooks we should pass in the environment
env := append(os.Environ(),
@@ -39,7 +39,7 @@ func initRepoCommit(ctx context.Context, tmpPath string, repo *repo_model.Reposi
return fmt.Errorf("git add --all: %w", err)
}
cmd := git.NewCommand("commit", "--message=Initial commit").
cmd := git.NewCommand("commit").AddOptionFormat(commitMsg).
AddOptionFormat("--author='%s <%s>'", sig.Name, sig.Email)
sign, key, signer, _ := asymkey_service.SignInitialCommit(ctx, tmpPath, u)

repo.diff.view_file

@@ -192,3 +192,17 @@ func GenerateRepository(ctx context.Context, doer, owner *user_model.User, templ
return generateRepo, nil
}
// InitRepoFromGitURL for a repository from a Git URL
func InitRepoFromGitURL(ctx context.Context, doer, owner *user_model.User, gitURL, commitID string, repo *repo_model.Repository) (_ *repo_model.Repository, err error) {
if !doer.IsAdmin {
return nil, nil
}
err = GenerateGitContentFromGitURL(ctx, gitURL, commitID, repo)
if err != nil {
return nil, err
}
return repo, nil
}

repo.diff.view_file

@@ -61,17 +61,31 @@
<label for="description">{{ctx.Locale.Tr "repo.repo_desc"}}</label>
<textarea id="description" rows="2" name="description" placeholder="{{ctx.Locale.Tr "repo.repo_desc_helper"}}" maxlength="2048">{{.description}}</textarea>
</div>
{{if .devstar_template_name}}
<div id="devstar_template_area" class="inline field">
<label>{{ctx.Locale.Tr "repo.devstar_template"}}</label>
<div id="devstar_template_search" class="ui search selection dropdown">
<input type="hidden" id="devstar_template" name="devstar_template" value="">
<div id="devstar_template_name" class="default text">{{.devstar_template_name}}</div>
<div class="menu"></div>
</div>
<span class="help">{{ctx.Locale.Tr "repo.devstar_template_desc" "https://DevStar.cn/"}}</span>
</div>
{{end}}
<div id="repo_template_area">
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.template"}}</label>
<div id="repo_template_search" class="ui search selection dropdown">
<input type="hidden" id="repo_template" name="repo_template" value="{{or .repo_template ""}}">
<div class="default text">{{.repo_template_name}}</div>
<div id="repo_template_name" class="default text">{{.repo_template_name}}</div>
<div class="menu">
</div>
</div>
</div>
<div id="template_units" class="tw-hidden">
<div id="template_units" {{if not .repo_template}}class="tw-hidden"{{end}}>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.template.items"}}</label>
<div class="ui checkbox">
@@ -113,8 +127,9 @@
</div>
</div>
</div>
</div>
<div id="non_template">
<div id="non_template" {{if .repo_template}}class="tw-hidden"{{end}}>
<div class="inline field">
<label>{{ctx.Locale.Tr "repo.issue_labels"}}</label>
<div class="ui search selection dropdown">

repo.diff.view_file

@@ -0,0 +1,187 @@
import $ from 'jquery';
import { htmlEscape } from '../utils/html.ts';
import { hideElem, showElem } from '../utils/dom.ts';
const {appSubUrl} = window.config;
export function initRepoTemplateSearch() {
function isValidGitUrl(url) {
// 正则表达式支持两种格式的 Git URL
const regex = /^https:\/\/([a-zA-Z0-9.-]+)\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)(\/commit\/([a-f0-9]{40}))?$/;
// 或者,以 .git 结尾
const regexWithGit = /^https:\/\/([a-zA-Z0-9.-]+)\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)\.git$/;
return regex.test(url) || regexWithGit.test(url);
}
function getRepoNameFromGitUrl(url) {
// 正则表达式支持两种格式的 Git URL
const regexWithCommit = /^https:\/\/([a-zA-Z0-9.-]+)\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)\/commit\/([a-f0-9]{40})$/; // 针对 commit ID 的 URL
const regexWithoutCommit = /^https:\/\/([a-zA-Z0-9.-]+)\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)\.git$/; // 针对 .git 结尾的 URL
// 尝试匹配 commit URL
let match = url.match(regexWithCommit);
if (match) {
return match[3]; // 返回 repo-name
}
// 尝试匹配 .git URL
match = url.match(regexWithoutCommit);
if (match) {
return match[3]; // 返回 repo-name
}
return null; // 如果没有匹配,返回 null
}
const $repoTemplate = $('#repo_template');
const $devstarTemplate = $('#devstar_template');
const $gitURLTemplate = $('#git_url_template');
const $templateUnits = $('#template_units');
const $nonTemplate = $('#non_template');
const $repoTemplateArea = $('#repo_template_area');
const $gitURLTemplateArea = $('#git_url_template_area');
const $devstarTemplateArea = $('#devstar_template_area');
const isDevstar = /^(https?:\/\/)?(www\.)?(devstar\.cn)(:\d+)?(\/.*)?$/i.test(document.URL);
if (isDevstar) {
hideElem($devstarTemplateArea);
$devstarTemplateArea.remove();
}
const GitURL = document.URL.match(/[?&]template_url=([^&]*)/);
if (GitURL) {
if (isValidGitUrl(GitURL[1])) {
$gitURLTemplate.val(GitURL[1]);
}
$devstarTemplateArea.val('');
hideElem($devstarTemplateArea);
hideElem($repoTemplateArea);
}
const template_id = document.URL.match(/[?&]template_id=([^&]*)/);
if (template_id) {
$devstarTemplateArea.val('');
hideElem($devstarTemplateArea);
$gitURLTemplate.val("");
hideElem($gitURLTemplateArea);
}
const checkTemplate = function () {
if ($repoTemplate.val() !== '' && $repoTemplate.val() !== '0') {
showElem($templateUnits);
hideElem($nonTemplate);
hideElem($gitURLTemplateArea);
$devstarTemplateArea.val('');
hideElem($devstarTemplateArea);
} else {
showElem($devstarTemplateArea);
hideElem($templateUnits);
showElem($nonTemplate);
showElem($gitURLTemplateArea);
}
};
$repoTemplate.on('change', checkTemplate);
checkTemplate();
const checkGitURLTemplate = function () {
if ($gitURLTemplate.val() !== '' && $gitURLTemplate.val() !== '0') {
if ($('#repo_name').val() == '') {
$('#repo_name').val(getRepoNameFromGitUrl($gitURLTemplate.val()));
}
if ($('#description').val() == '') {
$('#description').val("init repo from " + $gitURLTemplate.val());
}
hideElem($repoTemplateArea);
hideElem($nonTemplate);
$devstarTemplateArea.val('');
hideElem($devstarTemplateArea);
} else {
showElem($devstarTemplateArea);
showElem($repoTemplateArea);
}
};
if($gitURLTemplate.length){
$gitURLTemplate.on('change', checkGitURLTemplate);
checkGitURLTemplate();
}
const checkDevStarTemplate = function () {
if ($devstarTemplate.val() !== '' && $devstarTemplate.val() !== '0') {
if ($('#repo_name').val() == '') {
$('#repo_name').val(getRepoNameFromGitUrl($devstarTemplate.val()));
}
if ($('#description').val() == '') {
$('#description').val("init repo from " + $devstarTemplate.val());
}
$repoTemplate.val('');
hideElem($gitURLTemplateArea);
hideElem($repoTemplateArea);
hideElem($nonTemplate);
} else {
showElem($repoTemplateArea);
showElem($gitURLTemplateArea);
hideElem($templateUnits);
showElem($nonTemplate);
}
};
if($devstarTemplate.length){
$devstarTemplate.on('change', checkDevStarTemplate);
}
const initDevStarTemplateSearch = function () {
$('#devstar_template_search')
.dropdown({
apiSettings: {
url: `https://devstar.cn/api/v1/repos/search?q={query}&template=true`,
onResponse(response) {
console.log(response.data);
const filteredResponse = { success: true, results: [] };
filteredResponse.results.push({
name: '-----',
value: '',
});
// Parse the response from the api to work with our dropdown
$.each(response.data, (_r, repo) => {
filteredResponse.results.push({
name: htmlEscape("DevStar.cn/" + repo.full_name),
value: repo.clone_url,
});
});
return filteredResponse;
},
cache: true,
},
fullTextSearch: true,
});
};
initDevStarTemplateSearch();
const changeOwner = function () {
$('#repo_template_search')
.dropdown({
apiSettings: {
url: `${appSubUrl}/repo/search?q={query}&template=true&priority_owner_id=${$('#uid').val()}`,
onResponse(response) {
const filteredResponse = { success: true, results: [] };
filteredResponse.results.push({
name: '-----',
value: '',
});
// Parse the response from the api to work with our dropdown
$.each(response.data, (_r, repo) => {
filteredResponse.results.push({
name: htmlEscape(repo.repository.full_name),
value: repo.repository.id,
});
});
return filteredResponse;
},
cache: false,
},
fullTextSearch: true,
});
};
$('#uid').on('change', changeOwner);
changeOwner();
}

repo.diff.view_file

@@ -66,6 +66,7 @@ import {initGlobalButtonClickOnEnter, initGlobalButtons, initGlobalDeleteButton}
import {initGlobalComboMarkdownEditor, initGlobalEnterQuickSubmit, initGlobalFormDirtyLeaveConfirm} from './features/common-form.ts';
import {callInitFunctions} from './modules/init.ts';
import {initRepoViewFileTree} from './features/repo-view-file-tree.ts';
import {initRepoTemplateSearch} from './features/repo-template.ts';
const initStartTime = performance.now();
const initPerformanceTracer = callInitFunctions([
@@ -164,6 +165,7 @@ const initPerformanceTracer = callInitFunctions([
initOAuth2SettingsDisableCheckbox,
initRepoFileView,
initRepoTemplateSearch,
]);
// it must be the last one, then the "querySelectorAll" only needs to be executed once for global init functions.