Compare commits

...

162 Commits

Author SHA1 Message Date
xxq250 86dfe703f8 Merge pull request '20250225版本' (#9) from develop into master 2025-02-25 11:05:18 +08:00
yystopf 85e8af6e03 feat: .devops/test.yml 2024-12-05 10:00:31 +08:00
yystopf 6dc20c68a1 更改: 合并compare接口 2024-11-18 17:09:30 +08:00
yystopf 0bfffa0ad8 更改:compare接口移除diff内容 2024-11-14 16:09:07 +08:00
yystopf 9a25439e7a fixed 2024-11-14 14:58:16 +08:00
xxq250 e4f9b9f90c raw下载原文件需要登录 2024-11-11 11:24:15 +08:00
yystopf 7cc49acd7e 更改: 返回旧版参数 2024-11-11 10:50:51 +08:00
yystopf 5a5c6d062f 新增: commit\compare文件变动接口拆解 2024-11-07 13:53:44 +08:00
yystopf 123bc33bfa 新增: 根据filepath获取合并请求文件更改内容 2024-11-05 16:11:31 +08:00
yystopf cfd6d422ea 更改:编译前置参数 2024-10-28 09:48:05 +08:00
yystopf ec579df59c 新增:nacos服务注册及配置化 2024-09-29 16:45:00 +08:00
yystopf e9762f8cb3 新增:nacos服务注册及配置化 2024-09-29 16:33:55 +08:00
yystopf 69dc5fc1a5 add: 新增只查询wikiname的接口 2024-09-25 16:31:21 +08:00
xxq250 fd66ed0d8d Merge remote-tracking branch 'origin/develop' into develop 2024-09-13 10:20:53 +08:00
xxq250 1a800569c4 增加麒麟如意开源协议 2024-09-13 10:20:46 +08:00
yystopf 1ffca888e6 新增:模板配置文件 2024-09-03 14:42:13 +08:00
xxq250 5be5aa79ab windows Git Credential Manager安装后clone时浏览器弹窗屏蔽 2024-07-24 08:36:10 +08:00
yystopf 97405de7d5 新增:删除接口(更改了关联删除hook_task逻辑) 2024-07-22 15:40:58 +08:00
yystopf f58cdb13a0 新增:手动触发流水线任务接口 2024-07-10 17:45:19 +08:00
yystopf b04f4bb2d8 更改:rerun逻辑新增一条记录 2024-05-30 16:00:19 +08:00
yystopf 16c1bb3f82 Merge branch 'develop' of https://gitlink.org.cn/Gitlink/gitea_hat into develop 2024-05-28 09:02:07 +08:00
yystopf 8964eff31b 新增:重新运行及查看日志接口 2024-05-28 09:02:01 +08:00
xxq250 01725989ac 版本号定义 2024-05-27 11:40:01 +08:00
yystopf 8ad0cd1cf0 Merge branch 'feature' into develop 2024-04-17 08:48:48 +08:00
yystopf ef52417694 新增:webhook type 类型 2024-04-17 08:48:28 +08:00
yystopf f6aa75e5c6 Merge branch 'feature' into develop 2024-03-22 17:36:12 +08:00
yystopf c88506a8f7 更改:同步分支条件 2024-03-22 17:35:58 +08:00
yystopf 4b8ba4576e Merge branch 'feature' into develop 2024-03-22 17:15:53 +08:00
yystopf 54c458b31c 新增:同步仓库分支代码恢复 2024-03-22 17:15:39 +08:00
yystopf f6d3f4d21a Merge branch 'feature' into develop 2024-03-22 13:43:24 +08:00
yystopf 0f9a0a12cd 新增:最近提交列表message搜索 2024-03-20 09:09:20 +08:00
yystopf 9d83ff8685 修复:分支数为0不用读cache 2024-03-18 15:57:48 +08:00
yystopf c04df49a78 Merge branch 'develop' 2024-03-05 14:41:24 +08:00
yystopf a0bdd64714 Merge branch 'feature' into develop 2024-03-05 09:52:39 +08:00
yystopf 0333de46ce 新增:流水线接口代码 2024-03-04 11:21:57 +08:00
yystopf 520306d632 新增:最近提交列表接口 2024-01-30 14:48:54 +08:00
yystopf 8f0e78026d 新增:分支查询删除分支与普通分支 2024-01-05 13:55:20 +08:00
yystopf cf8779216a 新增:分支列表显示已删除分支
新增:恢复分支接口

新增:删除者信息
2024-01-03 15:13:49 +08:00
yystopf d752b6126d 修复:filecommit使用内置函数移除原来的函数 2023-12-13 11:32:46 +08:00
yystopf ee82334a67 新增:dockerfile 2023-12-12 10:16:43 +08:00
yystopf 9e0272b872 修复:params无法正常获取数据 2023-12-11 08:52:15 +08:00
yystopf cc050e9c19 新增:仓库标签详情接口 2023-12-11 08:49:56 +08:00
yystopf c4829333a8 更改:只有email不敏感 2023-12-11 08:44:33 +08:00
yystopf e5257f0f8c 更改:只有email不敏感 2023-12-08 10:10:03 +08:00
yystopf c03d275d4f Merge branch 'docker_compose' into feature 2023-12-08 09:57:54 +08:00
yystopf eca533c81a 新增:仓库标签详情接口 2023-12-08 09:51:33 +08:00
yystopf 86bd9b67b6 修复:贡献者email大小写不敏感 2023-12-08 09:51:10 +08:00
root e4f2847d76 Merge branch 'docker_compose' of https://gitlink.org.cn/Gitlink/gitea_hat into docker_compose 2023-12-05 16:04:50 +08:00
呱呱呱 54ca2d02cf update docker compose 2023-12-05 16:00:22 +08:00
呱呱呱 08d986c951 update dockerfile 2023-12-05 16:00:22 +08:00
呱呱呱 30ae461d28 update runner 2023-12-05 16:00:22 +08:00
呱呱呱 dd4a2a77d9 add runner 2023-12-05 16:00:21 +08:00
呱呱呱 d4ec2a1314 update 2023-12-05 16:00:21 +08:00
呱呱呱 1239af8b5f docker comnpose yml 2023-12-05 16:00:21 +08:00
yystopf 16bbcdca6d 修复:params无法正常获取数据 2023-12-05 15:41:06 +08:00
呱呱呱 2cfe85fdeb update docker compose 2023-11-29 09:07:32 +08:00
呱呱呱 7ca1bf28a6 update dockerfile 2023-11-28 15:03:29 +08:00
呱呱呱 d51948a6ec update runner 2023-11-28 15:01:11 +08:00
呱呱呱 c830519286 add runner 2023-11-28 14:31:04 +08:00
呱呱呱 863e31f10f update 2023-11-28 14:17:49 +08:00
呱呱呱 cb4b4cb4c5 docker comnpose yml 2023-11-28 14:15:54 +08:00
yystopf 4717c93223 更新:dockerfile 2023-11-24 14:47:42 +08:00
yystopf c6c0254fa5 更改:Dockerfile 2023-11-24 14:01:02 +08:00
yystopf b35950299b 更改:rebase develop 2023-11-23 09:06:41 +08:00
yystopf 3389735752 修复:一些接口无法正常加载 2023-11-22 16:49:06 +08:00
yystopf c450ec1a19 更改:底层gitea版本为v1.21.0 2023-11-22 16:49:04 +08:00
yystopf 4cc0b95fe8 更改:底层gitea版本为v1.19.2 2023-11-22 16:44:57 +08:00
yystopf 62db4195a0 更改:底层gitea版本为v1.19.0 2023-11-22 16:44:19 +08:00
songjc 56ce54cb33 refactor: delete .devops/脚本执行器.yml 2023-11-10 09:54:25 +08:00
songjc 56e8423365 feat: .devops/脚本执行器.yml 2023-11-10 09:54:05 +08:00
xxq250 de2fd01271 fixed 当目录中有子模块子代码且找不到commitid的情况下报错处理 2023-10-12 10:24:45 +08:00
xxq250 749066ec62 禁止个人修改用户名 2023-10-10 16:01:51 +08:00
xxq250 18d8bddc8b Merge remote-tracking branch 'origin/develop' into develop 2023-10-10 14:00:15 +08:00
xxq250 5fc9cd0e50 获取文件内容增加文件是否文本标识 2023-10-10 14:00:09 +08:00
xxq250 60664dab9e refactor: .devops/gitlink正式环境.yml 2023-07-18 17:05:16 +08:00
xxq250 ad83be94bc Update README.md 2023-07-18 16:25:31 +08:00
xxq250 c50e8fb43e Update README.md 2023-07-18 16:21:17 +08:00
xxq250 f608d1e5fc Merge pull request '20230218版本' (#6) from develop into master 2023-07-18 16:19:19 +08:00
xxq250 2e99c5cd31 Update README.md 2023-07-18 16:14:40 +08:00
xxq250 555994308b Update README.md 2023-07-18 16:13:31 +08:00
xxq250 f6ce389d6c gitea admin cmd 2023-06-14 09:43:39 +08:00
xxqfamous 6ceb249c13 Dockerfile GOPROXY 2023-05-24 09:29:32 +08:00
xxqfamous 102cf582f0 Dockerfile wget 2023-05-23 18:29:59 +08:00
xxqfamous 93e71d7800 Dockerfile 2023-05-23 18:26:04 +08:00
xxqfamous ebf898c297 Dockerfile 2023-05-23 18:17:57 +08:00
xxqfamous bffe0ca1b7 重新梳理打包,加入options,public,templates 2023-05-23 16:26:28 +08:00
xxqfamous 49efd7598a 贡献者仅匹配邮箱计算 2023-05-18 17:49:18 +08:00
xxq250 18d236f50f 国际化reset 2023-05-12 17:58:01 +08:00
xxq250 a868cce758 国际化 2023-05-12 17:25:36 +08:00
xxq250 b593911114 国际化 2023-05-12 16:27:25 +08:00
xxq250 3872146a9d commit增加参数stat提高性能 2023-05-05 14:52:20 +08:00
yystopf d70d74a2ae 更改:使用gitcmd保证不会broken 2023-04-17 11:11:59 +08:00
yystopf f513d462e5 新增:贡献者代码行接口 2023-04-17 10:38:18 +08:00
yystopf be7299a09d refactor: .devops/gitlink正式环境.yml 2023-04-17 10:08:13 +08:00
yystopf c1d4bdbab0 refactor: .devops/testgitea环境.yml 2023-04-11 18:03:29 +08:00
yystopf 9614d81c9a refactor: .devops/testgitea环境.yml 2023-04-11 16:58:54 +08:00
yystopf 357d28a2c9 更改:testgitea更新流水线文件 2023-04-11 09:47:23 +08:00
yystopf 3e2d43ab77 更改:testgitea更新流水线文件 2023-04-11 09:42:44 +08:00
yystopf 0828f86077 refactor: .devops/gitlink正式环境.yml 2023-04-11 09:26:24 +08:00
yystopf cf1341d559 feat: .devops/gitlink正式环境.yml 2023-04-08 13:15:03 +08:00
yystopf a350f16c89 Merge pull request 'v1.18.5版本更新' (#5) from develop into master 2023-03-30 14:47:59 +08:00
yystopf 552ea3e101 新增: webhook类型softbot 2023-03-30 11:45:30 +08:00
yystopf 7968d1ad46 更改:readme显示顺序 2023-03-30 11:26:20 +08:00
yystopf 36b8cb828c 修复:files特殊符号无法正常加载 2023-03-29 09:55:57 +08:00
yystopf e1d71eeea2 修复:contents 特殊符号加载失败 2023-03-28 17:31:33 +08:00
yystopf 5ead9a2271 新增:readme中文增加一条规则以及用户贡献占比 2023-03-28 14:14:49 +08:00
yystopf d101c834d8 修复:标签为空返回空数组,以及分支查询参数 2023-03-21 18:16:52 +08:00
yystopf ef95802907 修复:files接口无法正确加载 2023-03-20 10:01:03 +08:00
yystopf a8c396aef6 修复:shortlog 使用all 2023-03-17 11:01:53 +08:00
yystopf bc2c836cf1 新增:submodule为nil判断 2023-03-17 10:27:46 +08:00
yystopf 4f2b053d16 修改 2023-03-17 10:09:58 +08:00
yystopf d7bd567e6e 新增:testgitea2流水线 2023-03-17 10:05:39 +08:00
yystopf a1ebd11fc8 feat: .devops/testgitea2.yml 2023-03-17 09:54:35 +08:00
yystopf 3e0ac8ad78 修复 2023-03-15 18:09:42 +08:00
yystopf 65171d0bf7 更改:readme无后缀也显示 2023-03-15 17:59:02 +08:00
yystopf 12416d75df 更改:底层gitea版本为v1.18.5以及web页面更新 2023-03-14 17:43:19 +08:00
yystopf a03b918c78 Merge pull request '1.19.0-dev版本' (#4) from develop into master 2023-03-14 16:38:42 +08:00
yystopf 439626df6f Merge branch 'develop' of https://gitlink.org.cn/Gitlink/gitea_hat into develop 2023-03-07 15:21:12 +08:00
yystopf 89651b74ca 修复:合并请求指派人员无法正常更新 2023-03-07 15:20:46 +08:00
yystopf 4631a393bd Merge pull request '更改贡献者效率以及webhook更新http_method支持' (#3) from yystopf/gitea_hat:develop into develop 2023-02-28 14:19:14 +08:00
yystopf 3cbba6e36f 新增:webhook编辑支持http_method 2023-02-28 14:16:46 +08:00
yystopf dc9cd9e168 新增:贡献者新方案解决效率 2023-02-28 10:48:49 +08:00
yystopf 3925862c78 Merge pull request '修复gitRepo为nil报错的问题' (#2) from yystopf/gitea_hat:develop into develop 2023-02-23 13:59:04 +08:00
yystopf ab66f7a4de 修复:gitrepo nil 问题 2023-02-23 13:57:38 +08:00
yystopf 9189a65bea Merge pull request '仓库详情页测试及修改' (#1) from yystopf/gitea_hat:develop into develop 2023-02-23 11:36:42 +08:00
yystopf 4df80116dc 更改:贡献者获取规则 2023-02-23 11:31:57 +08:00
yystopf a1099096cb 新增:分支列表接口支持搜索参数 2023-02-23 09:47:54 +08:00
yystopf b83c3eabc9 新增:木兰协议 2023-02-22 17:44:38 +08:00
yystopf ac55b051f8 修复 2023-02-03 16:10:58 +08:00
yystopf 544386cbb4 修复:contributors接口数据为空返回空数组 2023-02-02 15:25:31 +08:00
yystopf 9033d59c99 修复:branch slice接口无法正常访问 2023-02-02 15:19:17 +08:00
yystopf a032635665 修复:邮箱匹配规则更改 2023-02-02 14:48:46 +08:00
yystopf 98d687ab3f 更新:流水线配置文件 2023-02-02 11:52:49 +08:00
yystopf 40141b10f6 更新:流水线配置文件 2023-02-02 11:33:51 +08:00
yystopf c22f20cc89 feat: .devops/testgitea环境.yml 2023-02-02 11:28:44 +08:00
yystopf 162ed35ac4 新增:仓库代码贡献情况接口 2023-02-02 10:56:41 +08:00
yystopf c556386422 修复 2023-01-12 17:20:45 +08:00
yystopf 1983c14386 修复:空指针异常以及diff信息返回 2023-01-12 17:10:48 +08:00
yystopf 6fe8614ffe 新增:组织团队新增全部项目和移除全部项目接口 2023-01-12 15:37:32 +08:00
yystopf b578e5b990 新增:创建版本逻辑 2023-01-11 16:38:59 +08:00
yystopf dc6b0413da 新增:系统钩子来捕捉pr提交 2023-01-11 15:37:25 +08:00
yystopf 7ebd069424 新增:合并请求版本管理任务 2023-01-10 19:05:35 +08:00
yystopf a129d256ea 新增:合并请求版本相关接口 2023-01-09 11:51:32 +08:00
yystopf 647d775a0b 新增:合并请求版本模型 2023-01-06 18:37:33 +08:00
yystopf 0883f29c1c 新增:搜索文件接口 2023-01-04 17:52:48 +08:00
yystopf 53a2245a73 新增:批量更改文件接口 2023-01-04 16:27:22 +08:00
yystopf a6a662c6e3 更改:blame接口响应结构体 2023-01-03 11:43:37 +08:00
yystopf 484a4ce01a 新增:获取仓库blame内容接口 2023-01-03 11:41:57 +08:00
yystopf 64352810b1 更改:wiki名称不使用normalizeWikiName 2022-12-29 16:51:41 +08:00
yystopf 2fb40f7877 新增:获取分支、标签数量接口 2022-12-29 15:52:38 +08:00
yystopf f625463cf9 更改:获取wiki详情内容实用blackfriday 2022-12-29 15:34:54 +08:00
yystopf 15018595fe 新增:直接迁移项目接口 2022-12-28 15:35:23 +08:00
yystopf 6973f230e6 新增:获取webhook推送历史接口 2022-12-27 16:54:49 +08:00
yystopf be7e6c1551 新增:创建webhook接口 2022-12-27 14:49:16 +08:00
yystopf 966797489d 新增:获取commit下diff内容 2022-12-26 14:48:17 +08:00
yystopf f1088ea158 新增:commit详情加载分支信息 2022-12-26 10:10:06 +08:00
yystopf 5fa04a24db 新增:获取仓库下所有文件文件夹内容(包含最后一次commit信息) 2022-12-23 17:57:04 +08:00
yystopf 7cadb49770 新增:更新用户接口 2022-12-22 14:28:33 +08:00
yystopf 34f7949c09 新增:更新组织接口 2022-12-22 10:37:37 +08:00
yystopf 5924aa5c45 新增:发行版返回sha 2022-12-21 17:18:56 +08:00
yystopf b18906605a 新增:用户提交次数分布api(按时间) 2022-12-20 18:16:44 +08:00
yystopf 2f56447e7a 更改:底层gitea版本为v1.19.0-dev 2022-12-14 15:46:15 +08:00
2345 changed files with 153940 additions and 161447 deletions

View File

@ -0,0 +1,68 @@
version: 2
name: gitlink正式环境
description: ""
global:
concurrent: 1
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
on-failure: ignore
task: git_clone@1.2.6
input:
remote_url: '"https://gitlink.org.cn/Gitlink/gitea_hat.git"'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: end
name: 结束
task: end
needs:
- gitlink_ssh_cmd_0
- ref: gitlink_scp_resource_0
name: scp复制文件支持跳板机
on-failure: ignore
task: yystopf/gitlink_scp_resource@0.0.7
input:
ssh_private_key: ((ssh.siyao))
remote_host: '"10.9.117.109"'
remote_port: '"22"'
remote_user: '"root"'
remote_file: '"/root/gitea"'
local_file: golang_build_node_0.bin_dir
gateway_host: '"123.59.135.93"'
gateway_port: '"51123"'
gateway_user: '"pdl"'
temp_file: '"/home/pdl/gitea"'
needs:
- golang_build_node_0
- ref: golang_build_node_0
name: golang_build_node
on-failure: ignore
task: yystopf/golang_build_node@0.0.2
input:
workspace: git_clone_0.git_path
out_bin_name: '"gitea"'
goos: '"linux"'
goarch: '"amd64"'
needs:
- git_clone_0
- ref: gitlink_ssh_cmd_0
name: ssh执行命令支持跳板机
task: yystopf/gitlink_ssh_cmd@0.0.6
input:
ssh_private_key: ((ssh.siyao))
remote_host: '"10.9.117.109"'
remote_port: '"22"'
remote_user: '"root"'
gateway_host: '"123.59.135.93"'
gateway_port: '"51123"'
gateway_user: '"pdl"'
ssh_cmd: '"sh update.sh"'
needs:
- gitlink_scp_resource_0

40
.devops/test.yml Normal file
View File

@ -0,0 +1,40 @@
version: 2
name: test
description: ""
global:
concurrent: 1
trigger:
webhook: gitlink@1.0.0
event:
- ref: push
ruleset-operator: AND
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
task: git_clone@1.2.9
input:
remote_url: '""'
ref: '"refs/heads/master"'
commit_id: '""'
depth: 1
needs:
- start
- ref: golong_build_122_0
name: golang build 1.22
task: dagege/golong_build_122@1.0.4
input:
workspace: git_clone_0.git_path
out_bin_name: catpaw
GOOS: '"linux"'
GOARCH: '"amd64"'
needs:
- git_clone_0
- ref: end
name: 结束
task: end
needs:
- golong_build_122_0

40
.devops/testgitea2.yml Normal file
View File

@ -0,0 +1,40 @@
version: 2
name: testgitea2
description: ""
global:
concurrent: 1
trigger:
webhook: gitlink@1.0.0
event:
- ref: push
ruleset:
- param-ref: branch
operator: EQ
value: '"develop"'
ruleset-operator: AND
workflow:
- ref: start
name: 开始
task: start
- ref: ssh_cmd_0
name: ssh执行命令
task: ssh_cmd@1.1.0
input:
ssh_private_key: ((ssh.siyao))
ssh_ip: '"123.59.135.93"'
ssh_port: '"51123"'
ssh_user: '"pdl"'
ssh_cmd: '"ssh root@10.9.101.74 -p22 \"
cd /root
&&
sh ./update.sh
&&
echo done \""'
needs:
- start
- ref: end
name: 结束
task: end
needs:
- ssh_cmd_0

View File

@ -0,0 +1,77 @@
version: 2
name: testgitea环境
description: ""
global:
concurrent: 1
trigger:
webhook: gitlink@1.0.0
event:
- ref: push
ruleset:
- param-ref: branch
operator: EQ
value: '"feature"'
ruleset-operator: AND
workflow:
- ref: start
name: 开始
task: start
- ref: git_clone_0
name: git clone
on-failure: ignore
task: git_clone@1.2.6
input:
remote_url: '"https://gitlink.org.cn/Gitlink/gitea_hat.git"'
ref: '"refs/heads/feature"'
commit_id: '""'
depth: 1
needs:
- start
- ref: golang_build_node_0
name: golang_build_node
on-failure: ignore
task: yystopf/golang_build_node@0.0.2
input:
workspace: git_clone_0.git_path
out_bin_name: '"gitea"'
goos: '"linux"'
goarch: '"amd64"'
needs:
- git_clone_0
- ref: gitlink_scp_resource_0
name: scp复制文件支持跳板机
on-failure: ignore
task: yystopf/gitlink_scp_resource@0.0.7
input:
ssh_private_key: ((ssh.siyao))
remote_host: '"10.9.69.134"'
remote_port: '"30122"'
remote_user: '"root"'
remote_file: '"/root/gitea"'
local_file: golang_build_node_0.bin_dir
gateway_host: '"123.59.135.93"'
gateway_port: '"51123"'
gateway_user: '"pdl"'
temp_file: '"/home/pdl/gitea"'
needs:
- golang_build_node_0
- ref: gitlink_ssh_cmd_0
name: ssh执行命令支持跳板机
task: yystopf/gitlink_ssh_cmd@0.0.6
input:
ssh_private_key: ((ssh.siyao))
remote_host: '"10.9.69.134"'
remote_port: '"30122"'
remote_user: '"root"'
gateway_host: '"123.59.135.93"'
gateway_port: '"51123"'
gateway_user: '"pdl"'
ssh_cmd: '"sh update.sh"'
needs:
- gitlink_scp_resource_0
- ref: end
name: 结束
task: end
needs:
- gitlink_ssh_cmd_0

21
Dockerfile Normal file
View File

@ -0,0 +1,21 @@
FROM golang:alpine as build
ENV GOPROXY https://goproxy.cn
WORKDIR /app
COPY . .
RUN sh build.sh
FROM gitea/gitea:1.21.0
ENV USER git
ENV GITEA_CUSTOM /data/gitea
VOLUME ["/data"]
ENTRYPOINT ["/usr/bin/entrypoint"]
CMD ["/bin/s6-svscan", "/etc/s6"]
COPY --from=build /app/gitea_hat /usr/local/bin/gitea

162
README.md
View File

@ -1,77 +1,85 @@
<p align="center">
<a href="" rel="noopener">
<img
width=360px
height=62px
src="https://forum.trustie.net/api/attachments/373016"
alt="Project logo"
style="background-color: #1b2440">
</a>
</p>
<h3 align="center">Gitea GitLink版本</h3>
<div align="center">
[![Status](https://img.shields.io/badge/status-active-success.svg)]()
[![GitLink Issues](https://img.shields.io/github/issues/kylelobo/The-Documentation-Compendium.svg)](https://www.gitlink.org.cn/Gitlink/gitea_hat/issues)
[![GitLink Pull Requests](https://img.shields.io/github/issues-pr/kylelobo/The-Documentation-Compendium.svg)](https://www.gitlink.org.cn/Gitlink/gitea_hat/pulls)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
</div>
---
<p align="center"> 此版本为GitLink平台使用的Git服务该服务基于Gitea进行开发。
<br>
</p>
- [🧐 关于](#-关于)
- [编译](#编译)
- [运行](#运行)
- [接口文档](#接口文档)
- [⛏️ 使用](#-使用)
## 🧐 关于
该项目是为了方便平台后续Gitea版本的升级将个性化接口部分从Gitea中抽离出来的项目模块定义遵循Gitea规则目前基于Gitea v1.17.3版本。
## 编译
类Linux平台在项目根目录运行
```shell
# 编译Linux 64位可执行程序
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gitea main.go
# 编译Windows 64位可执行程序
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o gitea main.go
# 编译mac 64位可执行程序
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gitea main.go
```
Win平台在项目根目录运行:
```shell
# 编译Linux 64位可执行程序
SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build -o gitea main.go
...
```
## 运行
在项目根目录下运行:
```
./gitea -p 10082
```
## 接口文档
- [ApiDoc](https://www.apifox.cn/apidoc/project-1809666) - 接口文档
## ⛏️ 使用
- [Gitea](https://gitea.io/zh-cn/) - Gitea
<p align="center">
<a href="" rel="noopener">
<img
width=360px
height=62px
src="https://forum.trustie.net/api/attachments/373016"
alt="Project logo"
style="background-color: #1b2440">
</a>
</p>
<h3 align="center">Gitea GitLink版本</h3>
<div align="center">
[![Status](https://img.shields.io/badge/status-active-success.svg)]()
[![GitLink Issues](https://img.shields.io/github/issues/kylelobo/The-Documentation-Compendium.svg)](https://www.gitlink.org.cn/Gitlink/gitea_hat/issues)
[![GitLink Pull Requests](https://img.shields.io/github/issues-pr/kylelobo/The-Documentation-Compendium.svg)](https://www.gitlink.org.cn/Gitlink/gitea_hat/pulls)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](/LICENSE)
</div>
---
<p align="center"> 此版本为GitLink平台使用的Git服务该服务基于Gitea进行开发。
<br>
</p>
- [🧐 关于](#-关于)
- [Go环境安装](#go环境安装)
- [编译](#编译)
- [运行](#运行)
- [接口文档](#接口文档)
- [⛏️ 使用](#-使用)
## 🧐 关于
该项目是为了方便平台后续Gitea版本的升级将个性化接口部分从Gitea中抽离出来的项目模块定义遵循Gitea规则目前基于Gitea v1.18.5版本。
## Go环境安装
推荐1.20.x以上版本下载https://go.dev/dl/
## 编译
```
sh build.sh
```
类Linux平台在项目根目录运行
```shell
# 编译Linux 64位可执行程序
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o gitea main.go
# 编译Windows 64位可执行程序
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -o gitea main.go
# 编译mac 64位可执行程序
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o gitea main.go
```
Win平台在项目根目录运行:
```shell
# 编译Linux 64位可执行程序
SET CGO_ENABLED=0
SET GOOS=linux
SET GOARCH=amd64
go build -o gitea main.go
...
```
## 运行
在项目根目录下运行:
```
./gitea -p 10082
```
## 接口文档
- [ApiDoc](https://www.apifox.cn/apidoc/project-1809666) - 接口文档
## ⛏️ 使用
- [Gitea](https://gitea.io/zh-cn/) - Gitea

174
app.ini.example Normal file
View File

@ -0,0 +1,174 @@
APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
RUN_MODE = prod
WORK_PATH = /usr/local/bin
[nacos]
SERVER = 127.0.0.1
PORT = 8848
WEIGHT = 10
[oauth2]
JWT_SECRET = pyD-ZA6zwykBhVCWdF5FsdRGDtM6kg16JLhcCu8uLPM
[security]
INTERNAL_TOKEN = eyDDbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYmYiOjE1NzQyMzU3OTN9.w7RDQaNanZHdC2XIrr9kAntPIjhfkXXOiBnNTbEdqQ8
INSTALL_LOCK = true
SECRET_KEY = K4DDaucPzKQnTf7WQxKFIoFNtIlsWVacoN5Ss3VDypQBUes7Ncy96UU735sfGOar
REVERSE_PROXY_LIMIT = 1
REVERSE_PROXY_TRUSTED_PROXIES = *
PASSWORD_HASH_ALGO = pbkdf2
[database]
PATH = /data/gitea/gitea.db
DB_TYPE = mysql
HOST = 127.0.0.1:3306
NAME = gitea_hat
USER = root
PASSWD = `123456`
MYSQL_CHARSET = utf8
SSL_MODE = disable
CONN_MAX_LIFE_TIME=180
MAX_IDLE_CONNS=5
MAX_OPEN_CONNS=200
LOG_SQL =false
[repository]
ROOT = /data/gitea-repositories
DEFAULT_BRANCH = master
DEFAULT_FORK_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects,repo.packages,repo.actions
[repository.local]
LOCAL_COPY_PATH = /data/gitea/tmp/local-repo
[repository.upload]
TEMP_PATH = /data/gitea/uploads
[repository.pull-request]
DEFAULT_MERGE_STYLE = merge
[repository.signing]
DEFAULT_TRUST_MODEL = committer
[lfs]
PATH = /data/git/lfs
[server]
APP_DATA_PATH = /data/gitea
DOMAIN = 172.20.32.201
SSH_DOMAIN = 172.20.32.201
HTTP_PORT = 3000
ROOT_URL = http://172.20.32.201:10082/
DISABLE_SSH = false
SSH_PORT = 2022
SSH_LISTEN_PORT = 22
LFS_START_SERVER = true
LFS_JWT_SECRET = n2kib4qdArULO57JW0jD2Ygm3z1ehzI8Y4zVfbxouyY
OFFLINE_MODE = false
[mailer]
ENABLED = false
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = true
ALLOW_ONLY_EXTERNAL_REGISTRATION = false
ENABLE_CAPTCHA = false
REQUIRE_SIGNIN_VIEW = false
DEFAULT_KEEP_EMAIL_PRIVATE = false
DEFAULT_ALLOW_CREATE_ORGANIZATION = true
DEFAULT_ENABLE_TIMETRACKING = true
NO_REPLY_ADDRESS = noreply.example.org
SHOW_REGISTRATION_BUTTON = false
[webhook]
ALLOWED_HOST_LIST = *
[indexer]
ISSUE_INDEXER_PATH = /data/gitea/indexers/issues.bleve
[session]
PROVIDER_CONFIG = /data/gitea/sessions
PROVIDER = file
[picture]
DISABLE_GRAVATAR = true
ENABLE_FEDERATED_AVATAR = false
[attachment]
PATH = /data/gitea/attachments
[openid]
ENABLE_OPENID_SIGNIN = true
ENABLE_OPENID_SIGNUP = true
[session]
PROVIDER = file
[log]
MODE = file
LEVEL = Trace
ROOT_PATH = /data/gitea/log
REDIRECT_MACARON_LOG = true
ENABLE_ACCESS_LOG = true
[api]
DEFAULT_PAGING_NUM = 200
MAX_RESPONSE_ITEMS = 200
[git]
PATH =
DISABLE_DIFF_HIGHLIGHT = false
MAX_GIT_DIFF_LINES = 1000
MAX_GIT_DIFF_LINE_CHARACTERS = 5000
MAX_GIT_DIFF_FILES = 100
GC_ARGS =
EnableAutoGitWireProtocol = true
COMMITS_RANGE_SIZE = 50
; Operation timeout in seconds
[git.timeout]
DEFAULT = 1800
MIGRATE = 21600
MIRROR = 1800
CLONE = 1800
PULL = 1800
GC = 60
[cache]
ENABLED = true
ADAPTER = memory
INTERVAL = 60
HOST =
ITEM_TTL = 16h
[cache.last_commit]
ENABLED = true
ITEM_TTL = 24h
COMMITS_COUNT = 1000
[migrations]
ALLOW_LOCALNETWORKS = true
#[cron.update_mirrors]
#SCHEDULE = @every 24h
[cron.delete_repo_archives]
ENABLED = true
RUN_AT_START = true
SCHEDULE = @every 72h
OLDER_THAN = 8h
[cron.update_checker]
ENABLED = false
[storage.repo-archive]
PATH = /data/repo-archive
[mirror]
ENABLED = true
[ssh.minimum_key_sizes]
RSA = 2048

14
build.go Normal file
View File

@ -0,0 +1,14 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
//go:build vendor
package main
// Libraries that are included to vendor utilities used during build.
// These libraries will not be included in a normal compilation.
import (
// for embed
_ "github.com/shurcooL/vfsgen"
)

15
build.sh Normal file
View File

@ -0,0 +1,15 @@
#!/bin/bash
echo "go mod tidy..."
go mod tidy
echo "go mod vendor..."
go mod vendor
echo "go generate bindata.go for migration,options,public,templates..."
go run build/generate-bindata.go modules/schemas migration vendor/code.gitea.io/gitea/modules/migration/bindata.go
go run build/generate-bindata.go options options vendor/code.gitea.io/gitea/modules/options/bindata.go
go run build/generate-bindata.go public public vendor/code.gitea.io/gitea/modules/public/bindata.go
go run build/generate-bindata.go templates templates vendor/code.gitea.io/gitea/modules/templates/bindata.go
echo "go build -tags 'bindata' -o gitea_hat main.go..."
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -tags 'bindata' -o gitea_hat main.go

87
build/generate-bindata.go Normal file
View File

@ -0,0 +1,87 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
package main
import (
"bytes"
"crypto/sha1"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
"path/filepath"
"strconv"
"github.com/shurcooL/vfsgen"
)
func needsUpdate(dir string, filename string) (bool, []byte) {
needRegen := false
_, err := os.Stat(filename)
if err != nil {
needRegen = true
}
oldHash, err := ioutil.ReadFile(filename + ".hash")
if err != nil {
oldHash = []byte{}
}
hasher := sha1.New()
err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
_, _ = hasher.Write([]byte(info.Name()))
_, _ = hasher.Write([]byte(info.ModTime().String()))
_, _ = hasher.Write([]byte(strconv.FormatInt(info.Size(), 16)))
return nil
})
if err != nil {
return true, oldHash
}
newHash := hasher.Sum([]byte{})
if bytes.Compare(oldHash, newHash) != 0 {
return true, newHash
}
return needRegen, newHash
}
func main() {
if len(os.Args) != 4 {
log.Fatal("Insufficient number of arguments. Need: directory packageName filename")
}
dir, packageName, filename := os.Args[1], os.Args[2], os.Args[3]
update, newHash := needsUpdate(dir, filename)
if !update {
fmt.Printf("bindata for %s already up-to-date\n", packageName)
return
}
fmt.Printf("generating bindata for %s\n", packageName)
var fsTemplates http.FileSystem = http.Dir(dir)
err := vfsgen.Generate(fsTemplates, vfsgen.Options{
PackageName: packageName,
BuildTags: "bindata",
VariableName: "Assets",
Filename: filename,
})
if err != nil {
log.Fatalf("%v\n", err)
}
_ = ioutil.WriteFile(filename+".hash", newHash, 0666)
}

225
build/generate-emoji.go Normal file
View File

@ -0,0 +1,225 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
// Copyright 2015 Kenneth Shaw
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
//go:build ignore
// +build ignore
package main
import (
"flag"
"fmt"
"go/format"
"io/ioutil"
"log"
"net/http"
"regexp"
"sort"
"strconv"
"strings"
"unicode/utf8"
jsoniter "github.com/json-iterator/go"
)
const (
gemojiURL = "https://raw.githubusercontent.com/github/gemoji/master/db/emoji.json"
maxUnicodeVersion = 12
)
var (
flagOut = flag.String("o", "modules/emoji/emoji_data.go", "out")
)
// Gemoji is a set of emoji data.
type Gemoji []Emoji
// Emoji represents a single emoji and associated data.
type Emoji struct {
Emoji string `json:"emoji"`
Description string `json:"description,omitempty"`
Aliases []string `json:"aliases"`
UnicodeVersion string `json:"unicode_version,omitempty"`
SkinTones bool `json:"skin_tones,omitempty"`
}
// Don't include some fields in JSON
func (e Emoji) MarshalJSON() ([]byte, error) {
type emoji Emoji
x := emoji(e)
x.UnicodeVersion = ""
x.Description = ""
x.SkinTones = false
json := jsoniter.ConfigCompatibleWithStandardLibrary
return json.Marshal(x)
}
func main() {
var err error
flag.Parse()
// generate data
buf, err := generate()
if err != nil {
log.Fatal(err)
}
// write
err = ioutil.WriteFile(*flagOut, buf, 0644)
if err != nil {
log.Fatal(err)
}
}
var replacer = strings.NewReplacer(
"main.Gemoji", "Gemoji",
"main.Emoji", "\n",
"}}", "},\n}",
", Description:", ", ",
", Aliases:", ", ",
", UnicodeVersion:", ", ",
", SkinTones:", ", ",
)
var emojiRE = regexp.MustCompile(`\{Emoji:"([^"]*)"`)
func generate() ([]byte, error) {
var err error
// load gemoji data
res, err := http.Get(gemojiURL)
if err != nil {
return nil, err
}
defer res.Body.Close()
// read all
body, err := ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
}
// unmarshal
var data Gemoji
json := jsoniter.ConfigCompatibleWithStandardLibrary
err = json.Unmarshal(body, &data)
if err != nil {
return nil, err
}
var skinTones = make(map[string]string)
skinTones["\U0001f3fb"] = "Light Skin Tone"
skinTones["\U0001f3fc"] = "Medium-Light Skin Tone"
skinTones["\U0001f3fd"] = "Medium Skin Tone"
skinTones["\U0001f3fe"] = "Medium-Dark Skin Tone"
skinTones["\U0001f3ff"] = "Dark Skin Tone"
var tmp Gemoji
//filter out emoji that require greater than max unicode version
for i := range data {
val, _ := strconv.ParseFloat(data[i].UnicodeVersion, 64)
if int(val) <= maxUnicodeVersion {
tmp = append(tmp, data[i])
}
}
data = tmp
sort.Slice(data, func(i, j int) bool {
return data[i].Aliases[0] < data[j].Aliases[0]
})
aliasMap := make(map[string]int, len(data))
for i, e := range data {
if e.Emoji == "" || len(e.Aliases) == 0 {
continue
}
for _, a := range e.Aliases {
if a == "" {
continue
}
aliasMap[a] = i
}
}
// gitea customizations
i, ok := aliasMap["tada"]
if ok {
data[i].Aliases = append(data[i].Aliases, "hooray")
}
i, ok = aliasMap["laughing"]
if ok {
data[i].Aliases = append(data[i].Aliases, "laugh")
}
// write a JSON file to use with tribute (write before adding skin tones since we can't support them there yet)
file, _ := json.Marshal(data)
_ = ioutil.WriteFile("assets/emoji.json", file, 0644)
// Add skin tones to emoji that support it
var (
s []string
newEmoji string
newDescription string
newData Emoji
)
for i := range data {
if data[i].SkinTones {
for k, v := range skinTones {
s = strings.Split(data[i].Emoji, "")
if utf8.RuneCountInString(data[i].Emoji) == 1 {
s = append(s, k)
} else {
// insert into slice after first element because all emoji that support skin tones
// have that modifier placed at this spot
s = append(s, "")
copy(s[2:], s[1:])
s[1] = k
}
newEmoji = strings.Join(s, "")
newDescription = data[i].Description + ": " + v
newAlias := data[i].Aliases[0] + "_" + strings.ReplaceAll(v, " ", "_")
newData = Emoji{newEmoji, newDescription, []string{newAlias}, "12.0", false}
data = append(data, newData)
}
}
}
// add header
str := replacer.Replace(fmt.Sprintf(hdr, gemojiURL, data))
// change the format of the unicode string
str = emojiRE.ReplaceAllStringFunc(str, func(s string) string {
var err error
s, err = strconv.Unquote(s[len("{Emoji:"):])
if err != nil {
panic(err)
}
return "{" + strconv.QuoteToASCII(s)
})
// format
return format.Source([]byte(str))
}
const hdr = `
// Copyright 2020 The Gitea Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package emoji
// Code generated by gen.go. DO NOT EDIT.
// Sourced from %s
//
var GemojiData = %#v
`

View File

@ -0,0 +1,131 @@
//go:build ignore
// +build ignore
package main
import (
"archive/tar"
"compress/gzip"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"path"
"path/filepath"
"strings"
"code.gitea.io/gitea/modules/util"
)
func main() {
var (
prefix = "gitea-gitignore"
url = "https://api.github.com/repos/github/gitignore/tarball"
githubApiToken = ""
githubUsername = ""
destination = ""
)
flag.StringVar(&destination, "dest", "options/gitignore/", "destination for the gitignores")
flag.StringVar(&githubUsername, "username", "", "github username")
flag.StringVar(&githubApiToken, "token", "", "github api token")
flag.Parse()
file, err := ioutil.TempFile(os.TempDir(), prefix)
if err != nil {
log.Fatalf("Failed to create temp file. %s", err)
}
defer util.Remove(file.Name())
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatalf("Failed to download archive. %s", err)
}
if len(githubApiToken) > 0 && len(githubUsername) > 0 {
req.SetBasicAuth(githubUsername, githubApiToken)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatalf("Failed to download archive. %s", err)
}
defer resp.Body.Close()
if _, err := io.Copy(file, resp.Body); err != nil {
log.Fatalf("Failed to copy archive to file. %s", err)
}
if _, err := file.Seek(0, 0); err != nil {
log.Fatalf("Failed to reset seek on archive. %s", err)
}
gz, err := gzip.NewReader(file)
if err != nil {
log.Fatalf("Failed to gunzip the archive. %s", err)
}
tr := tar.NewReader(gz)
filesToCopy := make(map[string]string, 0)
for {
hdr, err := tr.Next()
if err == io.EOF {
break
}
if err != nil {
log.Fatalf("Failed to iterate archive. %s", err)
}
if filepath.Ext(hdr.Name) != ".gitignore" {
continue
}
if hdr.Typeflag == tar.TypeSymlink {
fmt.Printf("Found symlink %s -> %s\n", hdr.Name, hdr.Linkname)
filesToCopy[strings.TrimSuffix(filepath.Base(hdr.Name), ".gitignore")] = strings.TrimSuffix(filepath.Base(hdr.Linkname), ".gitignore")
continue
}
out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".gitignore")))
if err != nil {
log.Fatalf("Failed to create new file. %s", err)
}
defer out.Close()
if _, err := io.Copy(out, tr); err != nil {
log.Fatalf("Failed to write new file. %s", err)
} else {
fmt.Printf("Written %s\n", out.Name())
}
}
for dst, src := range filesToCopy {
// Read all content of src to data
src = path.Join(destination, src)
data, err := ioutil.ReadFile(src)
if err != nil {
log.Fatalf("Failed to read src file. %s", err)
}
// Write data to dst
dst = path.Join(destination, dst)
err = ioutil.WriteFile(dst, data, 0644)
if err != nil {
log.Fatalf("Failed to write new file. %s", err)
}
fmt.Printf("Written (copy of %s) %s\n", src, dst)
}
fmt.Println("Done")
}

83
build/generate-images.js Executable file
View File

@ -0,0 +1,83 @@
import imageminZopfli from 'imagemin-zopfli';
import {optimize, extendDefaultPlugins} from 'svgo';
import {fabric} from 'fabric';
import fs from 'fs';
import {resolve, dirname} from 'path';
import {fileURLToPath} from 'url';
const {readFile, writeFile} = fs.promises;
const __dirname = dirname(fileURLToPath(import.meta.url));
const logoFile = resolve(__dirname, '../assets/logo.svg');
function exit(err) {
if (err) console.error(err);
process.exit(err ? 1 : 0);
}
function loadSvg(svg) {
return new Promise((resolve) => {
fabric.loadSVGFromString(svg, (objects, options) => {
resolve({objects, options});
});
});
}
async function generate(svg, outputFile, {size, bg}) {
if (outputFile.endsWith('.svg')) {
const {data} = optimize(svg, {
plugins: extendDefaultPlugins([
'removeDimensions',
{
name: 'addAttributesToSVGElement',
params: {attributes: [{width: size}, {height: size}]}
},
]),
});
await writeFile(outputFile, data);
return;
}
const {objects, options} = await loadSvg(svg);
const canvas = new fabric.Canvas();
canvas.setDimensions({width: size, height: size});
const ctx = canvas.getContext('2d');
ctx.scale(options.width ? (size / options.width) : 1, options.height ? (size / options.height) : 1);
if (bg) {
canvas.add(new fabric.Rect({
left: 0,
top: 0,
height: size * (1 / (size / options.height)),
width: size * (1 / (size / options.width)),
fill: 'white',
}));
}
canvas.add(fabric.util.groupSVGElements(objects, options));
canvas.renderAll();
let png = Buffer.from([]);
for await (const chunk of canvas.createPNGStream()) {
png = Buffer.concat([png, chunk]);
}
png = await imageminZopfli({more: true})(png);
await writeFile(outputFile, png);
}
async function main() {
const gitea = process.argv.slice(2).includes('gitea');
const svg = await readFile(logoFile, 'utf8');
await Promise.all([
generate(svg, resolve(__dirname, '../public/img/logo.svg'), {size: 32}),
generate(svg, resolve(__dirname, '../public/img/logo.png'), {size: 512}),
generate(svg, resolve(__dirname, '../public/img/favicon.png'), {size: 180}),
generate(svg, resolve(__dirname, '../public/img/avatar_default.png'), {size: 200}),
generate(svg, resolve(__dirname, '../public/img/apple-touch-icon.png'), {size: 180, bg: true}),
gitea && generate(svg, resolve(__dirname, '../public/img/gitea.svg'), {size: 32}),
]);
}
main().then(exit).catch(exit);

119
build/generate-licenses.go Normal file
View File

@ -0,0 +1,119 @@
//go:build ignore
// +build ignore
package main
import (
"archive/tar"
"compress/gzip"
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"path"
"path/filepath"
"strings"
"code.gitea.io/gitea/modules/util"
)
func main() {
var (
prefix = "gitea-licenses"
url = "https://api.github.com/repos/spdx/license-list-data/tarball"
githubApiToken = ""
githubUsername = ""
destination = ""
)
flag.StringVar(&destination, "dest", "options/license/", "destination for the licenses")
flag.StringVar(&githubUsername, "username", "", "github username")
flag.StringVar(&githubApiToken, "token", "", "github api token")
flag.Parse()
file, err := ioutil.TempFile(os.TempDir(), prefix)
if err != nil {
log.Fatalf("Failed to create temp file. %s", err)
}
defer util.Remove(file.Name())
req, err := http.NewRequest("GET", url, nil)
if err != nil {
log.Fatalf("Failed to download archive. %s", err)
}
if len(githubApiToken) > 0 && len(githubUsername) > 0 {
req.SetBasicAuth(githubUsername, githubApiToken)
}
resp, err := http.DefaultClient.Do(req)
if err != nil {
log.Fatalf("Failed to download archive. %s", err)
}
defer resp.Body.Close()
if _, err := io.Copy(file, resp.Body); err != nil {
log.Fatalf("Failed to copy archive to file. %s", err)
}
if _, err := file.Seek(0, 0); err != nil {
log.Fatalf("Failed to reset seek on archive. %s", err)
}
gz, err := gzip.NewReader(file)
if err != nil {
log.Fatalf("Failed to gunzip the archive. %s", err)
}
tr := tar.NewReader(gz)
for {
hdr, err := tr.Next()
if err == io.EOF {
break
}
if err != nil {
log.Fatalf("Failed to iterate archive. %s", err)
}
if !strings.Contains(hdr.Name, "/text/") {
continue
}
if filepath.Ext(hdr.Name) != ".txt" {
continue
}
if strings.HasPrefix(filepath.Base(hdr.Name), "README") {
continue
}
if strings.HasPrefix(filepath.Base(hdr.Name), "deprecated_") {
continue
}
out, err := os.Create(path.Join(destination, strings.TrimSuffix(filepath.Base(hdr.Name), ".txt")))
if err != nil {
log.Fatalf("Failed to create new file. %s", err)
}
defer out.Close()
if _, err := io.Copy(out, tr); err != nil {
log.Fatalf("Failed to write new file. %s", err)
} else {
fmt.Printf("Written %s\n", out.Name())
}
}
fmt.Println("Done")
}

63
build/generate-svg.js Executable file
View File

@ -0,0 +1,63 @@
import fastGlob from 'fast-glob';
import {optimize, extendDefaultPlugins} from 'svgo';
import {resolve, parse, dirname} from 'path';
import fs from 'fs';
import {fileURLToPath} from 'url';
const {readFile, writeFile, mkdir} = fs.promises;
const __dirname = dirname(fileURLToPath(import.meta.url));
const glob = (pattern) => fastGlob.sync(pattern, {cwd: resolve(__dirname), absolute: true});
const outputDir = resolve(__dirname, '../public/img/svg');
function exit(err) {
if (err) console.error(err);
process.exit(err ? 1 : 0);
}
async function processFile(file, {prefix, fullName} = {}) {
let name;
if (fullName) {
name = fullName;
} else {
name = parse(file).name;
if (prefix) name = `${prefix}-${name}`;
if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons
}
const {data} = optimize(await readFile(file, 'utf8'), {
plugins: extendDefaultPlugins([
'removeXMLNS',
'removeDimensions',
{name: 'prefixIds', params: {prefix: () => name}},
{
name: 'addClassesToSVGElement',
params: {classNames: ['svg', name]},
},
{
name: 'addAttributesToSVGElement',
params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]},
},
]),
});
await writeFile(resolve(outputDir, `${name}.svg`), data);
}
function processFiles(pattern, opts) {
return glob(pattern).map((file) => processFile(file, opts));
}
async function main() {
try {
await mkdir(outputDir);
} catch {}
await Promise.all([
...processFiles('../node_modules/@primer/octicons/build/svg/*-16.svg', {prefix: 'octicon'}),
...processFiles('../web_src/svg/*.svg'),
...processFiles('../public/img/gitea.svg', {fullName: 'gitea-gitea'}),
]);
}
main().then(exit).catch(exit);

120
build/gocovmerge.go Normal file
View File

@ -0,0 +1,120 @@
// Copyright 2020 The Gitea Authors. All rights reserved.
// Copyright (c) 2015, Wade Simmons
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
// gocovmerge takes the results from multiple `go test -coverprofile` runs and
// merges them into one profile
//go:build ignore
// +build ignore
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"sort"
"golang.org/x/tools/cover"
)
func mergeProfiles(p *cover.Profile, merge *cover.Profile) {
if p.Mode != merge.Mode {
log.Fatalf("cannot merge profiles with different modes")
}
// Since the blocks are sorted, we can keep track of where the last block
// was inserted and only look at the blocks after that as targets for merge
startIndex := 0
for _, b := range merge.Blocks {
startIndex = mergeProfileBlock(p, b, startIndex)
}
}
func mergeProfileBlock(p *cover.Profile, pb cover.ProfileBlock, startIndex int) int {
sortFunc := func(i int) bool {
pi := p.Blocks[i+startIndex]
return pi.StartLine >= pb.StartLine && (pi.StartLine != pb.StartLine || pi.StartCol >= pb.StartCol)
}
i := 0
if sortFunc(i) != true {
i = sort.Search(len(p.Blocks)-startIndex, sortFunc)
}
i += startIndex
if i < len(p.Blocks) && p.Blocks[i].StartLine == pb.StartLine && p.Blocks[i].StartCol == pb.StartCol {
if p.Blocks[i].EndLine != pb.EndLine || p.Blocks[i].EndCol != pb.EndCol {
log.Fatalf("OVERLAP MERGE: %v %v %v", p.FileName, p.Blocks[i], pb)
}
switch p.Mode {
case "set":
p.Blocks[i].Count |= pb.Count
case "count", "atomic":
p.Blocks[i].Count += pb.Count
default:
log.Fatalf("unsupported covermode: '%s'", p.Mode)
}
} else {
if i > 0 {
pa := p.Blocks[i-1]
if pa.EndLine >= pb.EndLine && (pa.EndLine != pb.EndLine || pa.EndCol > pb.EndCol) {
log.Fatalf("OVERLAP BEFORE: %v %v %v", p.FileName, pa, pb)
}
}
if i < len(p.Blocks)-1 {
pa := p.Blocks[i+1]
if pa.StartLine <= pb.StartLine && (pa.StartLine != pb.StartLine || pa.StartCol < pb.StartCol) {
log.Fatalf("OVERLAP AFTER: %v %v %v", p.FileName, pa, pb)
}
}
p.Blocks = append(p.Blocks, cover.ProfileBlock{})
copy(p.Blocks[i+1:], p.Blocks[i:])
p.Blocks[i] = pb
}
return i + 1
}
func addProfile(profiles []*cover.Profile, p *cover.Profile) []*cover.Profile {
i := sort.Search(len(profiles), func(i int) bool { return profiles[i].FileName >= p.FileName })
if i < len(profiles) && profiles[i].FileName == p.FileName {
mergeProfiles(profiles[i], p)
} else {
profiles = append(profiles, nil)
copy(profiles[i+1:], profiles[i:])
profiles[i] = p
}
return profiles
}
func dumpProfiles(profiles []*cover.Profile, out io.Writer) {
if len(profiles) == 0 {
return
}
fmt.Fprintf(out, "mode: %s\n", profiles[0].Mode)
for _, p := range profiles {
for _, b := range p.Blocks {
fmt.Fprintf(out, "%s:%d.%d,%d.%d %d %d\n", p.FileName, b.StartLine, b.StartCol, b.EndLine, b.EndCol, b.NumStmt, b.Count)
}
}
}
func main() {
flag.Parse()
var merged []*cover.Profile
for _, file := range flag.Args() {
profiles, err := cover.ParseProfiles(file)
if err != nil {
log.Fatalf("failed to parse profiles: %v", err)
}
for _, p := range profiles {
merged = addProfile(merged, p)
}
}
dumpProfiles(merged, os.Stdout)
}

23
build/update-locales.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
mv ./options/locale/locale_en-US.ini ./options/
# Make sure to only change lines that have the translation enclosed between quotes
sed -i -r -e '/^[a-zA-Z0-9_.-]+[ ]*=[ ]*".*"$/ {
s/^([a-zA-Z0-9_.-]+)[ ]*="/\1=/
s/\\"/"/g
s/"$//
}' ./options/locale/*.ini
# Remove translation under 25% of en_us
baselines=$(wc -l "./options/locale_en-US.ini" | cut -d" " -f1)
baselines=$((baselines / 4))
for filename in ./options/locale/*.ini; do
lines=$(wc -l "$filename" | cut -d" " -f1)
if [ $lines -lt $baselines ]; then
echo "Removing $filename: $lines/$baselines"
rm "$filename"
fi
done
mv ./options/locale_en-US.ini ./options/locale/

56
cmd/doctor_convert.go Normal file
View File

@ -0,0 +1,56 @@
// Copyright 2019 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package cmd
import (
"fmt"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"github.com/urfave/cli/v2"
)
// cmdDoctorConvert represents the available convert sub-command.
var cmdDoctorConvert = &cli.Command{
Name: "convert",
Usage: "Convert the database",
Description: "A command to convert an existing MySQL database from utf8 to utf8mb4 or MSSQL database from varchar to nvarchar",
Action: runDoctorConvert,
}
func runDoctorConvert(ctx *cli.Context) error {
stdCtx, cancel := installSignals()
defer cancel()
if err := initDB(stdCtx); err != nil {
return err
}
log.Info("AppPath: %s", setting.AppPath)
log.Info("AppWorkPath: %s", setting.AppWorkPath)
log.Info("Custom path: %s", setting.CustomPath)
log.Info("Log path: %s", setting.Log.RootPath)
log.Info("Configuration file: %s", setting.CustomConf)
switch {
case setting.Database.Type.IsMySQL():
if err := db.ConvertUtf8ToUtf8mb4(); err != nil {
log.Fatal("Failed to convert database from utf8 to utf8mb4: %v", err)
return err
}
fmt.Println("Converted successfully, please confirm your database's character set is now utf8mb4")
case setting.Database.Type.IsMSSQL():
if err := db.ConvertVarcharToNVarchar(); err != nil {
log.Fatal("Failed to convert database from varchar to nvarchar: %v", err)
return err
}
fmt.Println("Converted successfully, please confirm your database's all columns character is NVARCHAR now")
default:
fmt.Println("This command can only be used with a MySQL or MSSQL database")
}
return nil
}

190
cmd/main.go Normal file
View File

@ -0,0 +1,190 @@
// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package cmd
import (
"fmt"
"os"
"strings"
gitea_cmd "code.gitea.io/gitea/cmd"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/util"
"github.com/urfave/cli/v2"
)
// cmdHelp is our own help subcommand with more information
func cmdHelp() *cli.Command {
c := &cli.Command{
Name: "help",
Aliases: []string{"h"},
Usage: "Shows a list of commands or help for one command",
ArgsUsage: "[command]",
Action: func(c *cli.Context) (err error) {
lineage := c.Lineage() // The order is from child to parent: help, doctor, Gitea, {Command:nil}
targetCmdIdx := 0
if c.Command.Name == "help" {
targetCmdIdx = 1
}
if lineage[targetCmdIdx+1].Command != nil {
err = cli.ShowCommandHelp(lineage[targetCmdIdx+1], lineage[targetCmdIdx].Command.Name)
} else {
err = cli.ShowAppHelp(c)
}
_, _ = fmt.Fprintf(c.App.Writer, `
DEFAULT CONFIGURATION:
AppPath: %s
WorkPath: %s
CustomPath: %s
ConfigFile: %s
`, setting.AppPath, setting.AppWorkPath, setting.CustomPath, setting.CustomConf)
return err
},
}
return c
}
var helpFlag = cli.HelpFlag
func init() {
// cli.HelpFlag = nil TODO: after https://github.com/urfave/cli/issues/1794 we can use this
}
func appGlobalFlags() []cli.Flag {
return []cli.Flag{
// make the builtin flags at the top
helpFlag,
// shared configuration flags, they are for global and for each sub-command at the same time
// eg: such command is valid: "./gitea --config /tmp/app.ini web --config /tmp/app.ini", while it's discouraged indeed
// keep in mind that the short flags like "-C", "-c" and "-w" are globally polluted, they can't be used for sub-commands anymore.
&cli.StringFlag{
Name: "custom-path",
Aliases: []string{"C"},
Usage: "Set custom path (defaults to '{WorkPath}/custom')",
},
&cli.StringFlag{
Name: "config",
Aliases: []string{"c"},
Value: setting.CustomConf,
Usage: "Set custom config file (defaults to '{WorkPath}/custom/conf/app.ini')",
},
&cli.StringFlag{
Name: "work-path",
Aliases: []string{"w"},
Usage: "Set Gitea's working path (defaults to the Gitea's binary directory)",
},
}
}
func prepareSubcommandWithConfig(command *cli.Command, globalFlags []cli.Flag) {
command.Flags = append(append([]cli.Flag{}, globalFlags...), command.Flags...)
command.Action = prepareWorkPathAndCustomConf(command.Action)
command.HideHelp = true
if command.Name != "help" {
command.Subcommands = append(command.Subcommands, cmdHelp())
}
for i := range command.Subcommands {
prepareSubcommandWithConfig(command.Subcommands[i], globalFlags)
}
}
// prepareWorkPathAndCustomConf wraps the Action to prepare the work path and custom config
// It can't use "Before", because each level's sub-command's Before will be called one by one, so the "init" would be done multiple times
func prepareWorkPathAndCustomConf(action cli.ActionFunc) func(ctx *cli.Context) error {
return func(ctx *cli.Context) error {
var args setting.ArgWorkPathAndCustomConf
// from children to parent, check the global flags
for _, curCtx := range ctx.Lineage() {
if curCtx.IsSet("work-path") && args.WorkPath == "" {
args.WorkPath = curCtx.String("work-path")
}
if curCtx.IsSet("custom-path") && args.CustomPath == "" {
args.CustomPath = curCtx.String("custom-path")
}
if curCtx.IsSet("config") && args.CustomConf == "" {
args.CustomConf = curCtx.String("config")
}
}
setting.InitWorkPathAndCommonConfig(os.Getenv, args)
if ctx.Bool("help") || action == nil {
// the default behavior of "urfave/cli": "nil action" means "show help"
return cmdHelp().Action(ctx)
}
return action(ctx)
}
}
func NewMainApp(version, versionExtra string) *cli.App {
app := cli.NewApp()
app.Name = "Gitea"
app.Usage = "A painless self-hosted Git service"
app.Description = `By default, Gitea will start serving using the web-server with no argument, which can alternatively be run by running the subcommand "web".`
app.Version = version + versionExtra
app.EnableBashCompletion = true
// these sub-commands need to use config file
subCmdWithConfig := []*cli.Command{
CmdWeb,
gitea_cmd.CmdServ,
gitea_cmd.CmdHook,
gitea_cmd.CmdDump,
gitea_cmd.CmdAdmin,
gitea_cmd.CmdMigrate,
gitea_cmd.CmdKeys,
gitea_cmd.CmdDoctor,
gitea_cmd.CmdManager,
gitea_cmd.CmdEmbedded,
gitea_cmd.CmdMigrateStorage,
gitea_cmd.CmdDumpRepository,
gitea_cmd.CmdRestoreRepository,
gitea_cmd.CmdActions,
cmdHelp(), // the "help" sub-command was used to show the more information for "work path" and "custom config"
}
cmdConvert := util.ToPointer(*cmdDoctorConvert)
cmdConvert.Hidden = true // still support the legacy "./gitea doctor" by the hidden sub-command, remove it in next release
subCmdWithConfig = append(subCmdWithConfig, cmdConvert)
// these sub-commands do not need the config file, and they do not depend on any path or environment variable.
subCmdStandalone := []*cli.Command{
gitea_cmd.CmdCert,
gitea_cmd.CmdGenerate,
gitea_cmd.CmdDocs,
}
app.DefaultCommand = CmdWeb.Name
globalFlags := appGlobalFlags()
app.Flags = append(app.Flags, cli.VersionFlag)
app.Flags = append(app.Flags, globalFlags...)
app.HideHelp = true // use our own help action to show helps (with more information like default config)
app.Before = gitea_cmd.PrepareConsoleLoggerLevel(log.INFO)
for i := range subCmdWithConfig {
prepareSubcommandWithConfig(subCmdWithConfig[i], globalFlags)
}
app.Commands = append(app.Commands, subCmdWithConfig...)
app.Commands = append(app.Commands, subCmdStandalone...)
return app
}
func RunMainApp(app *cli.App, args ...string) error {
err := app.Run(args)
if err == nil {
return nil
}
if strings.HasPrefix(err.Error(), "flag provided but not defined:") {
// the cli package should already have output the error message, so just exit
cli.OsExiter(1)
return err
}
_, _ = fmt.Fprintf(app.ErrWriter, "Command error: %v\n", err)
cli.OsExiter(1)
return err
}

View File

@ -10,7 +10,7 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)
func installSignals() (context.Context, context.CancelFunc) {
@ -36,9 +36,9 @@ func installSignals() (context.Context, context.CancelFunc) {
}
func initDB(ctx context.Context) error {
setting.LoadFromExisting()
setting.InitDBConfig()
setting.NewXORMLogService(false)
setting.LoadCommonSettings()
setting.LoadDBSetting()
setting.InitSQLLoggersForCli(log.INFO)
if setting.Database.Type == "" {
log.Fatal(`Database settings are missing from the configuration file: %q.
@ -52,7 +52,7 @@ If this is the intended configuration file complete the [database] section.`, se
}
// CmdMigrate represents the available migrate sub-command.
var CmdMigrate = cli.Command{
var CmdMigrate = &cli.Command{
Name: "migrate",
Usage: "Migrate the database",
Description: "This is a command for migrating the database, so that you can run gitea admin create-user before starting the server.",
@ -70,7 +70,7 @@ func runMigrate(ctx *cli.Context) error {
log.Info("AppPath: %s", setting.AppPath)
log.Info("AppWorkPath: %s", setting.AppWorkPath)
log.Info("Custom path: %s", setting.CustomPath)
log.Info("Log path: %s", setting.LogRootPath)
log.Info("Log path: %s", setting.Log.RootPath)
log.Info("Configuration file: %s", setting.CustomConf)
// if err := db.InitEngineWithMigration(context.Background(), migrations.Migrate); err != nil {

View File

@ -10,50 +10,63 @@ import (
"net"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
_ "net/http/pprof" // Used for debugging if enabled and a web server is running
gitea_cmd "code.gitea.io/gitea/cmd"
"code.gitea.io/gitea/modules/container"
"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/process"
"code.gitea.io/gitea/modules/public"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/routers"
"code.gitea.io/gitea/routers/install"
hat_routers "code.gitlink.org.cn/Gitlink/gitea_hat.git/routers"
"github.com/felixge/fgprof"
"github.com/urfave/cli"
ini "gopkg.in/ini.v1"
"github.com/nacos-group/nacos-sdk-go/v2/clients"
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
"github.com/nacos-group/nacos-sdk-go/v2/vo"
"github.com/urfave/cli/v2"
)
var PIDFile = "/run/gitea.pid"
// CmdWeb represents the available web sub-command.
var CmdWeb = cli.Command{
var CmdWeb = &cli.Command{
Name: "web",
Usage: "Start Gitea web server",
Description: `Gitea web server is the only thing you need to run,
and it takes care of all the other things for you`,
Before: gitea_cmd.PrepareConsoleLoggerLevel(log.INFO),
Action: runWeb,
Flags: []cli.Flag{
cli.StringFlag{
Name: "port, p",
Value: "3000",
Usage: "Temporary port number to prevent conflict",
&cli.StringFlag{
Name: "port",
Aliases: []string{"p"},
Value: "3000",
Usage: "Temporary port number to prevent conflict",
},
cli.StringFlag{
&cli.StringFlag{
Name: "install-port",
Value: "3000",
Usage: "Temporary port number to run the install page on to prevent conflict",
},
cli.StringFlag{
Name: "pid, P",
Value: setting.PIDFile,
Usage: "Custom pid file path",
&cli.StringFlag{
Name: "pid",
Aliases: []string{"P"},
Value: PIDFile,
Usage: "Custom pid file path",
},
cli.BoolFlag{
Name: "quiet, q",
Usage: "Only display Fatal logging errors until logging is set-up",
&cli.BoolFlag{
Name: "quiet",
Aliases: []string{"q"},
Usage: "Only display Fatal logging errors until logging is set-up",
},
cli.BoolFlag{
&cli.BoolFlag{
Name: "verbose",
Usage: "Set initial logging to TRACE level until logging is properly set-up",
},
@ -76,26 +89,204 @@ func runHTTPRedirector() {
http.Redirect(w, r, target, http.StatusTemporaryRedirect)
})
err := runHTTP("tcp", source, "HTTP Redirector", handler)
err := runHTTP("tcp", source, "HTTP Redirector", handler, setting.RedirectorUseProxyProtocol)
if err != nil {
log.Fatal("Failed to start port redirection: %v", err)
}
}
func runWeb(ctx *cli.Context) error {
if ctx.Bool("verbose") {
_ = log.DelLogger("console")
log.NewLogger(0, "console", "console", fmt.Sprintf(`{"level": "trace", "colorize": %t, "stacktraceLevel": "none"}`, log.CanColorStdout))
} else if ctx.Bool("quiet") {
_ = log.DelLogger("console")
log.NewLogger(0, "console", "console", fmt.Sprintf(`{"level": "fatal", "colorize": %t, "stacktraceLevel": "none"}`, log.CanColorStdout))
func createPIDFile(pidPath string) {
currentPid := os.Getpid()
if err := os.MkdirAll(filepath.Dir(pidPath), os.ModePerm); err != nil {
log.Fatal("Failed to create PID folder: %v", err)
}
file, err := os.Create(pidPath)
if err != nil {
log.Fatal("Failed to create PID file: %v", err)
}
defer file.Close()
if _, err := file.WriteString(strconv.FormatInt(int64(currentPid), 10)); err != nil {
log.Fatal("Failed to write PID information: %v", err)
}
}
func showWebStartupMessage(msg string) {
log.Info("Gitea version: %s%s", setting.AppVer, setting.AppBuiltWith)
log.Info("* RunMode: %s", setting.RunMode)
log.Info("* AppPath: %s", setting.AppPath)
log.Info("* WorkPath: %s", setting.AppWorkPath)
log.Info("* CustomPath: %s", setting.CustomPath)
log.Info("* ConfigFile: %s", setting.CustomConf)
log.Info("%s", msg)
}
func serveInstall(ctx *cli.Context) error {
showWebStartupMessage("Prepare to run install page")
routers.InitWebInstallPage(graceful.GetManager().HammerContext())
// Flag for port number in case first time run conflict
if ctx.IsSet("port") {
if err := setPort(ctx.String("port")); err != nil {
return err
}
}
if ctx.IsSet("install-port") {
if err := setPort(ctx.String("install-port")); err != nil {
return err
}
}
c := install.Routes()
err := listen(c, false)
if err != nil {
log.Critical("Unable to open listener for installer. Is Gitea already running?")
graceful.GetManager().DoGracefulShutdown()
}
select {
case <-graceful.GetManager().IsShutdown():
<-graceful.GetManager().Done()
log.Info("PID: %d Gitea Web Finished", os.Getpid())
log.GetManager().Close()
return err
default:
}
return nil
}
func serveInstalled(ctx *cli.Context) error {
setting.InitCfgProvider(setting.CustomConf)
setting.LoadCommonSettings()
setting.MustInstalled()
showWebStartupMessage("Prepare to run web server")
if setting.AppWorkPathMismatch {
log.Error("WORK_PATH from config %q doesn't match other paths from environment variables or command arguments. "+
"Only WORK_PATH in config should be set and used. Please make sure the path in config file is correct, "+
"remove the other outdated work paths from environment variables and command arguments", setting.CustomConf)
}
rootCfg := setting.CfgProvider
if rootCfg.Section("").Key("WORK_PATH").String() == "" {
saveCfg, err := rootCfg.PrepareSaving()
if err != nil {
log.Error("Unable to prepare saving WORK_PATH=%s to config %q: %v\nYou should set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err)
} else {
rootCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath)
saveCfg.Section("").Key("WORK_PATH").SetValue(setting.AppWorkPath)
if err = saveCfg.Save(); err != nil {
log.Error("Unable to update WORK_PATH=%s to config %q: %v\nYou should set it manually, otherwise there might be bugs when accessing the git repositories.", setting.AppWorkPath, setting.CustomConf, err)
}
}
}
// in old versions, user's custom web files are placed in "custom/public", and they were served as "http://domain.com/assets/xxx"
// now, Gitea only serves pre-defined files in the "custom/public" folder basing on the web root, the user should move their custom files to "custom/public/assets"
publicFiles, _ := public.AssetFS().ListFiles(".")
publicFilesSet := container.SetOf(publicFiles...)
publicFilesSet.Remove(".well-known")
publicFilesSet.Remove("assets")
publicFilesSet.Remove("robots.txt")
for _, fn := range publicFilesSet.Values() {
log.Error("Found legacy public asset %q in CustomPath. Please move it to %s/public/assets/%s", fn, setting.CustomPath, fn)
}
if _, err := os.Stat(filepath.Join(setting.CustomPath, "robots.txt")); err == nil {
log.Error(`Found legacy public asset "robots.txt" in CustomPath. Please move it to %s/public/robots.txt`, setting.CustomPath)
}
routers.InitWebInstalled(graceful.GetManager().HammerContext())
hat_routers.GlobalInitInstalled(graceful.GetManager().HammerContext())
// We check that AppDataPath exists here (it should have been created during installation)
// We can't check it in `InitWebInstalled`, because some integration tests
// use cmd -> InitWebInstalled, but the AppDataPath doesn't exist during those tests.
if _, err := os.Stat(setting.AppDataPath); err != nil {
log.Fatal("Can not find APP_DATA_PATH %q", setting.AppDataPath)
}
// Override the provided port number within the configuration
if ctx.IsSet("port") {
if err := setPort(ctx.String("port")); err != nil {
return err
}
}
// Set up Chi routes
webRoutes := hat_routers.NormalRoutes()
err := listen(webRoutes, true)
<-graceful.GetManager().Done()
log.Info("PID: %d Gitea Web Finished", os.Getpid())
log.GetManager().Close()
return err
}
func servePprof() {
http.DefaultServeMux.Handle("/debug/fgprof", fgprof.Handler())
_, _, finished := process.GetManager().AddTypedContext(context.Background(), "Web: PProf Server", process.SystemProcessType, true)
// The pprof server is for debug purpose only, it shouldn't be exposed on public network. At the moment it's not worth to introduce a configurable option for it.
log.Info("Starting pprof server on localhost:6060")
log.Info("Stopped pprof server: %v", http.ListenAndServe("localhost:6060", nil))
finished()
}
func runWeb(ctx *cli.Context) error {
defer func() {
if panicked := recover(); panicked != nil {
log.Fatal("PANIC: %v\n%s", panicked, log.Stack(2))
}
}()
rootCfg := setting.CfgProvider
nacosServer := rootCfg.Section("nacos").Key("SERVER").String()
nacosPort := rootCfg.Section("nacos").Key("PORT").MustInt64()
nacosWeight := rootCfg.Section("nacos").Key("WEIGHT").MustInt64()
if nacosWeight == 0 {
nacosWeight = 10
}
if nacosServer != "" && nacosPort != 0 {
//create ServerConfig
sc := []constant.ServerConfig{
*constant.NewServerConfig(nacosServer, uint64(nacosPort), constant.WithContextPath("/nacos")),
}
//create ClientConfig
cc := *constant.NewClientConfig(
constant.WithNamespaceId(""),
constant.WithTimeoutMs(5000),
constant.WithNotLoadCacheAtStart(true),
constant.WithLogDir("/tmp/nacos/log"),
constant.WithCacheDir("/tmp/nacos/cache"),
constant.WithLogLevel("debug"),
)
// create naming client
client, err := clients.NewNamingClient(
vo.NacosClientParam{
ClientConfig: &cc,
ServerConfigs: sc,
},
)
if err != nil {
panic(err)
}
//Register
_, err = client.RegisterInstance(vo.RegisterInstanceParam{
Ip: nacosServer,
Port: uint64(nacosPort),
ServiceName: "gitea_hat",
Weight: float64(nacosWeight),
Enable: true,
Healthy: true,
Ephemeral: true,
})
log.Info("Nacos: Register Gitea Web Finished")
}
managerCtx, cancel := context.WithCancel(context.Background())
graceful.InitManager(managerCtx)
defer cancel()
@ -108,79 +299,22 @@ func runWeb(ctx *cli.Context) error {
// Set pid file setting
if ctx.IsSet("pid") {
setting.PIDFile = ctx.String("pid")
setting.WritePIDFile = true
createPIDFile(ctx.String("pid"))
}
// Perform pre-initialization
needsInstall := install.PreloadSettings(graceful.GetManager().HammerContext())
if needsInstall {
// Flag for port number in case first time run conflict
if ctx.IsSet("port") {
if err := setPort(ctx.String("port")); err != nil {
return err
}
}
if ctx.IsSet("install-port") {
if err := setPort(ctx.String("install-port")); err != nil {
return err
}
}
c := install.Routes()
err := listen(c, false)
if err != nil {
log.Critical("Unable to open listener for installer. Is Gitea already running?")
graceful.GetManager().DoGracefulShutdown()
}
select {
case <-graceful.GetManager().IsShutdown():
<-graceful.GetManager().Done()
log.Info("PID: %d Gitea Web Finished", os.Getpid())
log.Close()
if !setting.InstallLock {
if err := serveInstall(ctx); err != nil {
return err
default:
}
} else {
NoInstallListener()
}
if setting.EnablePprof {
go func() {
http.DefaultServeMux.Handle("/debug/fgprof", fgprof.Handler())
_, _, finished := process.GetManager().AddTypedContext(context.Background(), "Web: PProf Server", process.SystemProcessType, true)
log.Info("Starting pprof server on localhost:6060")
log.Info("%v", http.ListenAndServe("localhost:6060", nil))
finished()
}()
go servePprof()
}
log.Info("Global init")
// Perform global initialization
setting.LoadFromExisting()
routers.GlobalInitInstalled(graceful.GetManager().HammerContext())
hat_routers.GlobalInitInstalled(graceful.GetManager().HammerContext())
// We check that AppDataPath exists here (it should have been created during installation)
// We can't check it in `GlobalInitInstalled`, because some integration tests
// use cmd -> GlobalInitInstalled, but the AppDataPath doesn't exist during those tests.
if _, err := os.Stat(setting.AppDataPath); err != nil {
log.Fatal("Can not find APP_DATA_PATH '%s'", setting.AppDataPath)
}
// Override the provided port number within the configuration
if ctx.IsSet("port") {
if err := setPort(ctx.String("port")); err != nil {
return err
}
}
// Set up Chi routes
c := routers.NormalRoutes()
hat_routers.InitHatRouters(c)
err := listen(c, true)
<-graceful.GetManager().Done()
log.Info("PID: %d Gitea Web Finished", os.Getpid())
log.Close()
return err
return serveInstalled(ctx)
}
func setPort(port string) error {
@ -201,10 +335,18 @@ func setPort(port string) error {
defaultLocalURL += ":" + setting.HTTPPort + "/"
// Save LOCAL_ROOT_URL if port changed
setting.CreateOrAppendToCustomConf(func(cfg *ini.File) {
cfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
})
rootCfg := setting.CfgProvider
saveCfg, err := rootCfg.PrepareSaving()
if err != nil {
return fmt.Errorf("failed to save config file: %v", err)
}
rootCfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
saveCfg.Section("server").Key("LOCAL_ROOT_URL").SetValue(defaultLocalURL)
if err = saveCfg.Save(); err != nil {
return fmt.Errorf("failed to save config file: %v", err)
}
}
return nil
}
@ -231,7 +373,7 @@ func listen(m http.Handler, handleRedirector bool) error {
if handleRedirector {
NoHTTPRedirector()
}
err = runHTTP("tcp", listenAddr, "Web", m)
err = runHTTP("tcp", listenAddr, "Web", m, setting.UseProxyProtocol)
case setting.HTTPS:
if setting.EnableAcme {
err = runACME(listenAddr, m)
@ -244,23 +386,23 @@ func listen(m http.Handler, handleRedirector bool) error {
NoHTTPRedirector()
}
}
err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, m)
err = runHTTPS("tcp", listenAddr, "Web", setting.CertFile, setting.KeyFile, m, setting.UseProxyProtocol, setting.ProxyProtocolTLSBridging)
}
case setting.FCGI:
if handleRedirector {
NoHTTPRedirector()
}
err = runFCGI("tcp", listenAddr, "FCGI Web", m)
err = runFCGI("tcp", listenAddr, "FCGI Web", m, setting.UseProxyProtocol)
case setting.HTTPUnix:
if handleRedirector {
NoHTTPRedirector()
}
err = runHTTP("unix", listenAddr, "Web", m)
err = runHTTP("unix", listenAddr, "Web", m, setting.UseProxyProtocol)
case setting.FCGIUnix:
if handleRedirector {
NoHTTPRedirector()
}
err = runFCGI("unix", listenAddr, "Web", m)
err = runFCGI("unix", listenAddr, "Web", m, setting.UseProxyProtocol)
default:
log.Fatal("Invalid protocol: %s", setting.Protocol)
}

View File

@ -113,14 +113,14 @@ func runACME(listenAddr string, m http.Handler) error {
log.Info("Running Let's Encrypt handler on %s", setting.HTTPAddr+":"+setting.PortToRedirect)
// all traffic coming into HTTP will be redirect to HTTPS automatically (LE HTTP-01 validation happens here)
err := runHTTP("tcp", setting.HTTPAddr+":"+setting.PortToRedirect, "Let's Encrypt HTTP Challenge", myACME.HTTPChallengeHandler(http.HandlerFunc(runLetsEncryptFallbackHandler)))
err := runHTTP("tcp", setting.HTTPAddr+":"+setting.PortToRedirect, "Let's Encrypt HTTP Challenge", myACME.HTTPChallengeHandler(http.HandlerFunc(runLetsEncryptFallbackHandler)), setting.RedirectorUseProxyProtocol)
if err != nil {
log.Fatal("Failed to start the Let's Encrypt handler on port %s: %v", setting.PortToRedirect, err)
}
}()
}
return runHTTPSWithTLSConfig("tcp", listenAddr, "Web", tlsConfig, m)
return runHTTPSWithTLSConfig("tcp", listenAddr, "Web", tlsConfig, m, setting.UseProxyProtocol, setting.ProxyProtocolTLSBridging)
}
func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {

View File

@ -15,8 +15,8 @@ import (
"code.gitea.io/gitea/modules/setting"
)
func runHTTP(network, listenAddr, name string, m http.Handler) error {
return graceful.HTTPListenAndServe(network, listenAddr, name, m)
func runHTTP(network, listenAddr, name string, m http.Handler, useProxyProtocal bool) error {
return graceful.HTTPListenAndServe(network, listenAddr, name, m, useProxyProtocal)
}
// NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
@ -36,7 +36,7 @@ func NoInstallListener() {
graceful.GetManager().InformCleanup()
}
func runFCGI(network, listenAddr, name string, m http.Handler) error {
func runFCGI(network, listenAddr, name string, m http.Handler, useProxyProtocol bool) error {
// This needs to handle stdin as fcgi point
fcgiServer := graceful.NewServer(network, listenAddr, name)
@ -47,7 +47,7 @@ func runFCGI(network, listenAddr, name string, m http.Handler) error {
}
m.ServeHTTP(resp, req)
}))
})
}, useProxyProtocol)
if err != nil {
log.Fatal("Failed to start FCGI main server: %v", err)
}

View File

@ -136,7 +136,7 @@ var (
// be provided. If the certificate is signed by a certificate authority, the
// certFile should be the concatenation of the server's certificate followed by the
// CA's certificate.
func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handler) error {
func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handler, useProxyProtocol, proxyProtocolTLSBridging bool) error {
tlsConfig := &tls.Config{}
if tlsConfig.NextProtos == nil {
tlsConfig.NextProtos = []string{"h2", "http/1.1"}
@ -184,9 +184,9 @@ func runHTTPS(network, listenAddr, name, certFile, keyFile string, m http.Handle
return err
}
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m)
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m, useProxyProtocol, proxyProtocolTLSBridging)
}
func runHTTPSWithTLSConfig(network, listenAddr, name string, tlsConfig *tls.Config, m http.Handler) error {
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m)
func runHTTPSWithTLSConfig(network, listenAddr, name string, tlsConfig *tls.Config, m http.Handler, useProxyProtocol, proxyProtocolTLSBridging bool) error {
return graceful.HTTPListenAndServeTLSConfig(network, listenAddr, name, tlsConfig, m, useProxyProtocol, proxyProtocolTLSBridging)
}

38
docker-compose.yml Normal file
View File

@ -0,0 +1,38 @@
version: '3'
services:
app:
container_name: gitea_hat
restart: always
build:
context: .
dockerfile: Dockerfile
external_links:
- mysql
volumes:
- /root/gitea:/data
- /etc/timezone:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
networks:
- default
- app_net
ports:
- 10082:3000
depends_on:
- runner
runner:
container_name: my_runner
image: gitea/act_runner:nightly
restart: always
networks:
- default
- app_net
volumes:
- /var/run/docker.sock:/var/run/docker.sock:rw
environment:
GITEA_INSTANCE_URL: 'http://xxxxxx:10082' # 输入服务地址
GITEA_RUNNER_REGISTRATION_TOKEN: 'xxx' # 需要gitea中runner token
networks:
app_net:
external: true

353
go.mod
View File

@ -1,210 +1,289 @@
module code.gitlink.org.cn/Gitlink/gitea_hat.git
go 1.18
go 1.21
toolchain go1.21.4
require (
code.gitea.io/gitea v1.17.3
gitea.com/go-chi/binding v0.0.0-20221013104517-b29891619681
github.com/caddyserver/certmagic v0.17.2
code.gitea.io/gitea v1.21.0
gitea.com/go-chi/binding v0.0.0-20230415142243-04b515c6d669
gitea.com/go-chi/captcha v0.0.0-20230415143339-2c0754df4384
github.com/NYTimes/gziphandler v1.1.1
github.com/caddyserver/certmagic v0.19.2
github.com/felixge/fgprof v0.9.3
github.com/go-chi/chi/v5 v5.0.10
github.com/go-chi/cors v1.2.1
github.com/klauspost/cpuid/v2 v2.1.2
github.com/urfave/cli v1.22.10
gopkg.in/ini.v1 v1.67.0
github.com/gobwas/glob v0.2.3
github.com/json-iterator/go v1.1.12
github.com/klauspost/cpuid/v2 v2.2.6
github.com/nacos-group/nacos-sdk-go/v2 v2.2.7
github.com/nektos/act v0.2.52
github.com/prometheus/client_golang v1.17.0
github.com/shurcooL/vfsgen v0.0.0-20230704071429-0000e147ea92
github.com/urfave/cli/v2 v2.25.7
golang.org/x/net v0.23.0
golang.org/x/text v0.14.0
xorm.io/builder v0.3.13
xorm.io/xorm v1.3.4
)
require (
cloud.google.com/go/compute v1.10.0 // indirect
code.gitea.io/sdk/gitea v0.15.1 // indirect
code.gitea.io/actions-proto-go v0.3.1 // indirect
github.com/bufbuild/connect-go v1.10.0 // indirect
github.com/cention-sany/utf7 v0.0.0-20170124080048-26cad61bd60a // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/dimiro1/reply v0.0.0-20200315094148-d0136a4c9e21 // indirect
github.com/emersion/go-imap v1.2.1 // indirect
github.com/emersion/go-sasl v0.0.0-20231106173351-e73c9f7bad43 // indirect
github.com/go-testfixtures/testfixtures/v3 v3.9.0 // indirect
github.com/go-webauthn/webauthn v0.9.1 // indirect
github.com/google/go-tpm v0.9.0 // indirect
github.com/jhillyerd/enmime v1.0.1 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/rhysd/actionlint v1.6.26 // indirect
github.com/stretchr/testify v1.8.4 // indirect
golang.org/x/sync v0.5.0 // indirect
google.golang.org/grpc v1.59.0 // indirect
)
require (
cloud.google.com/go/compute v1.23.3 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
code.gitea.io/sdk/gitea v0.16.0 // indirect
codeberg.org/gusted/mcaptcha v0.0.0-20220723083913-4f3072e1d570 // indirect
dario.cat/mergo v1.0.0 // indirect
git.sr.ht/~mariusor/go-xsd-duration v0.0.0-20220703122237-02e73435a078 // indirect
gitea.com/go-chi/cache v0.2.0 // indirect
gitea.com/go-chi/captcha v0.0.0-20211013065431-70641c1a35d5 // indirect
gitea.com/go-chi/session v0.0.0-20211218221615-e3605d8b28b8 // indirect
gitea.com/lunny/levelqueue v0.4.2-0.20220729054728-f020868cc2f7 // indirect
gitea.com/go-chi/session v0.0.0-20230613035928-39541325faa3 // indirect
gitea.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 // indirect
gitea.com/lunny/levelqueue v0.4.2-0.20230414023320-3c0159fe0fe4 // indirect
github.com/42wim/sshsig v0.0.0-20211121163825-841cf5bbc121 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20220621081337-cb9428e4ac1e // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20220930113650-c6815a8c17ad // indirect
github.com/RoaringBitmap/roaring v1.2.1 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/alecthomas/chroma v0.10.0 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/Azure/go-ntlmssp v0.0.0-20221128193559-754e69321358 // indirect
github.com/ClickHouse/ch-go v0.58.2 // indirect
github.com/ClickHouse/clickhouse-go/v2 v2.15.0 // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
github.com/RoaringBitmap/roaring v1.6.0 // indirect
github.com/acomagu/bufpipe v1.0.4 // indirect
github.com/alecthomas/chroma/v2 v2.11.1 // indirect
github.com/alibabacloud-go/debug v0.0.0-20190504072949-9472017b5c68 // indirect
github.com/alibabacloud-go/tea v1.1.17 // indirect
github.com/alibabacloud-go/tea-utils v1.4.4 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1800 // indirect
github.com/aliyun/alibabacloud-dkms-gcs-go-sdk v0.2.2 // indirect
github.com/aliyun/alibabacloud-dkms-transfer-go-sdk v0.1.7 // indirect
github.com/andybalholm/brotli v1.0.6 // indirect
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
github.com/aymerick/douceur v0.2.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.3.3 // indirect
github.com/blevesearch/bleve/v2 v2.3.5 // indirect
github.com/blevesearch/bleve_index_api v1.0.4 // indirect
github.com/blevesearch/geo v0.1.15 // indirect
github.com/bits-and-blooms/bitset v1.11.0 // indirect
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb // indirect
github.com/blevesearch/bleve/v2 v2.3.10 // indirect
github.com/blevesearch/bleve_index_api v1.1.3 // indirect
github.com/blevesearch/geo v0.1.18 // indirect
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
github.com/blevesearch/gtreap v0.1.1 // indirect
github.com/blevesearch/mmap-go v1.0.4 // indirect
github.com/blevesearch/scorch_segment_api/v2 v2.1.3 // indirect
github.com/blevesearch/segment v0.9.0 // indirect
github.com/blevesearch/scorch_segment_api/v2 v2.2.3 // indirect
github.com/blevesearch/segment v0.9.1 // indirect
github.com/blevesearch/snowballstem v0.9.0 // indirect
github.com/blevesearch/upsidedown_store_api v1.0.1 // indirect
github.com/blevesearch/vellum v1.0.9 // indirect
github.com/blevesearch/zapx/v11 v11.3.6 // indirect
github.com/blevesearch/zapx/v12 v12.3.6 // indirect
github.com/blevesearch/zapx/v13 v13.3.6 // indirect
github.com/blevesearch/zapx/v14 v14.3.6 // indirect
github.com/blevesearch/zapx/v15 v15.3.6 // indirect
github.com/blevesearch/upsidedown_store_api v1.0.2 // indirect
github.com/blevesearch/vellum v1.0.10 // indirect
github.com/blevesearch/zapx/v11 v11.3.10 // indirect
github.com/blevesearch/zapx/v12 v12.3.10 // indirect
github.com/blevesearch/zapx/v13 v13.3.10 // indirect
github.com/blevesearch/zapx/v14 v14.3.10 // indirect
github.com/blevesearch/zapx/v15 v15.3.13 // indirect
github.com/boombuler/barcode v1.0.1 // indirect
github.com/bradfitz/gomemcache v0.0.0-20220106215444-fb4bf637b56d // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/bradfitz/gomemcache v0.0.0-20230905024940-24af94b03874 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/buildkite/terminal-to-html/v3 v3.9.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chi-middleware/proxy v1.1.1 // indirect
github.com/cloudflare/cfssl v1.6.3 // indirect
github.com/cloudflare/circl v1.2.0 // indirect
github.com/cloudflare/circl v1.3.6 // indirect
github.com/couchbase/go-couchbase v0.1.1 // indirect
github.com/couchbase/gomemcached v0.1.4 // indirect
github.com/couchbase/gomemcached v0.2.1 // indirect
github.com/couchbase/goutils v0.1.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
github.com/davidmz/go-pageant v1.0.2 // indirect
github.com/denisenkom/go-mssqldb v0.12.3 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/djherbis/buffer v1.2.0 // indirect
github.com/djherbis/nio/v3 v3.0.1 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect
github.com/duo-labs/webauthn v0.0.0-20220815211337-00c9fb5711f5 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/editorconfig/editorconfig-core-go/v2 v2.5.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/editorconfig/editorconfig-core-go/v2 v2.6.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/ethantkoenig/rupture v1.0.1 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fxamacker/cbor/v2 v2.4.0 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.5.0 // indirect
github.com/gliderlabs/ssh v0.3.5 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.4 // indirect
github.com/go-chi/chi/v5 v5.0.7 // indirect
github.com/go-enry/go-enry/v2 v2.8.3 // indirect
github.com/go-ap/activitypub v0.0.0-20231114162308-e219254dc5c9 // indirect
github.com/go-ap/errors v0.0.0-20231003111023-183eef4b31b7 // indirect
github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.5 // indirect
github.com/go-co-op/gocron v1.36.0 // indirect
github.com/go-enry/go-enry/v2 v2.8.6 // indirect
github.com/go-enry/go-oniguruma v1.2.1 // indirect
github.com/go-fed/httpsig v1.1.0 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/go-git/go-git/v5 v5.4.3-0.20210630082519-b4368b2a2ca4 // indirect
github.com/go-ldap/ldap/v3 v3.4.4 // indirect
github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/goccy/go-json v0.9.11 // indirect
github.com/go-faster/city v1.0.1 // indirect
github.com/go-faster/errors v0.7.0 // indirect
github.com/go-fed/httpsig v1.1.1-0.20201223112313-55836744818e // indirect
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
github.com/go-git/go-billy/v5 v5.5.0 // indirect
github.com/go-git/go-git/v5 v5.10.0 // indirect
github.com/go-ldap/ldap/v3 v3.4.6 // indirect
github.com/go-sql-driver/mysql v1.7.1 // indirect
github.com/go-webauthn/x v0.1.4 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/gogs/chardet v0.0.0-20211120154057-b7413eaefb8f // indirect
github.com/gogs/cron v0.0.0-20171120032916-9f6c956d3e14 // indirect
github.com/gogs/go-gogs-client v0.0.0-20210131175652-1d7215cd8d85 // indirect
github.com/golang-jwt/jwt/v4 v4.4.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang-jwt/jwt/v5 v5.1.0 // indirect
github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9 // indirect
github.com/golang-sql/sqlexp v0.1.0 // indirect
github.com/golang/geo v0.0.0-20210211234256-740aa86cb551 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/geo v0.0.0-20230421003525-6adc56603217 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/certificate-transparency-go v1.1.4 // indirect
github.com/google/go-github/v45 v45.2.0 // indirect
github.com/google/go-github/v53 v53.2.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/pprof v0.0.0-20221010195024-131d412537ea // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/css v1.0.0 // indirect
github.com/gorilla/feeds v1.1.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/gorilla/feeds v1.1.2 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/sessions v1.2.2 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-hclog v1.2.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
github.com/hashicorp/go-hclog v1.5.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/jaytaylor/html2text v0.0.0-20211105163654-bc68cce691ba // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/huandu/xstrings v1.4.0 // indirect
github.com/jaytaylor/html2text v0.0.0-20230321000545-74c2419ad056 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/keybase/go-crypto v0.0.0-20200123153347-de78d2cb44f4 // indirect
github.com/klauspost/compress v1.15.11 // indirect
github.com/klauspost/pgzip v1.2.5 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/lib/pq v1.10.7 // indirect
github.com/klauspost/compress v1.17.3 // indirect
github.com/klauspost/pgzip v1.2.6 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/libdns/libdns v0.2.1 // indirect
github.com/lunny/dingtalk_webhook v0.0.0-20171025031554-e3534c89ef96 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/markbates/going v1.0.3 // indirect
github.com/markbates/goth v1.74.1 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mattn/go-sqlite3 v1.14.15 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2 // indirect
github.com/mholt/acmez v1.0.4 // indirect
github.com/markbates/goth v1.78.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mattn/go-sqlite3 v1.14.18 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/meilisearch/meilisearch-go v0.26.0 // indirect
github.com/mholt/acmez v1.2.0 // indirect
github.com/mholt/archiver/v3 v3.5.1 // indirect
github.com/microcosm-cc/bluemonday v1.0.21 // indirect
github.com/miekg/dns v1.1.50 // indirect
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
github.com/miekg/dns v1.1.57 // indirect
github.com/minio/md5-simd v1.1.2 // indirect
github.com/minio/minio-go/v7 v7.0.42 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/minio/minio-go/v7 v7.0.64 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mrjones/oauth v0.0.0-20190623134757-126b35219450 // indirect
github.com/mschoch/smat v0.2.0 // indirect
github.com/msteinert/pam v1.1.0 // indirect
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/msteinert/pam v1.2.0 // indirect
github.com/niklasfasching/go-org v1.7.0 // indirect
github.com/nwaples/rardecode v1.1.3 // indirect
github.com/nxadm/tail v1.4.8 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/oliamb/cutter v0.2.2 // indirect
github.com/olivere/elastic/v7 v7.0.32 // indirect
github.com/pierrec/lz4/v4 v4.1.17 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/image-spec v1.1.0-rc5 // indirect
github.com/paulmach/orb v0.10.0 // indirect
github.com/pierrec/lz4/v4 v4.1.18 // indirect
github.com/pjbgf/sha1cd v0.3.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pquerna/otp v1.3.0 // indirect
github.com/prometheus/client_golang v1.13.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // indirect
github.com/pquerna/otp v1.4.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/quasoft/websspi v1.1.2 // indirect
github.com/rivo/uniseg v0.4.2 // indirect
github.com/rs/xid v1.4.0 // indirect
github.com/redis/go-redis/v9 v9.3.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.0.1 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/sirupsen/logrus v1.9.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/sassoftware/go-rpmutils v0.2.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/shurcooL/httpfs v0.0.0-20230704072500-f1e31cf0ba5c // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
github.com/skeema/knownhosts v1.2.1 // indirect
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tstranex/u2f v1.0.0 // indirect
github.com/ulikunitz/xz v0.5.10 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/unknwon/com v1.0.1 // indirect
github.com/unrolled/render v1.5.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/fastjson v1.6.4 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xanzy/go-gitlab v0.73.1 // indirect
github.com/xanzy/ssh-agent v0.3.2 // indirect
github.com/xanzy/go-gitlab v0.94.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/yohcop/openid-go v1.0.0 // indirect
github.com/yuin/goldmark v1.5.2 // indirect
github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yohcop/openid-go v1.0.1 // indirect
github.com/yuin/goldmark v1.6.0 // indirect
github.com/yuin/goldmark-highlighting/v2 v2.0.0-20230729083705-37449abec8cc // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
go.etcd.io/bbolt v1.3.6 // indirect
go.jolheiser.com/hcaptcha v0.0.4 // indirect
go.jolheiser.com/pwn v0.0.3 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/mod v0.6.0 // indirect
golang.org/x/net v0.1.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sys v0.1.0 // indirect
golang.org/x/text v0.4.0 // indirect
golang.org/x/time v0.1.0 // indirect
golang.org/x/tools v0.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.28.1 // indirect
github.com/zeebo/blake3 v0.2.3 // indirect
go.etcd.io/bbolt v1.3.8 // indirect
go.opentelemetry.io/otel v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.21.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/image v0.14.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/oauth2 v0.14.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/time v0.4.0 // indirect
golang.org/x/tools v0.15.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
mvdan.cc/xurls/v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
mvdan.cc/xurls/v2 v2.5.0 // indirect
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 // indirect
xorm.io/builder v0.3.12 // indirect
xorm.io/xorm v1.3.2 // indirect
)
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1
replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142115-2c99e1ffdfa0
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
replace github.com/nektos/act => gitea.com/gitea/act v0.243.4
exclude github.com/gofrs/uuid v3.2.0+incompatible
exclude github.com/gofrs/uuid v4.0.0+incompatible
exclude github.com/goccy/go-json v0.4.11
exclude github.com/satori/go.uuid v1.2.0

1645
go.sum

File diff suppressed because it is too large Load Diff

162
main.go
View File

@ -1,27 +1,30 @@
package main
import (
"fmt"
"log"
"os"
"runtime"
"strings"
"time"
"code.gitea.io/gitea/cmd"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
hat_cmd "code.gitlink.org.cn/Gitlink/gitea_hat.git/cmd"
"github.com/urfave/cli"
// register supported doc types
_ "code.gitea.io/gitea/modules/markup/asciicast"
_ "code.gitea.io/gitea/modules/markup/console"
_ "code.gitea.io/gitea/modules/markup/csv"
_ "code.gitea.io/gitea/modules/markup/markdown"
_ "code.gitea.io/gitea/modules/markup/orgmode"
"github.com/urfave/cli/v2"
)
var (
Version = "development"
Tags = ""
MakeVersion = ""
originalAppHelpTemplate = ""
originalCommandHelpTemplate = ""
originalSubcommandHelpTemplate = ""
Version = "v2.7, by v1.21.0 "
Tags = ""
MakeVersion = ""
)
func init() {
@ -29,143 +32,16 @@ func init() {
setting.AppBuiltWith = formatBuiltWith()
setting.AppStartTime = time.Now().UTC()
// Grab the original help templates
originalAppHelpTemplate = cli.AppHelpTemplate
originalCommandHelpTemplate = cli.CommandHelpTemplate
originalSubcommandHelpTemplate = cli.SubcommandHelpTemplate
}
func main() {
app := cli.NewApp()
app.Name = "GitLink Gitea"
app.Usage = "A painless self-hosted Git service"
app.Description = `By default, gitea will start serving using the webserver with no
arguments - which can alternatively be run by running the subcommand web.`
app.Version = Version + formatBuiltWith()
app.Commands = []cli.Command{
hat_cmd.CmdWeb,
cmd.CmdServ,
cmd.CmdHook,
cmd.CmdDump,
cmd.CmdCert,
cmd.CmdAdmin,
cmd.CmdGenerate,
cmd.CmdMigrate,
cmd.CmdKeys,
cmd.CmdConvert,
cmd.CmdDoctor,
cmd.CmdManager,
cmd.Cmdembedded,
cmd.CmdMigrateStorage,
cmd.CmdDocs,
cmd.CmdDumpRepository,
cmd.CmdRestoreRepository,
cli.OsExiter = func(code int) {
log.GetManager().Close()
os.Exit(code)
}
setting.SetCustomPathAndConf("", "", "")
setAppHelpTemplates()
// default configuration flags
defaultFlags := []cli.Flag{
cli.StringFlag{
Name: "custom-path, C",
Value: setting.CustomPath,
Usage: "Custom path file path",
},
cli.StringFlag{
Name: "config, c",
Value: setting.CustomConf,
Usage: "Custom configuration file path",
},
cli.VersionFlag,
cli.StringFlag{
Name: "work-path, w",
Value: setting.AppWorkPath,
Usage: "Set the gitea working path",
},
}
// Set the default to be equivalent to cmdWeb and add the default flags
app.Flags = append(app.Flags, cmd.CmdWeb.Flags...)
app.Flags = append(app.Flags, defaultFlags...)
app.Action = cmd.CmdWeb.Action
// Add functions to set these paths and these flags to the commands
app.Before = establishCustomPath
for i := range app.Commands {
setFlagsAndBeforeOnSubcommands(&app.Commands[i], defaultFlags, establishCustomPath)
}
err := app.Run(os.Args)
if err != nil {
log.Fatal("Failed to run app with %s: %v", os.Args, err)
}
}
func setFlagsAndBeforeOnSubcommands(command *cli.Command, defaultFlags []cli.Flag, before cli.BeforeFunc) {
command.Flags = append(command.Flags, defaultFlags...)
command.Before = establishCustomPath
for i := range command.Subcommands {
setFlagsAndBeforeOnSubcommands(&command.Subcommands[i], defaultFlags, before)
}
}
func establishCustomPath(ctx *cli.Context) error {
var providedCustom string
var providedConf string
var providedWorkPath string
currentCtx := ctx
for {
if len(providedCustom) != 0 && len(providedConf) != 0 && len(providedWorkPath) != 0 {
break
}
if currentCtx == nil {
break
}
if currentCtx.IsSet("custom-path") && len(providedCustom) == 0 {
providedCustom = currentCtx.String("custom-path")
}
if currentCtx.IsSet("config") && len(providedConf) == 0 {
providedConf = currentCtx.String("config")
}
if currentCtx.IsSet("work-path") && len(providedWorkPath) == 0 {
providedWorkPath = currentCtx.String("work-path")
}
currentCtx = currentCtx.Parent()
}
setting.SetCustomPathAndConf(providedCustom, providedConf, providedWorkPath)
setAppHelpTemplates()
if ctx.IsSet("version") {
cli.ShowVersion(ctx)
os.Exit(0)
}
return nil
}
func setAppHelpTemplates() {
cli.AppHelpTemplate = adjustHelpTemplate(originalAppHelpTemplate)
cli.CommandHelpTemplate = adjustHelpTemplate(originalCommandHelpTemplate)
cli.SubcommandHelpTemplate = adjustHelpTemplate(originalSubcommandHelpTemplate)
}
func adjustHelpTemplate(originalTemplate string) string {
overrided := ""
if _, ok := os.LookupEnv("GITEA_CUSTOM"); ok {
overrided = "(GITEA_CUSTOM)"
}
return fmt.Sprintf(`%s
DEFAULT CONFIGURATION:
CustomPath: %s %s
CustomConf: %s
AppPath: %s
AppWorkPath: %s
`, originalTemplate, setting.CustomPath, overrided, setting.CustomConf, setting.AppPath, setting.AppWorkPath)
app := hat_cmd.NewMainApp(Version, formatBuiltWith())
_ = hat_cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
log.GetManager().Close()
}
func formatBuiltWith() string {

View File

@ -1,27 +0,0 @@
package models
import (
"code.gitea.io/gitea/models/db"
)
type Contributor struct {
ID int64 `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Contributions int64 `json:"contributions"`
}
func GetContributors(repoID, userID int64) (result []Contributor, err error) {
sql :=
`select a.act_user_id as id ,
u.name as login,
u.email as email,
count(act_user_id) as contributions
from action a
left join user u on a.act_user_id=u.id
where repo_id=? and user_id=?
group by repo_id,act_user_id `
err = db.GetEngine(db.DefaultContext).SQL(sql, repoID, userID).Find(&result)
return
}

92
models/actions/run.go Normal file
View File

@ -0,0 +1,92 @@
package actions
import (
"context"
gitea_actions_model "code.gitea.io/gitea/models/actions"
"code.gitea.io/gitea/models/db"
gitea_repo_model "code.gitea.io/gitea/models/repo"
"xorm.io/builder"
)
func InsertRun(ctx context.Context, run *gitea_actions_model.ActionRun, jobs []*gitea_actions_model.ActionRunJob) error {
ctx, commiter, err := db.TxContext(ctx)
if err != nil {
return err
}
defer commiter.Close()
index, err := db.GetNextResourceIndex(ctx, "action_run_index", run.RepoID)
if err != nil {
return err
}
run.Index = index
run.ID = 0
if err := db.Insert(ctx, run); err != nil {
return err
}
if run.Repo == nil {
repo, err := gitea_repo_model.GetRepositoryByID(ctx, run.RepoID)
if err != nil {
return err
}
run.Repo = repo
}
if err := updateRepoRunsNumbers(ctx, run.Repo); err != nil {
return err
}
runJobs := make([]*gitea_actions_model.ActionRunJob, 0, len(jobs))
for _, job := range jobs {
runJobs = append(runJobs, &gitea_actions_model.ActionRunJob{
RunID: run.ID,
RepoID: run.RepoID,
OwnerID: run.OwnerID,
CommitSHA: run.CommitSHA,
IsForkPullRequest: run.IsForkPullRequest,
Name: job.Name,
WorkflowPayload: job.WorkflowPayload,
JobID: job.JobID,
Needs: job.Needs,
RunsOn: job.RunsOn,
Status: gitea_actions_model.StatusWaiting,
})
}
if err := db.Insert(ctx, runJobs); err != nil {
return err
}
if err := gitea_actions_model.IncreaseTaskVersion(ctx, run.OwnerID, run.RepoID); err != nil {
return err
}
return commiter.Commit()
}
func updateRepoRunsNumbers(ctx context.Context, repo *gitea_repo_model.Repository) error {
_, err := db.GetEngine(ctx).ID(repo.ID).
SetExpr("num_action_runs",
builder.Select("count(*)").From("action_run").
Where(builder.Eq{"repo_id": repo.ID}),
).
SetExpr("num_closed_action_runs",
builder.Select("count(*)").From("action_run").
Where(builder.Eq{
"repo_id": repo.ID,
}.And(
builder.In("status",
gitea_actions_model.StatusSuccess,
gitea_actions_model.StatusFailure,
gitea_actions_model.StatusCancelled,
gitea_actions_model.StatusSkipped,
),
),
),
).
Update(repo)
return err
}

115
models/activities/action.go Normal file
View File

@ -0,0 +1,115 @@
package activities
import (
"fmt"
"time"
gitea_activities_models "code.gitea.io/gitea/models/activities"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization"
gitea_repo_model "code.gitea.io/gitea/models/repo"
gitea_user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/structs"
"xorm.io/builder"
)
type Contributor struct {
ID int64 `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Contributions int64 `json:"contributions"`
}
func GetContributors(repoID, userID int64) ([]Contributor, error) {
var result = make([]Contributor, 0)
sql :=
`select a.act_user_id as id ,
u.name as name,
u.email as email,
count(act_user_id) as contributions
from action a
left join user u on a.act_user_id=u.id
where repo_id=? and user_id=?
group by repo_id,act_user_id `
err := db.GetEngine(db.DefaultContext).SQL(sql, repoID, userID).Find(&result)
return result, err
}
func activityQueryCondition(opts gitea_activities_models.GetFeedsOptions) (builder.Cond, error) {
cond := builder.NewCond()
if opts.RequestedTeam != nil && opts.RequestedUser == nil {
org, err := gitea_user_model.GetUserByID(db.DefaultContext, opts.RequestedTeam.OrgID)
if err != nil {
return nil, err
}
opts.RequestedUser = org
}
// check activity visibility for actor ( similar to activityReadable() )
if opts.Actor == nil {
cond = cond.And(builder.In("act_user_id",
builder.Select("`user`.id").Where(
builder.Eq{"keep_activity_private": false, "visibility": structs.VisibleTypePublic},
).From("`user`"),
))
} else if !opts.Actor.IsAdmin {
cond = cond.And(builder.In("act_user_id",
builder.Select("`user`.id").Where(
builder.Eq{"keep_activity_private": false}.
And(builder.In("visibility", structs.VisibleTypePublic, structs.VisibleTypeLimited))).
Or(builder.Eq{"id": opts.Actor.ID}).From("`user`"),
))
}
// check readable repositories by doer/actor
if opts.Actor == nil || !opts.Actor.IsAdmin {
cond = cond.And(builder.In("repo_id", gitea_repo_model.AccessibleRepoIDsQuery(opts.Actor)))
}
if opts.RequestedRepo != nil {
cond = cond.And(builder.Eq{"repo_id": opts.RequestedRepo.ID})
}
if opts.RequestedTeam != nil {
env := organization.OrgFromUser(opts.RequestedUser).AccessibleTeamReposEnv(opts.RequestedTeam)
teamRepoIDs, err := env.RepoIDs(1, opts.RequestedUser.NumRepos)
if err != nil {
return nil, fmt.Errorf("GetTeamRepositories: %w", err)
}
cond = cond.And(builder.In("repo_id", teamRepoIDs))
}
if opts.RequestedUser != nil {
cond = cond.And(builder.Eq{"user_id": opts.RequestedUser.ID})
if opts.OnlyPerformedBy {
cond = cond.And(builder.Eq{"act_user_id": opts.RequestedUser.ID})
}
}
if !opts.IncludePrivate {
cond = cond.And(builder.Eq{"`action`.is_private": false})
}
if !opts.IncludeDeleted {
cond = cond.And(builder.Eq{"is_deleted": false})
}
if opts.Date != "" {
dateLow, err := time.ParseInLocation("2006-01-02", opts.Date, setting.DefaultUILocation)
if err != nil {
log.Warn("Unable to parse %s, filter not applied: %v", opts.Date, err)
} else {
dateHigh := dateLow.Add(86399000000000) // 23h59m59s
cond = cond.And(builder.Gte{"`action`.created_unix": dateLow.Unix()})
cond = cond.And(builder.Lte{"`action`.created_unix": dateHigh.Unix()})
}
}
return cond, nil
}

View File

@ -0,0 +1,55 @@
package activities
import (
gitea_activities_models "code.gitea.io/gitea/models/activities"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/organization"
gitea_user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/timeutil"
)
type UserHeatmapData struct {
Timestamp timeutil.TimeStamp `json:"timestamp"`
Contributions int64 `json:"contributions"`
}
func GetUserHeatmapDataByTimestampRange(user *gitea_user_model.User, team *organization.Team, doer *gitea_user_model.User, startAt, endAt timeutil.TimeStamp) ([]*UserHeatmapData, error) {
hdata := make([]*UserHeatmapData, 0)
if !gitea_activities_models.ActivityReadable(user, doer) {
return hdata, nil
}
groupBy := "created_unix / 900 * 900"
groupByName := "timestamp"
switch {
case setting.Database.Type.IsMySQL():
groupBy = "created_unix DIV 900 * 900"
case setting.Database.Type.IsMSSQL():
groupByName = groupBy
}
cond, err := activityQueryCondition(gitea_activities_models.GetFeedsOptions{
RequestedUser: user,
RequestedTeam: team,
Actor: doer,
IncludePrivate: true,
IncludeDeleted: true,
OnlyPerformedBy: !user.IsOrganization(),
})
if err != nil {
return nil, err
}
return hdata, db.GetEngine(db.DefaultContext).
Select(groupBy+" AS timestamp, count(user_id) as contributions").
Table("action").
Where(cond).
And("created_unix >= ?", startAt).
And("created_unix <= ?", endAt).
GroupBy(groupByName).
OrderBy("timestamp").
Find(&hdata)
}

58
models/issues/pull.go Normal file
View File

@ -0,0 +1,58 @@
package issues
import (
"context"
"time"
"code.gitea.io/gitea/models/db"
gitea_issues_models "code.gitea.io/gitea/models/issues"
"code.gitlink.org.cn/Gitlink/gitea_hat.git/models/pull"
)
type PullRequestHatStatus int
// Enumerate all the pull request hat status
const (
PullRequestHatStatusConflict PullRequestHatStatus = iota
PullRequestHatStatusChecking
PullRequestHatStatusMergeable
)
type PullRequest struct {
gitea_issues_models.PullRequest
LatestPullRequestVersion *pull.PullRequestVersion
}
func GetPullRequestIDsByIssueUpdatedUnix() ([]int64, error) {
prs := make([]int64, 0, 10)
return prs, db.GetEngine(db.DefaultContext).Table("pull_request").
Where("issue.updated_unix>?", time.Now().Add(-time.Minute*2).Unix()).
Join("INNER", "issue", "issue.id=pull_request.issue_id").
Cols("pull_request.id").
Find(&prs)
}
func (p *PullRequest) LoadLatestPullRequestVersion(ctx context.Context) (err error) {
if p.LatestPullRequestVersion != nil {
return nil
}
p.LatestPullRequestVersion, err = GetPullRequestLastVersionByPullRequest(ctx, p)
return err
}
func GetPullRequestLastVersionByPullRequest(ctx context.Context, pr *PullRequest) (*pull.PullRequestVersion, error) {
prv := &pull.PullRequestVersion{
RepoID: pr.PullRequest.BaseRepoID,
PullID: pr.PullRequest.ID,
}
has, err := db.GetEngine(ctx).Desc("created_unix").Get(prv)
if err != nil {
return nil, err
} else if !has {
return nil, gitea_issues_models.ErrPullRequestNotExist{}
}
return prv, nil
}

View File

@ -40,7 +40,9 @@ type HatVersion struct {
HatVersion int64
}
var migrations = []Migration{}
var migrations = []Migration{
NewMigration("add pull request version", createPullRequestDiffTable),
}
func GetCurrentHatDBVersion(x *xorm.Engine) (int64, error) {
if err := x.Sync(new(HatVersion)); err != nil {

29
models/migrations/v1.go Normal file
View File

@ -0,0 +1,29 @@
package migrations
import (
issues_model "code.gitea.io/gitea/models/issues"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
func createPullRequestDiffTable(x *xorm.Engine) error {
type PullRequestVersion struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
Repo *repo_model.Repository `xorm:"-"`
PullID int64 `xorm:"INDEX"`
Pull *issues_model.PullRequest `xorm:"-"`
AddLineNum int
CommitsCount int
DelLineNum int
FilesCount int
HeadCommitID string `xorm:"VARCHAR(40)"`
BaseCommitID string `xorm:"VARCHAR(40)"`
StartCommitID string `xorm:"VARCHAR(40)"`
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated INDEX"`
}
return x.Sync2(new(PullRequestVersion))
}

100
models/pull/pull_version.go Normal file
View File

@ -0,0 +1,100 @@
package pull
import (
"context"
"fmt"
"code.gitea.io/gitea/models/db"
gitea_issues_model "code.gitea.io/gitea/models/issues"
gitea_repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/timeutil"
"xorm.io/xorm"
)
type PullRequestVersion struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
Repo *gitea_repo_model.Repository `xorm:"-"`
PullID int64 `xorm:"INDEX"`
Pull *gitea_issues_model.PullRequest `xorm:"-"`
AddLineNum int
CommitsCount int
DelLineNum int
FilesCount int
HeadCommitID string `xorm:"VARCHAR(40)"`
BaseCommitID string `xorm:"VARCHAR(40)"`
StartCommitID string `xorm:"VARCHAR(40)"`
CreatedUnix timeutil.TimeStamp `xorm:"created INDEX"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated INDEX"`
}
func listPullRequestVersionStatement(ctx context.Context, prID int64, opts *db.ListOptions) (*xorm.Session, error) {
sess := db.GetEngine(db.DefaultContext).Where("pull_request_version.pull_id=?", prID)
sess.Join("INNER", "repository", "pull_request_version.repo_id = repository.id")
return sess, nil
}
func PullRequestVersions(ctx context.Context, prID int64, opts *db.ListOptions) ([]*PullRequestVersion, int64, error) {
if opts.Page <= 0 {
opts.Page = 1
}
countSession, err := listPullRequestVersionStatement(ctx, prID, opts)
if err != nil {
log.Error("listPullRequestVersionStatement: %v", err)
return nil, 0, err
}
maxResults, err := countSession.Count(new(PullRequestVersion))
if err != nil {
log.Error("Count pull_request_versions: %v", err)
return nil, maxResults, err
}
findSession, err := listPullRequestVersionStatement(ctx, prID, opts)
if err != nil {
log.Error("listPullRequestVersionStatement: %v", err)
return nil, 0, err
}
findSession = db.SetSessionPagination(findSession, opts)
prvs := make([]*PullRequestVersion, 0, opts.PageSize)
return prvs, maxResults, findSession.Find(&prvs)
}
func GetPullRequestVersionByID(ctx context.Context, prID, id int64) (*PullRequestVersion, error) {
if id < 1 {
return nil, gitea_issues_model.ErrPullRequestNotExist{}
}
prv := &PullRequestVersion{
PullID: prID,
ID: id,
}
has, err := db.GetEngine(ctx).Get(prv)
if err != nil {
return nil, err
} else if !has {
return nil, gitea_issues_model.ErrPullRequestNotExist{}
}
return prv, nil
}
// NewPullRequestDiff creates new pull request diff version for repository.
func NewPullRequestVersion(ctx context.Context, repo *gitea_repo_model.Repository, pr *gitea_issues_model.PullRequest, addLineNum, commitsCount, delLineNUm, filesCount int, headCommitID, baseCommitID, StartCommitID string) (err error) {
var version PullRequestVersion
version.PullID = pr.ID
version.RepoID = repo.ID
version.AddLineNum = addLineNum
version.CommitsCount = commitsCount
version.DelLineNum = delLineNUm
version.FilesCount = filesCount
version.HeadCommitID = headCommitID
version.BaseCommitID = baseCommitID
version.StartCommitID = StartCommitID
if _, err = db.GetEngine(ctx).Insert(version); err != nil {
return fmt.Errorf("insert pull version repo: %v", err)
}
return nil
}

View File

@ -0,0 +1,15 @@
package webhook
import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/webhook"
)
func GetHookTasksByHookID(hookID int64, page, limit int) ([]*webhook.HookTask, error) {
tasks := make([]*webhook.HookTask, 0, limit)
return tasks, db.GetEngine(db.DefaultContext).
Limit(limit, (page-1)*limit).
Where("hook_id=?", hookID).
Desc("id").
Find(&tasks)
}

21
models/webhook/webhook.go Normal file
View File

@ -0,0 +1,21 @@
package webhook
import (
"code.gitea.io/gitea/models/db"
gitea_webhook_model "code.gitea.io/gitea/models/webhook"
)
type Webhook struct {
gitea_webhook_model.Webhook
}
func GetWebhook(bean *Webhook) (*Webhook, error) {
webhook := bean.Webhook
has, err := db.GetEngine(db.DefaultContext).Get(&webhook)
if err != nil {
return nil, err
} else if !has {
return nil, gitea_webhook_model.ErrWebhookNotExist{webhook.ID}
}
return bean, nil
}

View File

@ -1,13 +1,19 @@
package convert
import (
"encoding/json"
"fmt"
"strings"
"code.gitea.io/gitea/models/organization"
"code.gitea.io/gitea/models/repo"
gitea_convert "code.gitea.io/gitea/modules/convert"
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/webhook"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/util"
gitea_convert "code.gitea.io/gitea/services/convert"
"code.gitea.io/gitea/services/gitdiff"
api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)
@ -41,15 +47,15 @@ func ToTagCommit(repo *repo.Repository, gitRepo *git.Repository, t *git.Tag) (re
}, nil
}
func ToOrganization(org *organization.Organization, team *organization.Team) (*api.Organization, error) {
apiTeam, err := gitea_convert.ToTeam(team)
func ToOrganization(ctx *context.APIContext, org *organization.Organization, team *organization.Team) (*api.Organization, error) {
apiTeam, err := gitea_convert.ToTeam(ctx, team)
if err != nil {
return &api.Organization{}, err
}
return &api.Organization{
ID: org.ID,
Name: org.Name,
AvatarURL: org.AvatarLink(),
AvatarURL: org.AvatarLink(ctx),
UserName: org.Name,
FullName: org.FullName,
Description: org.Description,
@ -60,3 +66,57 @@ func ToOrganization(org *organization.Organization, team *organization.Team) (*a
OwnerTeam: apiTeam,
}, nil
}
func ToHookTask(t *webhook.HookTask) *api.HookTask {
config := map[string]string{
"url": t.RequestInfo.URL,
"content_type": t.RequestInfo.Headers["Content-Type"],
"http_method": t.RequestInfo.HTTPMethod,
}
payloadContent := make(map[string]interface{})
requestContent := make(map[string]interface{})
responseContent := make(map[string]interface{})
_ = json.Unmarshal([]byte(t.PayloadContent), &payloadContent)
_ = json.Unmarshal([]byte(t.RequestContent), &requestContent)
_ = json.Unmarshal([]byte(t.ResponseContent), &responseContent)
return &api.HookTask{
ID: t.ID,
UUID: t.UUID,
Type: string(t.EventType),
Config: config,
PayloadContent: payloadContent,
EventType: string(t.EventType),
IsDelivered: t.IsDelivered,
Delivered: t.Delivered.AsTime().UnixNano(),
IsSucceed: t.IsSucceed,
RequestContent: requestContent,
ResponseContent: responseContent,
}
}
func ToChangedFile(f *gitdiff.DiffFile, repo *repo_model.Repository, commit string) *api.ChangedFile {
file := &api.ChangedFile{
Filename: f.GetDiffFileName(),
OldName: f.OldName,
Index: f.Index,
Type: f.Type,
IsBin: f.IsBin,
IsCreated: f.IsCreated,
IsDeleted: f.IsDeleted,
IsLFSFile: f.IsLFSFile,
IsRenamed: f.IsRenamed,
IsSubmodule: f.IsSubmodule,
Additions: f.Addition,
Deletions: f.Deletion,
Changes: f.Addition + f.Deletion,
Sha: commit,
HTMLURL: fmt.Sprint(repo.HTMLURL(), "/src/commit/", commit, "/", util.PathEscapeSegments(f.GetDiffFileName())),
ContentsURL: fmt.Sprint(repo.APIURL(), "/contents/", util.PathEscapeSegments(f.GetDiffFileName()), "?ref=", commit),
RawURL: fmt.Sprint(repo.HTMLURL(), "/raw/commit/", commit, "/", util.PathEscapeSegments(f.GetDiffFileName())),
}
return file
}

View File

@ -0,0 +1,28 @@
package convert
import (
"context"
repo_model "code.gitea.io/gitea/models/repo"
user_model "code.gitea.io/gitea/models/user"
"code.gitea.io/gitea/modules/git"
gitea_convert "code.gitea.io/gitea/services/convert"
hat_api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)
func ToCommit(ctx context.Context, repo *repo_model.Repository, gitRepo *git.Repository, commit *git.Commit, userCache map[string]*user_model.User, opts gitea_convert.ToCommitOptions) (*hat_api.Commit, error) {
giteaApiCommit, err := gitea_convert.ToCommit(ctx, repo, gitRepo, commit, userCache, opts)
if err != nil {
return nil, err
}
branchName, err := commit.GetBranchName()
if err != nil {
return nil, err
}
return &hat_api.Commit{
Commit: giteaApiCommit,
Branch: branchName,
}, nil
}

View File

@ -7,9 +7,9 @@ import (
"code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/user"
gitea_convert "code.gitea.io/gitea/modules/convert"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
gitea_convert "code.gitea.io/gitea/services/convert"
hat_api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)
@ -74,7 +74,7 @@ func ToAPIPullRequest(ctx context.Context, gitRepo *git.Repository, pr *issues.P
}
if commitSHA != "" {
// Get immediate parent of the first commit in the patch, grab history back
parentCommit, _, err = git.NewCommand(ctx, "rev-list", "-1", "--skip=1", commitSHA).RunStdString(&git.RunOpts{Dir: gitRepo.Path})
parentCommit, _, err = git.NewCommand(ctx, "rev-list", "-1", "--skip=1").AddDynamicArguments(commitSHA).RunStdString(&git.RunOpts{Dir: gitRepo.Path})
if err == nil {
parentCommit = strings.TrimSpace(parentCommit)
}

View File

@ -0,0 +1,23 @@
package convert
import (
hat_pull_model "code.gitlink.org.cn/Gitlink/gitea_hat.git/models/pull"
hat_api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)
func ToAPIPullRequestVersion(prv *hat_pull_model.PullRequestVersion) *hat_api.PullRequestVersion {
apiPullRequestVersion := &hat_api.PullRequestVersion{
ID: prv.ID,
AddLineNum: prv.AddLineNum,
DelLineNum: prv.DelLineNum,
CommitsCount: prv.CommitsCount,
FilesCount: prv.FilesCount,
HeadCommitSha: prv.HeadCommitID,
BaseCommitSha: prv.BaseCommitID,
StartCommitSha: prv.StartCommitID,
CreatedAt: prv.CreatedUnix.AsTimePtr(),
UpdatedAt: prv.UpdatedUnix.AsTimePtr(),
}
return apiPullRequestVersion
}

View File

@ -0,0 +1,34 @@
package convert
import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/modules/context"
gitea_api "code.gitea.io/gitea/modules/structs"
gitea_convert "code.gitea.io/gitea/services/convert"
api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)
func ToRelease(ctx *context.APIContext, r *repo_model.Release) *api.Release {
assets := make([]*gitea_api.Attachment, 0)
for _, att := range r.Attachments {
assets = append(assets, gitea_convert.ToAttachment(ctx.Repo.Repository, att))
}
return &api.Release{
ID: r.ID,
TagName: r.TagName,
Target: r.Target,
Title: r.Title,
Sha: r.Sha1,
Note: r.Note,
URL: r.APIURL(),
HTMLURL: r.HTMLURL(),
TarURL: r.TarURL(),
ZipURL: r.ZipURL(),
IsDraft: r.IsDraft,
IsPrerelease: r.IsPrerelease,
CreatedAt: r.CreatedUnix.AsTime(),
PublishedAt: r.CreatedUnix.AsTime(),
Publisher: gitea_convert.ToUser(ctx, r.Publisher, nil),
Attachments: assets,
}
}

181
modules/git/blame.go Normal file
View File

@ -0,0 +1,181 @@
package git
import (
"bufio"
"context"
"fmt"
"io"
"os"
"os/exec"
"regexp"
"strconv"
"strings"
gitea_git "code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/process"
hat_api "code.gitlink.org.cn/Gitlink/gitea_hat.git/modules/structs"
)
type BlameReader struct {
cmd *exec.Cmd
output io.ReadCloser
reader *bufio.Reader
lastSha *string
cancel context.CancelFunc // Cancels the context that this reader runs in
finished process.FinishedFunc // Tells the process manager we're finished and it can remove the associated process from the process table
}
var shaLineRegex = regexp.MustCompile("^([a-z0-9]{40})")
func GetBlameCommit(repo *gitea_git.Repository, sha string) *hat_api.BlameCommit {
commit, err := repo.GetCommit(sha)
if err != nil {
return &hat_api.BlameCommit{}
}
var apiParents []string
for i := 0; i < commit.ParentCount(); i++ {
sha, _ := commit.ParentID(i)
apiParents = append(apiParents, sha.String())
}
return &hat_api.BlameCommit{
ID: sha,
Author: commit.Author,
Commiter: commit.Committer,
CommitMessage: commit.CommitMessage,
Parents: apiParents,
AuthoredTime: commit.Author.When,
CommittedTime: commit.Committer.When,
CreatedTime: commit.Committer.When,
}
}
func (r *BlameReader) NextApiPart(repo *gitea_git.Repository) (*hat_api.BlamePart, error) {
var blamePart *hat_api.BlamePart
reader := r.reader
effectLine := 0
if r.lastSha != nil {
blamePart = &hat_api.BlamePart{
Sha: *r.lastSha,
Commit: GetBlameCommit(repo, *r.lastSha),
PreviousNumber: 0,
CurrentNumber: 0,
EffectLine: effectLine,
Lines: make([]string, 0),
}
}
var line []byte
var isPrefix bool
var err error
for err != io.EOF {
line, isPrefix, err = reader.ReadLine()
if err != nil && err != io.EOF {
return blamePart, err
}
if len(line) == 0 {
continue
}
lines := shaLineRegex.FindSubmatch(line)
if lines != nil {
lineString := string(line)
sha1 := string(lines[1])
lineString = strings.Replace(lineString, sha1, "", 1)
lineArray := strings.Split(lineString, " ")
previousNumber, _ := strconv.Atoi(lineArray[1])
if blamePart == nil {
blamePart = &hat_api.BlamePart{
Sha: sha1,
Commit: GetBlameCommit(repo, sha1),
PreviousNumber: previousNumber,
CurrentNumber: 0,
EffectLine: effectLine,
Lines: make([]string, 0),
}
}
if blamePart.Sha != sha1 {
r.lastSha = &sha1
// need to munch to end of line...
for isPrefix {
_, isPrefix, err = reader.ReadLine()
if err != nil && err != io.EOF {
return blamePart, err
}
}
return blamePart, nil
}
} else if line[0] == '\t' {
code := line[1:]
effectLine += 1
blamePart.Lines = append(blamePart.Lines, string(code))
}
blamePart.EffectLine = effectLine
for isPrefix {
_, isPrefix, err = reader.ReadLine()
if err != nil && err != io.EOF {
return blamePart, err
}
}
}
r.lastSha = nil
return blamePart, nil
}
func (r *BlameReader) Close() error {
defer r.finished() // Only remove the process from the process table when the underlying command is closed
r.cancel() // However, first cancel our own context early
_ = r.output.Close()
if err := r.cmd.Wait(); err != nil {
return fmt.Errorf("Wait: %w", err)
}
return nil
}
func CreateBlameReader(ctx context.Context, repoPath, commitID, file string) (*BlameReader, error) {
return createBlameReader(ctx, repoPath, gitea_git.GitExecutable, "blame", commitID, "--porcelain", "--", file)
}
func createBlameReader(ctx context.Context, dir string, command ...string) (*BlameReader, error) {
// Here we use the provided context - this should be tied to the request performing the blame so that it does not hang around.
ctx, cancel, finished := process.GetManager().AddContext(ctx, fmt.Sprintf("GetBlame [repo_path: %s]", dir))
cmd := exec.CommandContext(ctx, command[0], command[1:]...)
cmd.Dir = dir
cmd.Stderr = os.Stderr
process.SetSysProcAttribute(cmd)
stdout, err := cmd.StdoutPipe()
if err != nil {
defer finished()
return nil, fmt.Errorf("StdoutPipe: %w", err)
}
if err = cmd.Start(); err != nil {
defer finished()
_ = stdout.Close()
return nil, fmt.Errorf("Start: %w", err)
}
reader := bufio.NewReader(stdout)
return &BlameReader{
cmd: cmd,
output: stdout,
reader: reader,
cancel: cancel,
finished: finished,
}, nil
}

View File

@ -0,0 +1,124 @@
package git
import (
"bufio"
"context"
"fmt"
"io"
"strings"
gitea_git "code.gitea.io/gitea/modules/git"
)
func GetSearchBranches(ctx context.Context, repo *gitea_git.Repository, search string, skip, limit int) ([]*gitea_git.Branch, int, error) {
brs, countAll, err := callShowSearchRef(ctx, repo.Path, gitea_git.BranchPrefix, "--heads", search, skip, limit)
if err != nil {
return nil, 0, err
}
branches := make([]*gitea_git.Branch, len(brs))
for i := range brs {
branches[i] = &gitea_git.Branch{
Name: brs[i],
Path: repo.Path,
}
}
return branches, countAll, nil
}
func callShowSearchRef(ctx context.Context, repoPath, prefix, arg, search string, skip, limit int) (branchNames []string, countAll int, err error) {
stdoutReader, stdoutWriter := io.Pipe()
defer func() {
_ = stdoutReader.Close()
_ = stdoutWriter.Close()
}()
go func() {
stderrBuilder := &strings.Builder{}
err := gitea_git.NewCommand(ctx, "show-ref").AddDynamicArguments(arg).
Run(&gitea_git.RunOpts{
Dir: repoPath,
Stdout: stdoutWriter,
Stderr: stderrBuilder,
})
if err != nil {
if stderrBuilder.Len() == 0 {
_ = stdoutWriter.Close()
return
}
_ = stdoutWriter.CloseWithError(ConcatenateError(err, stderrBuilder.String()))
} else {
_ = stdoutWriter.Close()
}
}()
i := 0
bufReader := bufio.NewReader(stdoutReader)
for i < skip {
line, isPrefix, err := bufReader.ReadLine()
if err == io.EOF {
return branchNames, i, nil
}
if err != nil {
return nil, 0, err
}
branchName := strings.TrimPrefix(strings.Split(string(line), " ")[1], prefix)
if len(branchName) > 0 {
branchName = branchName[:len(branchName)-1]
}
isSeached := strings.Contains(branchName, search)
if !isPrefix && isSeached {
i++
}
}
for limit == 0 || i < skip+limit {
branchName, err := bufReader.ReadString('\n')
if err == io.EOF {
// This shouldn't happen... but we'll tolerate it for the sake of peace
return branchNames, i, nil
}
if err != nil {
return nil, i, err
}
branchName = strings.TrimPrefix(strings.Split(string(branchName), " ")[1], prefix)
if len(branchName) > 0 {
branchName = branchName[:len(branchName)-1]
}
isSeached := strings.Contains(branchName, search)
if isSeached {
i++
branchNames = append(branchNames, branchName)
}
}
// count all refs
for limit != 0 {
line, isPrefix, err := bufReader.ReadLine()
if err == io.EOF {
return branchNames, i, nil
}
if err != nil {
return nil, 0, err
}
branchName := strings.TrimPrefix(strings.Split(string(line), " ")[1], prefix)
if len(branchName) > 0 {
branchName = branchName[:len(branchName)-1]
}
isSeached := strings.Contains(branchName, search)
if !isPrefix && isSeached {
i++
}
}
return branchNames, i, nil
}
func ConcatenateError(err error, stderr string) error {
if len(stderr) == 0 {
return err
}
return fmt.Errorf("%w - %s", err, stderr)
}

View File

@ -2,6 +2,8 @@ package git
import (
"bytes"
"encoding/hex"
"fmt"
"io"
"strconv"
"strings"
@ -12,7 +14,7 @@ import (
const prettyLogFormat = `--pretty=format:%H`
func GetFirstAndLastCommitByPath(repo *gitea_git.Repository, revision, relpath string) (*gitea_git.Commit, *gitea_git.Commit, error) {
stdout, _, runErr := gitea_git.NewCommand(repo.Ctx, "log", revision, prettyLogFormat, "--", relpath).RunStdBytes(&gitea_git.RunOpts{Dir: repo.Path})
stdout, _, runErr := gitea_git.NewCommand(repo.Ctx, "log").AddDynamicArguments(revision, prettyLogFormat, "--"+relpath).RunStdBytes(&gitea_git.RunOpts{Dir: repo.Path})
if runErr != nil {
return nil, nil, runErr
}
@ -36,8 +38,8 @@ func GetFirstAndLastCommitByPath(repo *gitea_git.Repository, revision, relpath s
}
// CommitsByFileAndRange return the commits according revision file and the page
func CommitsByFileAndRange(repo *gitea_git.Repository, revision, file string, page, pageSize int) ([]*gitea_git.Commit, error) {
skip := (page - 1) * pageSize
func AllCommitsByFileAndRange(repo *gitea_git.Repository, opts gitea_git.CommitsByFileAndRangeOptions, keyword string, pageSize int) ([]*gitea_git.Commit, error) {
skip := (opts.Page - 1) * pageSize
stdoutReader, stdoutWriter := io.Pipe()
defer func() {
@ -46,36 +48,68 @@ func CommitsByFileAndRange(repo *gitea_git.Repository, revision, file string, pa
}()
go func() {
stderr := strings.Builder{}
gitCmd := gitea_git.NewCommand(repo.Ctx, "log", prettyLogFormat, "--follow",
"--max-count="+strconv.Itoa(pageSize))
gitCmd.AddDynamicArguments(revision)
gitCmd.AddArguments("--", file)
gitCmd := gitea_git.NewCommand(repo.Ctx, "rev-list").
AddOptionFormat("--max-count=%d", pageSize*opts.Page).
AddOptionFormat("--skip=%d", skip).
AddOptionFormat("--grep=%s", keyword)
gitCmd.AddDynamicArguments(opts.Revision)
if opts.Not != "" {
gitCmd.AddOptionValues("--not", opts.Not)
}
gitCmd.AddArguments("--all")
// gitCmd.AddDashesAndList(opts.File)
err := gitCmd.Run(&gitea_git.RunOpts{
Dir: repo.Path,
Stdout: stdoutWriter,
Stderr: &stderr,
})
if err != nil {
_ = stdoutWriter.CloseWithError(gitea_git.ConcatenateError(err, (&stderr).String()))
_ = stdoutWriter.CloseWithError(ConcatenateError(err, (&stderr).String()))
} else {
_ = stdoutWriter.Close()
}
}()
if skip > 0 {
_, err := io.CopyN(io.Discard, stdoutReader, int64(skip*41))
if err != nil {
commits := []*gitea_git.Commit{}
shaline := [41]byte{}
var sha1 gitea_git.SHA1
for {
n, err := io.ReadFull(stdoutReader, shaline[:])
if err != nil || n < 40 {
if err == io.EOF {
return []*gitea_git.Commit{}, nil
err = nil
}
_ = stdoutReader.CloseWithError(err)
return commits, err
}
n, err = hex.Decode(sha1[:], shaline[0:40])
if n != 20 {
err = fmt.Errorf("invalid sha %q", string(shaline[:40]))
}
if err != nil {
return nil, err
}
commit, err := repo.GetCommit(sha1.String())
if err != nil {
return nil, err
}
commits = append(commits, commit)
}
}
func GetAllCommitsCount(repo *gitea_git.Repository, keyword string) (int64, error) {
cmd := gitea_git.NewCommand(repo.Ctx, "rev-list").
AddOptionFormat("--grep=%s", keyword)
cmd.AddArguments("--exclude=" + "refs/pull/" + "*")
cmd.AddArguments("--all", "--count")
stdout, _, err := cmd.RunStdString(&gitea_git.RunOpts{Dir: repo.Path})
if err != nil {
return 0, err
}
stdout, err := io.ReadAll(stdoutReader)
if err != nil {
return nil, err
}
return parsePrettyFormatLogToList(repo, stdout)
return strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
}

View File

@ -3,6 +3,11 @@ package git
import gitea_git "code.gitea.io/gitea/modules/git"
func GetDiffFileOnlyName(repo *gitea_git.Repository, base, head string) (string, error) {
stdout, _, err := gitea_git.NewCommand(repo.Ctx, "diff", "--name-only", base, head).RunStdString(&gitea_git.RunOpts{Dir: repo.Path})
stdout, _, err := gitea_git.NewCommand(repo.Ctx, "diff", "--name-only").AddDynamicArguments(base, head).RunStdString(&gitea_git.RunOpts{Dir: repo.Path})
return stdout, err
}
func GetDiffStringByFilePath(repo *gitea_git.Repository, base, head, filepath string) (string, error) {
stdout, _, err := gitea_git.NewCommand(repo.Ctx, "diff", "-p").AddDynamicArguments(base, head, filepath).RunStdString(&gitea_git.RunOpts{Dir: repo.Path})
return stdout, err
}

View File

@ -0,0 +1,163 @@
package git
import (
"bufio"
"context"
"fmt"
"os"
"strconv"
"strings"
gitea_git "code.gitea.io/gitea/modules/git"
)
type RepoContributor struct {
Name string `json:"name"`
Email string `json:"email"`
Commits int `json:"commits"`
ContributionPerc string `json:"contribution_perc"`
}
func GetRepoContributors(repo *gitea_git.Repository, page, pageSize int) (int, []*RepoContributor, error) {
var total, totalContributions, skip int
var contributors []*RepoContributor
skip = (page - 1) * pageSize
stdoutReader, stdoutWriter, err := os.Pipe()
if err != nil {
return total, nil, err
}
defer func() {
_ = stdoutReader.Close()
_ = stdoutWriter.Close()
}()
cmd := gitea_git.NewCommand(repo.Ctx, "shortlog", "-sne", "--all")
stderr := new(strings.Builder)
err = cmd.Run(&gitea_git.RunOpts{
Env: []string{},
Dir: repo.Path,
Stdout: stdoutWriter,
Stderr: stderr,
PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
_ = stdoutWriter.Close()
scanner := bufio.NewScanner(stdoutReader)
scanner.Split(bufio.ScanLines)
var ca int
for scanner.Scan() {
l := strings.TrimSpace(scanner.Text())
commits := l[0:strings.Index(l, "\t")]
commitsInt, err := strconv.Atoi(commits)
if err != nil {
return err
}
name := l[strings.Index(l, "\t")+1 : strings.Index(l, " <")]
email := l[strings.Index(l, "<")+1 : strings.Index(l, ">")]
totalContributions += commitsInt
total++
if skip > 0 {
skip--
} else {
if ca < pageSize {
contributors = append(contributors, &RepoContributor{
Commits: commitsInt,
Name: name,
Email: email,
})
ca++
}
}
}
_ = stdoutReader.Close()
return nil
},
})
for _, cont := range contributors {
fperc := fmt.Sprintf("%.2f", float64(cont.Commits)*100/float64(totalContributions))
cont.ContributionPerc = fperc + "%"
}
return total, contributors, nil
}
func GetRepoContributorsNew(repo *gitea_git.Repository, page, pageSize int) (int, []*RepoContributor, error) {
var total, totalContributions, skip int
var contributors []*RepoContributor
var contributorInfos []*RepoContributor
contributorInfoHash := make(map[string]*RepoContributor)
skip = (page - 1) * pageSize
stdoutReader, stdoutWriter, err := os.Pipe()
if err != nil {
return total, nil, err
}
defer func() {
_ = stdoutReader.Close()
_ = stdoutWriter.Close()
}()
cmd := gitea_git.NewCommand(repo.Ctx, "shortlog", "-sne", "--all")
stderr := new(strings.Builder)
err = cmd.Run(&gitea_git.RunOpts{
Env: []string{},
Dir: repo.Path,
Stdout: stdoutWriter,
Stderr: stderr,
PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
_ = stdoutWriter.Close()
scanner := bufio.NewScanner(stdoutReader)
scanner.Split(bufio.ScanLines)
for scanner.Scan() {
l := strings.TrimSpace(scanner.Text())
commits := l[0:strings.Index(l, "\t")]
commitsInt, err := strconv.Atoi(commits)
if err != nil {
return err
}
name := l[strings.Index(l, "\t")+1 : strings.Index(l, " <")]
email := strings.ToLower(l[strings.Index(l, "<")+1 : strings.Index(l, ">")])
totalContributions += commitsInt
// committer is not system user
if existedContributorInfo, ok := contributorInfoHash[email]; ok {
// existed: same primary email, different committer name
existedContributorInfo.Commits += commitsInt
} else {
var newContributor = &RepoContributor{
Commits: commitsInt,
Name: name,
Email: email,
}
total++
contributorInfos = append(contributorInfos, newContributor)
contributorInfoHash[email] = newContributor
}
}
_ = stdoutReader.Close()
return nil
},
})
var ca int
for _, cont := range contributorInfos {
if skip > 0 {
skip--
} else {
if ca < pageSize {
fperc := fmt.Sprintf("%.2f", float64(cont.Commits)*100/float64(totalContributions))
contributors = append(contributors, &RepoContributor{
Commits: cont.Commits,
Name: cont.Name,
Email: cont.Email,
ContributionPerc: fperc + "%",
})
ca++
}
}
}
return total, contributors, nil
}

279
modules/git/repo_stats.go Normal file
View File

@ -0,0 +1,279 @@
package git
import (
"bufio"
"context"
"fmt"
"os"
"sort"
"strconv"
"strings"
"time"
"code.gitea.io/gitea/modules/container"
gitea_git "code.gitea.io/gitea/modules/git"
)
type CodeActivityStats struct {
AuthorCount int64 `json:"author_count"`
CommitCount int64 `json:"commit_count"`
ChangedFiles int64 `json:"changed_files"`
Additions int64 `json:"additions"`
Deletions int64 `json:"deletions"`
CommitCountInAllBranches int64 `json:"commit_count_in_all_branches"`
Authors []*CodeActivityAuthor `json:"authors"`
}
type CodeActivityAuthor struct {
Name string `json:"name"`
Email string `json:"email"`
Commits int64 `json:"commits"`
Additions int64 `json:"additions"`
Deletions int64 `json:"deletions"`
}
// GetCodeActivityStats returns code statistics for activity page
func GetCodeActivityStatsWithoutSince(repo *gitea_git.Repository, branch string) (*CodeActivityStats, error) {
stats := &CodeActivityStats{}
stdout, _, runErr := gitea_git.NewCommand(repo.Ctx, "rev-list", "--count", "--no-merges", "--branches=*", "--date=iso").RunStdString(&gitea_git.RunOpts{Dir: repo.Path})
if runErr != nil {
return nil, runErr
}
c, err := strconv.ParseInt(strings.TrimSpace(stdout), 10, 64)
if err != nil {
return nil, err
}
stats.CommitCountInAllBranches = c
stdoutReader, stdoutWriter, err := os.Pipe()
if err != nil {
return nil, err
}
defer func() {
_ = stdoutReader.Close()
_ = stdoutWriter.Close()
}()
gitCmd := gitea_git.NewCommand(repo.Ctx, "log", "--numstat", "--no-merges", "--pretty=format:---%n%h%n%aN%n%aE%n", "--date=iso")
if len(branch) == 0 {
gitCmd.AddArguments("--branches=*")
} else {
gitCmd.AddArguments("--first-parent").AddDynamicArguments(branch)
}
stderr := new(strings.Builder)
err = gitCmd.Run(&gitea_git.RunOpts{
Env: []string{},
Dir: repo.Path,
Stdout: stdoutWriter,
Stderr: stderr,
PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
_ = stdoutWriter.Close()
scanner := bufio.NewScanner(stdoutReader)
scanner.Split(bufio.ScanLines)
stats.CommitCount = 0
stats.Additions = 0
stats.Deletions = 0
authors := make(map[string]*CodeActivityAuthor)
files := make(container.Set[string])
var author string
var currentAuthor *CodeActivityAuthor
p := 0
for scanner.Scan() {
l := strings.TrimSpace(scanner.Text())
if l == "---" {
p = 1
} else if p == 0 {
continue
} else {
p++
}
if p > 4 && len(l) == 0 {
continue
}
switch p {
case 1: // Separator
case 2: // Commit sha-1
stats.CommitCount++
case 3: // Author
author = l
case 4: // E-mail
email := strings.ToLower(l)
if _, ok := authors[email+author]; !ok {
authors[email+author] = &CodeActivityAuthor{Name: author, Email: email, Commits: 0}
}
authors[email+author].Commits++
currentAuthor = authors[email+author]
default: // Changed file
if parts := strings.Fields(l); len(parts) >= 3 {
if parts[0] != "-" {
if c, err := strconv.ParseInt(strings.TrimSpace(parts[0]), 10, 64); err == nil {
stats.Additions += c
currentAuthor.Additions += c
}
}
if parts[1] != "-" {
if c, err := strconv.ParseInt(strings.TrimSpace(parts[1]), 10, 64); err == nil {
stats.Deletions += c
currentAuthor.Deletions += c
}
}
files.Add(parts[2])
}
}
}
a := make([]*CodeActivityAuthor, 0, len(authors))
for _, v := range authors {
a = append(a, v)
}
// Sort authors descending depending on commit count
sort.Slice(a, func(i, j int) bool {
return a[i].Commits > a[j].Commits
})
stats.AuthorCount = int64(len(authors))
stats.ChangedFiles = int64(len(files))
stats.Authors = a
_ = stdoutReader.Close()
return nil
},
})
if err != nil {
return nil, fmt.Errorf("Failed to get GetCodeActivityStats for repository.\nError: %w\nStderr: %s", err, stderr)
}
return stats, nil
}
// GetCodeActivityStats returns code statistics for activity page
func GetPaginateCodeAuthors(repo *gitea_git.Repository, fromTime time.Time, branch string, page, pageSize int) (int64, []*CodeActivityAuthor, error) {
var total int64
var authors []*CodeActivityAuthor
since := fromTime.Format(time.RFC3339)
authorCmd := gitea_git.NewCommand(repo.Ctx, "log", "--no-merges", "--format=%aN <%aE>", "--date=iso").AddDynamicArguments(fmt.Sprintf("--since='%s'", since))
if len(branch) == 0 {
authorCmd.AddArguments("--branches=*")
} else {
authorCmd.AddArguments("--first-parent").AddDynamicArguments(branch)
}
authorStdout, _, runErr := authorCmd.RunStdString(&gitea_git.RunOpts{Dir: repo.Path})
if runErr != nil {
return total, nil, runErr
}
skip := (page - 1) * pageSize
var filterAuthor string
var ca int
authorArr := strings.Split(authorStdout, "\n")
authorSet := make(map[string]bool, len(authorArr))
for _, author := range authorArr {
_, ok := authorSet[author]
if ok || author == "" {
continue
}
authorSet[author] = true
authorArr[total] = author
total++
if skip > 0 {
skip--
} else {
if ca < pageSize {
if ca != 0 {
filterAuthor += "\\|"
}
filterAuthor += author
ca++
}
}
}
if filterAuthor == "" {
return total, authors, nil
}
stdoutReader, stdoutWriter, err := os.Pipe()
if err != nil {
return total, nil, err
}
defer func() {
_ = stdoutReader.Close()
_ = stdoutWriter.Close()
}()
gitCmd := gitea_git.NewCommand(repo.Ctx, "log", "--numstat", "--no-merges", "--pretty=format:---%n%h%n%aN%n%aE%n", "--date=iso").AddDynamicArguments(fmt.Sprintf("--author=%s", filterAuthor))
if len(branch) == 0 {
gitCmd.AddArguments("--branches=*")
} else {
gitCmd.AddArguments("--first-parent").AddDynamicArguments(branch)
}
stderr := new(strings.Builder)
err = gitCmd.Run(&gitea_git.RunOpts{
Env: []string{},
Dir: repo.Path,
Stdout: stdoutWriter,
Stderr: stderr,
PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
_ = stdoutWriter.Close()
scanner := bufio.NewScanner(stdoutReader)
scanner.Split(bufio.ScanLines)
authorsMap := make(map[string]*CodeActivityAuthor)
files := make(container.Set[string])
var author string
var currentAuthor *CodeActivityAuthor
p := 0
for scanner.Scan() {
l := strings.TrimSpace(scanner.Text())
if l == "---" {
p = 1
} else if p == 0 {
continue
} else {
p++
}
if p > 4 && len(l) == 0 {
continue
}
switch p {
case 1: // Separator
case 2: // Commit sha-1
case 3: // Author
author = l
case 4: // E-mail
email := strings.ToLower(l)
if _, ok := authorsMap[email+author]; !ok {
authorsMap[email+author] = &CodeActivityAuthor{Name: author, Email: email, Commits: 0}
}
authorsMap[email+author].Commits++
currentAuthor = authorsMap[email+author]
default: // Changed file
if parts := strings.Fields(l); len(parts) >= 3 {
if parts[0] != "-" {
if c, err := strconv.ParseInt(strings.TrimSpace(parts[0]), 10, 64); err == nil {
currentAuthor.Additions += c
}
}
if parts[1] != "-" {
if c, err := strconv.ParseInt(strings.TrimSpace(parts[1]), 10, 64); err == nil {
currentAuthor.Deletions += c
}
}
files.Add(parts[2])
}
}
}
for _, v := range authorsMap {
authors = append(authors, v)
}
_ = stdoutReader.Close()
return nil
},
})
if err != nil {
return total, nil, fmt.Errorf("Failed to get GetCodeActivityStats for repository.\nError: %w\nStderr: %s", err, stderr)
}
return total, authors, nil
}

114
modules/schemas/issue.json Normal file
View File

@ -0,0 +1,114 @@
{
"title": "Issue",
"description": "Issues associated to a repository within a forge (Gitea, GitLab, etc.).",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"number": {
"description": "Unique identifier, relative to the repository.",
"type": "number"
},
"poster_id": {
"description": "Unique identifier of the user who authored the issue.",
"type": "number"
},
"poster_name": {
"description": "Name of the user who authored the issue.",
"type": "string"
},
"poster_email": {
"description": "Email of the user who authored the issue.",
"type": "string"
},
"title": {
"description": "Short description displayed as the title.",
"type": "string"
},
"content": {
"description": "Long, multiline, description.",
"type": "string"
},
"ref": {
"description": "Target branch in the repository.",
"type": "string"
},
"milestone": {
"description": "Name of the milestone.",
"type": "string"
},
"state": {
"description": "A 'closed' issue will not see any activity in the future, otherwise it is 'open'.",
"enum": [
"closed",
"open"
]
},
"is_locked": {
"description": "A locked issue can only be modified by privileged users.",
"type": "boolean"
},
"created": {
"description": "Creation time.",
"type": "string",
"format": "date-time"
},
"updated": {
"description": "Last update time.",
"type": "string",
"format": "date-time"
},
"closed": {
"description": "The last time 'state' changed to 'closed'.",
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"labels": {
"description": "List of labels.",
"type": "array",
"items": {
"$ref": "label.json"
}
},
"reactions": {
"description": "List of reactions.",
"type": "array",
"items": {
"$ref": "reaction.json"
}
},
"assignees": {
"description": "List of assignees.",
"type": "array",
"items": {
"description": "Name of a user assigned to the issue.",
"type": "string"
}
}
},
"required": [
"number",
"poster_id",
"poster_name",
"title",
"content",
"state",
"is_locked",
"created",
"updated"
]
},
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "http://example.com/issue.json",
"$$target": "issue.json"
}

View File

@ -0,0 +1,28 @@
{
"title": "Label",
"description": "Label associated to an issue.",
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"description": "Name of the label, unique within the repository.",
"type": "string"
},
"color": {
"description": "Color code of the label.",
"type": "string"
},
"description": {
"description": "Long, multiline, description.",
"type": "string"
}
},
"required": [
"name"
],
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "label.json",
"$$target": "label.json"
}

View File

@ -0,0 +1,67 @@
{
"title": "Milestone",
"description": "Milestone associated to a repository within a forge.",
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {
"description": "Short description.",
"type": "string"
},
"description": {
"description": "Long, multiline, description.",
"type": "string"
},
"deadline": {
"description": "Deadline after which the milestone is overdue.",
"type": "string",
"format": "date-time"
},
"created": {
"description": "Creation time.",
"type": "string",
"format": "date-time"
},
"updated": {
"description": "Last update time.",
"type": "string",
"format": "date-time"
},
"closed": {
"description": "The last time 'state' changed to 'closed'.",
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
]
},
"state": {
"description": "A 'closed' issue will not see any activity in the future, otherwise it is 'open'.",
"enum": [
"closed",
"open"
]
}
},
"required": [
"title",
"description",
"deadline",
"created",
"updated",
"closed",
"state"
]
},
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "http://example.com/milestone.json",
"$$target": "milestone.json"
}

View File

@ -0,0 +1,29 @@
{
"title": "Reaction",
"description": "Reaction associated to an issue or a comment.",
"type": "object",
"additionalProperties": false,
"properties": {
"user_id": {
"description": "Unique identifier of the user who authored the reaction.",
"type": "number"
},
"user_name": {
"description": "Name of the user who authored the reaction.",
"type": "string"
},
"content": {
"description": "Representation of the reaction",
"type": "string"
}
},
"required": [
"user_id",
"content"
],
"$schema": "http://json-schema.org/draft-04/schema#",
"$id": "http://example.com/reaction.json",
"$$target": "reaction.json"
}

View File

@ -0,0 +1,10 @@
package structs
import (
gitea_api "code.gitea.io/gitea/modules/structs"
)
type HatEditUserOption struct {
NewName string `json:"new_name" binding:"MaxSize(40)"`
*gitea_api.EditUserOption
}

27
modules/structs/blame.go Normal file
View File

@ -0,0 +1,27 @@
package structs
import (
"time"
"code.gitea.io/gitea/modules/git"
)
type BlameCommit struct {
ID string `json:"id"`
Author *git.Signature `json:"author"`
Commiter *git.Signature `json:"commiter"`
CommitMessage string `json:"commit_message"`
Parents []string `json:"parents"`
AuthoredTime time.Time `json:"authored_time"`
CommittedTime time.Time `json:"committed_time"`
CreatedTime time.Time `json:"created_time"`
}
type BlamePart struct {
Sha string `json:"-"`
Commit *BlameCommit `json:"commit"`
PreviousNumber int `json:"previous_number"`
CurrentNumber int `json:"current_number"`
EffectLine int `json:"effect_line"`
Lines []string `json:"lines"`
}

View File

@ -0,0 +1,6 @@
package structs
type RestoreBranchOption struct {
BranchID int64 `json:"branch_id"`
BranchName string `json:"name"`
}

38
modules/structs/hook.go Normal file
View File

@ -0,0 +1,38 @@
package structs
import (
gitea_api "code.gitea.io/gitea/modules/structs"
)
type CreateHookOption struct {
// required: true
// enum: dingtalk,discord,gitea,gogs,msteams,slack,telegram,feishu,jianmu,softbot,reposync
Type string `json:"type" binding:"Required"`
// required: true
Config gitea_api.CreateHookOptionConfig `json:"config" binding:"Required"`
Events []string `json:"events"`
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
// default: false
Active bool `json:"active"`
}
type EditHookOption struct {
Config map[string]string `json:"config"`
Events []string `json:"events"`
BranchFilter string `json:"branch_filter" binding:"GlobPattern"`
Active *bool `json:"active"`
}
type HookTask struct {
ID int64 `json:"id"`
UUID string `json:"uuid"`
Type string `json:"type"`
Config map[string]string `json:"config"`
PayloadContent map[string]interface{} `json:"payload_content"`
EventType string `json:"event_type"`
IsDelivered bool `json:"is_delivered"`
Delivered int64 `json:"delivered"`
IsSucceed bool `json:"is_succeed"`
RequestContent map[string]interface{} `json:"request_content"`
ResponseContent map[string]interface{} `json:"response_content"`
}

View File

@ -13,3 +13,13 @@ type Organization struct {
RepoAdminChangeTeamAccess bool `json:"repo_admin_change_team_access"`
OwnerTeam interface{} `json:"owner_team"` //团队关系;
}
type EditOrgOption struct {
Name string `json:"name"`
FullName string `json:"full_name"`
Description string `json:"description" binding:"MaxSize(255)"`
Website string `json:"website" binding:"MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
Visibility string `json:"visibility" binding:"In(,public,limited,private)"`
RepoAdminChangeTeamAccess *bool `json:"repo_admin_change_team_access"`
}

View File

@ -4,6 +4,7 @@ import (
"time"
gitea_api "code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/services/gitdiff"
)
type PullRequest struct {
@ -39,3 +40,23 @@ type PullRequest struct {
CommitNum int `json:"commit_num"`
ChangedFiles int `json:"changed_files"`
}
type ChangedFile struct {
Filename string `json:"filename"`
OldName string `json:"old_name"`
Index int `json:"index"`
Type gitdiff.DiffFileType `json:"type"`
IsBin bool `json:"is_bin"`
IsCreated bool `json:"is_created"`
IsDeleted bool `json:"is_deleted"`
IsLFSFile bool `json:"is_lfs_file"`
IsRenamed bool `json:"is_renamed"`
IsSubmodule bool `json:"is_submodule"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
Changes int `json:"changes"`
Sha string `json:"sha"`
HTMLURL string `json:"html_url,omitempty"`
ContentsURL string `json:"contents_url,omitempty"`
RawURL string `json:"raw_url,omitempty"`
}

View File

@ -0,0 +1,16 @@
package structs
import "time"
type PullRequestVersion struct {
ID int64 `json:"id"`
AddLineNum int `json:"add_line_num"`
DelLineNum int `json:"del_line_num"`
CommitsCount int `json:"commits_count"`
FilesCount int `json:"files_count"`
BaseCommitSha string `json:"base_commit_sha"`
HeadCommitSha string `json:"head_commit_sha"`
StartCommitSha string `json:"start_commit_sha"`
CreatedAt *time.Time `json:"created_at"`
UpdatedAt *time.Time `json:"updated_at"`
}

View File

@ -0,0 +1,26 @@
package structs
import (
"time"
gitea_api "code.gitea.io/gitea/modules/structs"
)
type Release struct {
ID int64 `json:"id"`
TagName string `json:"tag_name"`
Target string `json:"target_commitish"`
Title string `json:"name"`
Sha string `json:"sha"`
Note string `json:"body"`
URL string `json:"url"`
HTMLURL string `json:"html_url"`
TarURL string `json:"tarball_url"`
ZipURL string `json:"zipball_url"`
IsDraft bool `json:"draft"`
IsPrerelease bool `json:"prerelease"`
CreatedAt time.Time `json:"created_at"`
PublishedAt time.Time `json:"published_at"`
Publisher *gitea_api.User `json:"author"`
Attachments []*gitea_api.Attachment `json:"assets"`
}

View File

@ -0,0 +1,18 @@
package structs
import (
gitea_api "code.gitea.io/gitea/modules/structs"
)
type Branch struct {
*gitea_api.Branch
IsDeleted bool `json:"is_deleted"`
DeletedUnix int `json:"deleted_unix"`
ID int64 `json:"id"`
DeletedBy *BranchDeleteUser `json:"deleted_by"`
}
type BranchDeleteUser struct {
Name string `json:"name"`
Email string `json:"email"`
}

View File

@ -0,0 +1,10 @@
package structs
import (
gitea_api "code.gitea.io/gitea/modules/structs"
)
type Commit struct {
*gitea_api.Commit
Branch string `json:"branch"`
}

View File

@ -0,0 +1,33 @@
package structs
import (
gitea_api "code.gitea.io/gitea/modules/structs"
)
type BatchChangeFileOptions struct {
Header gitea_api.FileOptions `json:"header"`
Files []struct {
Encoding string `json:"encoding"`
FilePath string `json:"file_path"`
Content string `json:"content"`
ActionType string `json:"action_type"`
} `json:"files"`
}
type BatchFileResponse struct {
Contents []*ContentsResponse `json:"contents"`
Commit *gitea_api.FileCommitResponse `json:"commit"`
Verification *gitea_api.PayloadCommitVerification `json:"verification"`
}
type ContentsResponse struct {
*gitea_api.ContentsResponse
IsTextFile bool `json:"is_text_file"`
LatestCommit ContentsResponseCommit `json:"latest_commit"`
}
type ContentsResponseCommit struct {
Message string `json:"message"`
Sha string `json:"sha"`
CreatedAt int64 `json:"created_at"`
}

View File

@ -24,3 +24,8 @@ type TagCommit struct {
Author *gitea_api.CommitUser `json:"author"`
Message string `json:"message"`
}
type RepoBranchAndTagCount struct {
BranchCount int `json:"branch_count"`
TagCount int `json:"tag_count"`
}

View File

@ -1,3 +1,6 @@
# Godot 4+ specific ignores
.godot/
# Godot-specific ignores
.import/
export.cfg
@ -9,3 +12,4 @@ export_presets.cfg
# Mono-specific ignores
.mono/
data_*/
mono_crash.*.json

View File

@ -0,0 +1,70 @@
labels:
- name: "Kind/Bug"
color: ee0701
description: Something is not working
- name: "Kind/Feature"
color: 0288d1
description: New functionality
- name: "Kind/Enhancement"
color: 84b6eb
description: Improve existing functionality
- name: "Kind/Security"
color: 9c27b0
description: This is security issue
- name: "Kind/Testing"
color: 795548
description: Issue or pull request related to testing
- name: "Kind/Breaking"
color: c62828
description: Breaking change that won't be backward compatible
- name: "Kind/Documentation"
color: 37474f
description: Documentation changes
- name: "Reviewed/Duplicate"
exclusive: true
color: 616161
description: This issue or pull request already exists
- name: "Reviewed/Invalid"
exclusive: true
color: 546e7a
description: Invalid issue
- name: "Reviewed/Confirmed"
exclusive: true
color: 795548
description: Issue has been confirmed
- name: "Reviewed/Won't Fix"
exclusive: true
color: eeeeee
description: This issue won't be fixed
- name: "Status/Need More Info"
exclusive: true
color: 424242
description: Feedback is required to reproduce issue or to continue work
- name: "Status/Blocked"
exclusive: true
color: 880e4f
description: Something is blocking this issue or pull request
- name: "Status/Abandoned"
exclusive: true
color: "222222"
description: Somebody has started to work on this but abandoned work
- name: "Priority/Critical"
exclusive: true
color: b71c1c
description: The priority is critical
priority: critical
- name: "Priority/High"
exclusive: true
color: d32f2f
description: The priority is high
priority: high
- name: "Priority/Medium"
exclusive: true
color: e64a19
description: The priority is medium
priority: medium
- name: "Priority/Low"
exclusive: true
color: 4caf50
description: The priority is low
priority: low

View File

@ -1,48 +0,0 @@
AFFERO GENERAL PUBLIC LICENSE
Version 1, March 2002 Copyright © 2002 Affero Inc.
510 Third Street - Suite 225, San Francisco, CA 94107, USA
This license is a modified version of the GNU General Public License copyright (C) 1989, 1991 Free Software Foundation, Inc. made with their permission. Section 2(d) has been added to cover use of software over a computer network.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your freedom to share and change it. By contrast, the Affero General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This Public License applies to most of Affero's software and to any other program whose authors commit to using it. (Some other Affero software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. This General Public License is designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this Affero General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
d) If the Program as you received it is intended to interact with users through a computer network and if, in the version you received, any user interacting with the Program was given the opportunity to request transmission to that user of the Program's complete source code, you must not remove that facility from your modified version of the Program or work based on the Program, and must offer an equivalent opportunity for all users interacting with your Program through a computer network to request immediate transmission by HTTP of the complete source code of your modified version or other derivative work.
These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
9. Affero Inc. may publish revised and/or new versions of the Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by Affero, Inc. If the Program does not specify a version number of this License, you may choose any version ever published by Affero, Inc.
You may also choose to redistribute modified versions of this program under any version of the Free Software Foundation's GNU General Public License version 3 or higher, so long as that version of the GNU GPL includes terms and conditions substantially equivalent to those of this license.
10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by Affero, Inc., write to us; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

View File

@ -0,0 +1,17 @@
ASWF Digital Assets License v1.0
License for <Asset Name> (the "Asset Name").
<Asset Name> Copyright <Year> <Asset Owner>. All rights reserved.
Redistribution and use of these digital assets, with or without modification, solely for education, training, research, software and hardware development, performance benchmarking (including publication of benchmark results and permitting reproducibility of the benchmark results by third parties), or software and hardware product demonstrations, are permitted provided that the following conditions are met:
1. Redistributions of these digital assets or any part of them must include the above copyright notice, this list of conditions and the disclaimer below.
2. Publications showing images derived from these digital assets must include the above copyright notice.
3. The names of copyright holder or the names of its contributors may NOT be used to promote or to imply endorsement, sponsorship, or affiliation with products developed or tested utilizing these digital assets or benchmarking results obtained from these digital assets, without prior written permission from copyright holder.
4. The assets and their output may only be referred to as the Asset Name listed above, and your use of the Asset Name shall be solely to identify the digital assets. Other than as expressly permitted by this License, you may NOT use any trade names, trademarks, service marks, or product names of the copyright holder for any purpose.
DISCLAIMER: THESE DIGITAL ASSETS ARE PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE DIGITAL ASSETS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,17 @@
ASWF Digital Assets License v1.1
License for <Asset Name> (the "Asset Name").
<Asset Name> Copyright <Year> <Asset Owner>. All rights reserved.
Redistribution and use of these digital assets, with or without modification, solely for education, training, research, software and hardware development, performance benchmarking (including publication of benchmark results and permitting reproducibility of the benchmark results by third parties), or software and hardware product demonstrations, are permitted provided that the following conditions are met:
1. Redistributions of these digital assets or any part of them must include the above copyright notice, this list of conditions and the disclaimer below, and if applicable, a description of how the redistributed versions of the digital assets differ from the originals.
2. Publications showing images derived from these digital assets must include the above copyright notice.
3. The names of copyright holder or the names of its contributors may NOT be used to promote or to imply endorsement, sponsorship, or affiliation with products developed or tested utilizing these digital assets or benchmarking results obtained from these digital assets, without prior written permission from copyright holder.
4. The assets and their output may only be referred to as the Asset Name listed above, and your use of the Asset Name shall be solely to identify the digital assets. Other than as expressly permitted by this License, you may NOT use any trade names, trademarks, service marks, or product names of the copyright holder for any purpose.
DISCLAIMER: THESE DIGITAL ASSETS ARE PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THESE DIGITAL ASSETS, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1 @@
This document may be copied, in whole or in part, in any form or by any means, as is or with alterations, provided that (1) alterations are clearly marked as alterations and (2) this copyright notice is included unmodified in any copy.

View File

@ -0,0 +1,5 @@
In addition, when this program is distributed with Asterisk in any
form that would qualify as a 'combined work' or as a 'derivative work'
(but not mere aggregation), you can redistribute and/or modify the
combination under the terms of the license provided with that copy
of Asterisk, instead of the license terms granted here.

View File

@ -0,0 +1,4 @@
As a special exception to the GNU General Public License,
if you distribute this file as part of a program that contains
a configuration script generated by Autoconf, you may include
it under the same distribution terms that you use for the rest of that program.

View File

@ -0,0 +1,6 @@
As a special exception to the GNU General Public License, if you
distribute this file as part of a program that contains a
configuration script generated by Autoconf, you may include it under
the same distribution terms that you use for the rest of that
program. This Exception is an additional permission under section 7
of the GNU General Public License, version 3 ("GPLv3").

View File

@ -0,0 +1,12 @@
As a special exception, the respective Autoconf Macro's copyright owner
gives unlimited permission to copy, distribute and modify the configure
scripts that are the output of Autoconf when processing the Macro. You
need not follow the terms of the GNU General Public License when using
or distributing such scripts, even though portions of the text of the
Macro appear in them. The GNU General Public License (GPL) does govern
all other use of the material that constitutes the Autoconf Macro.
This special exception to the GPL applies to versions of the Autoconf
Macro released by the Autoconf Archive. When you make and distribute a
modified version of the Autoconf Macro, you may extend this special
exception to the GPL to apply to your modified version as well.

View File

@ -1,27 +0,0 @@
The FreeBSD Copyright Copyright 1992-2012 The FreeBSD Project. All rights
reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE FREEBSD PROJECT ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are
those of the authors and should not be interpreted as representing official
policies, either expressed or implied, of the FreeBSD Project.

View File

@ -1,24 +0,0 @@
Copyright (c) 2008 The NetBSD Foundation, Inc. All rights reserved.
This code is derived from software contributed to The NetBSD Foundation by
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,29 @@
Copyright (c) 2001-2013 Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistribution in binary form must reproduct the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of Sun Microsystems, Inc. or the names of
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
This software is provided "AS IS," without a warranty of any kind. ALL
EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND
ITS LICENSORS SHALL NOT BE LIABLE FOR ANY DAMAGES OR LIABILITIES
SUFFERED BY LICENSEE AS A RESULT OF OR RELATING TO USE, MODIFICATION
OR DISTRIBUTION OF THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL
SUN OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA,
OR FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR
PUNITIVE DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF
LIABILITY, ARISING OUT OF THE USE OF OR INABILITY TO USE SOFTWARE,
EVEN IF SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

View File

@ -0,0 +1,9 @@
Copyright (c) 1987 Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms are permitted
provided that this notice is preserved and that due credit is given
to the University of California at Berkeley. The name of the University
may not be used to endorse or promote products derived from this
software without specific written prior permission. This software
is provided ``as is'' without express or implied warranty.

View File

@ -0,0 +1,11 @@
Copyright (c) 1987 Regents of the University of California. All rights reserved.
Redistribution and use in source and binary forms are permitted provided
that the above copyright notice and this paragraph are duplicated in all
such forms and that any documentation, advertising materials, and other
materials related to such distribution and use acknowledge that the software
was developed by the University of California, Berkeley. The name of the
University may not be used to endorse or promote products derived from this
software without specific prior written permission. THIS SOFTWARE IS PROVIDED
``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT
LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

View File

@ -0,0 +1,37 @@
Copyright (c) 2001 David Giffin.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. All advertising materials mentioning features or use of this
software must display the following acknowledgment:
"This product includes software developed by
David Giffin <david@giffin.org>."
4. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes software developed by
David Giffin <david@giffin.org>."
THIS SOFTWARE IS PROVIDED BY DAVID GIFFIN ``AS IS'' AND ANY
EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL DAVID GIFFIN OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -0,0 +1,37 @@
Copyright (c) 1998-2003 Carnegie Mellon University. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The name "Carnegie Mellon University" must not be used to
endorse or promote products derived from this software without
prior written permission. For permission or any other legal
details, please contact
Office of Technology Transfer
Carnegie Mellon University
5000 Forbes Avenue
Pittsburgh, PA 15213-3890
(412) 268-4387, fax: (412) 268-7395
tech-transfer@andrew.cmu.edu
4. Redistributions of any form whatsoever must retain the following
acknowledgment:
"This product includes software developed by Computing Services
at Carnegie Mellon University (http://www.cmu.edu/computing/)."
CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -0,0 +1,39 @@
Copyright (C) 1995, 1996 Systemics Ltd (http://www.systemics.com/)
All rights reserved.
This library and applications are FREE FOR COMMERCIAL AND NON-COMMERCIAL USE
as long as the following conditions are adhered to.
Copyright remains with Systemics Ltd, and as such any Copyright notices
in the code are not to be removed. If this code is used in a product,
Systemics should be given attribution as the author of the parts used.
This can be in the form of a textual message at program startup or
in documentation (online or textual) provided with the package.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software
must display the following acknowledgement:
This product includes software developed by Systemics Ltd (http://www.systemics.com/)
THIS SOFTWARE IS PROVIDED BY SYSTEMICS LTD ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The licence and distribution terms for any publically available version or
derivative of this code cannot be changed. i.e. this code cannot simply be
copied and put under another distribution licence [including the GNU Public Licence.]

View File

@ -0,0 +1,9 @@
(c) Copyright 1989-1992, Bitstream Inc., Cambridge, MA.
You are hereby granted permission under all Bitstream propriety rights
to use, copy, modify, sublicense, sell, and redistribute the 4 Bitstream
Charter (r) Type 1 outline fonts and the 4 Courier Type 1 outline fonts for
any purpose and without restriction; provided, that this notice is left
intact on all copies of such fonts and that Bitstream's trademark is acknowledged
as shown below on all unmodified copies of the 4 Charter Type 1 fonts.
BITSTREAM CHARTER is a registered trademark of Bitstream Inc.

12
options/license/Boehm-GC Normal file
View File

@ -0,0 +1,12 @@
Copyright (c) ...
THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
Permission is hereby granted to use or copy this program
for any purpose, provided the above notices are retained on all copies.
Permission to modify the code and to distribute modified code is granted,
provided the above notices are retained, and a notice that the code was
modified is included with the above copyright notice.
A few files have other copyright holders.

View File

@ -0,0 +1,26 @@
Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved.
LICENSE TERMS
The free distribution and use of this software in both source and binary
form is allowed (with or without changes) provided that:
1. distributions of this source code include the above copyright
notice, this list of conditions and the following disclaimer;
2. distributions in binary form include the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other associated materials;
3. the copyright holder's name is not used to endorse products
built using this software without specific written permission.
ALTERNATIVELY, provided that this notice is retained in full, this product
may be distributed under the terms of the GNU General Public License (GPL),
in which case the provisions of the GPL apply INSTEAD OF those given above.
DISCLAIMER
This software is provided 'as is' with no explicit or implied warranties
in respect of its properties, including, but not limited to, correctness
and/or fitness for purpose.

View File

@ -0,0 +1,101 @@
Creative Commons Attribution 3.0 IGO
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. THE LICENSOR IS NOT NECESSARILY AN INTERGOVERNMENTAL ORGANIZATION (IGO), AS DEFINED IN THE LICENSE BELOW.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("LICENSE"). THE LICENSOR (DEFINED BELOW) HOLDS COPYRIGHT AND OTHER RIGHTS IN THE WORK. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION FOR YOUR ACCEPTANCE AND AGREEMENT TO THE TERMS OF THE LICENSE.
1. Definitions
a. "IGO" means, solely and exclusively for purposes of this License, an organization established by a treaty or other instrument governed by international law and possessing its own international legal personality. Other organizations established to carry out activities across national borders and that accordingly enjoy immunity from legal process are also IGOs for the sole and exclusive purposes of this License. IGOs may include as members, in addition to states, other entities.
b. "Work" means the literary and/or artistic work eligible for copyright protection, whatever may be the mode or form of its expression including digital form, and offered under the terms of this License. It is understood that a database, which by reason of the selection and arrangement of its contents constitutes an intellectual creation, is considered a Work.
c. "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License and may be, but is not necessarily, an IGO.
d. "You" means an individual or entity exercising rights under this License.
e. "Reproduce" means to make a copy of the Work in any manner or form, and by any means.
f. "Distribute" means the activity of making publicly available the Work or Adaptation (or copies of the Work or Adaptation), as applicable, by sale, rental, public lending or any other known form of transfer of ownership or possession of the Work or copy of the Work.
g. "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
h. "Adaptation" means a work derived from or based upon the Work, or upon the Work and other pre-existing works. Adaptations may include works such as translations, derivative works, or any alterations and arrangements of any kind involving the Work. For purposes of this License, where the Work is a musical work, performance, or phonogram, the synchronization of the Work in timed-relation with a moving image is an Adaptation. For the avoidance of doubt, including the Work in a Collection is not an Adaptation.
i. "Collection" means a collection of literary or artistic works or other works or subject matter other than works listed in Section 1(b) which by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. For the avoidance of doubt, a Collection will not be considered as an Adaptation.
2. Scope of this License. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright protection.
3. License Grant. Subject to the terms and conditions of this License, the Licensor hereby grants You a worldwide, royalty-free, non-exclusive license to exercise the rights in the Work as follows:
a. to Reproduce, Distribute and Publicly Perform the Work, to incorporate the Work into one or more Collections, and to Reproduce, Distribute and Publicly Perform the Work as incorporated in the Collections; and,
b. to create, Reproduce, Distribute and Publicly Perform Adaptations, provided that You clearly label, demarcate or otherwise identify that changes were made to the original Work.
c. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
iii. Voluntary License Schemes. To the extent possible, the Licensor waives the right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary licensing scheme.
This License lasts for the duration of the term of the copyright in the Work licensed by the Licensor. The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by the Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work (see section 8(a)). You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from a Licensor You must, to the extent practicable, remove from the Collection any credit (inclusive of any logo, trademark, official mark or official emblem) as required by Section 4(b), as requested. If You create an Adaptation, upon notice from a Licensor You must, to the extent practicable, remove from the Adaptation any credit (inclusive of any logo, trademark, official mark or official emblem) as required by Section 4(b), as requested.
b. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) any attributions that the Licensor indicates be associated with the Work as indicated in a copyright notice, (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that the Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation. The credit required by this Section 4(b) may be implemented in any reasonable manner; provided, however, that in the case of an Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributors to the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Licensor or others designated for attribution, of You or Your use of the Work, without the separate, express prior written permission of the Licensor or such others.
c. Except as otherwise agreed in writing by the Licensor, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the honor or reputation of the Licensor where moral rights apply.
5. Representations, Warranties and Disclaimer
THE LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE.
6. Limitation on Liability
IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. Subject to the terms and conditions set forth in this License, the license granted here lasts for the duration of the term of the copyright in the Work licensed by the Licensor as stated in Section 3. Notwithstanding the above, the Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated below.
b. If You fail to comply with this License, then this License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. Notwithstanding the foregoing, this License reinstates automatically as of the date the violation is cured, provided it is cured within 30 days of You discovering the violation, or upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 7(b) does not affect any rights the Licensor may have to seek remedies for violations of this License by You.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
b. Each time You Distribute or Publicly Perform an Adaptation, the Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
d. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the Licensor.
e. This License constitutes the entire agreement between You and the Licensor with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. The Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). Interpretation of the scope of the rights granted by the Licensor and the conditions imposed on You under this License, this License, and the rights and conditions set forth herein shall be made with reference to copyright as determined in accordance with general principles of international law, including the above mentioned conventions.
g. Nothing in this License constitutes or may be interpreted as a limitation upon or waiver of any privileges and immunities that may apply to the Licensor or You, including immunity from the legal processes of any jurisdiction, national court or other authority.
h. Where the Licensor is an IGO, any and all disputes arising under this License that cannot be settled amicably shall be resolved in accordance with the following procedure:
i. Pursuant to a notice of mediation communicated by reasonable means by either You or the Licensor to the other, the dispute shall be submitted to non-binding mediation conducted in accordance with rules designated by the Licensor in the copyright notice published with the Work, or if none then in accordance with those communicated in the notice of mediation. The language used in the mediation proceedings shall be English unless otherwise agreed.
ii. If any such dispute has not been settled within 45 days following the date on which the notice of mediation is provided, either You or the Licensor may, pursuant to a notice of arbitration communicated by reasonable means to the other, elect to have the dispute referred to and finally determined by arbitration. The arbitration shall be conducted in accordance with the rules designated by the Licensor in the copyright notice published with the Work, or if none then in accordance with the UNCITRAL Arbitration Rules as then in force. The arbitral tribunal shall consist of a sole arbitrator and the language of the proceedings shall be English unless otherwise agreed. The place of arbitration shall be where the Licensor has its headquarters. The arbitral proceedings shall be conducted remotely (e.g., via telephone conference or written submissions) whenever practicable.
iii. Interpretation of this License in any dispute submitted to mediation or arbitration shall be as set forth in Section 8(f), above.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of the Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License.
Creative Commons may be contacted at https://creativecommons.org/.

View File

@ -0,0 +1,85 @@
Creative Commons Namensnennung — Nicht-kommerziell — Weitergabe unter gleichen Bedingungen 2.0
CREATIVE COMMONS IST KEINE RECHTSANWALTSGESELLSCHAFT UND LEISTET KEINE RECHTSBERATUNG. DIE WEITERGABE DIESES LIZENZENTWURFES FÜHRT ZU KEINEM MANDATSVERHÄLTNIS. CREATIVE COMMONS ERBRINGT DIESE INFORMATIONEN OHNE GEWÄHR. CREATIVE COMMONS ÜBERNIMMT KEINE GEWÄHRLEISTUNG FÜR DIE GELIEFERTEN INFORMATIONEN UND SCHLIEßT DIE HAFTUNG FÜR SCHÄDEN AUS, DIE SICH AUS IHREM GEBRAUCH ERGEBEN.
Lizenzvertrag
DAS URHEBERRECHTLICH GESCHÜTZTE WERK ODER DER SONSTIGE SCHUTZGEGENSTAND (WIE UNTEN BESCHRIEBEN) WIRD UNTER DEN BEDINGUNGEN DIESER CREATIVE COMMONS PUBLIC LICENSE („CCPL“ ODER „LIZENZVERTRAG“) ZUR VERFÜGUNG GESTELLT. DER SCHUTZGEGENSTAND IST DURCH DAS URHEBERRECHT UND/ODER EINSCHLÄGIGE GESETZE GESCHÜTZT.
DURCH DIE AUSÜBUNG EINES DURCH DIESEN LIZENZVERTRAG GEWÄHRTEN RECHTS AN DEM SCHUTZGEGENSTAND ERKLÄREN SIE SICH MIT DEN LIZENZBEDINGUNGEN RECHTSVERBINDLICH EINVERSTANDEN. DER LIZENZGEBER RÄUMT IHNEN DIE HIER BESCHRIEBENEN RECHTE UNTER DER VORAUSSETZUNGEIN, DASS SIE SICH MIT DIESEN VERTRAGSBEDINGUNGEN EINVERSTANDEN ERKLÄREN.
1. Definitionen
a. Unter einer „Bearbeitung“ wird eine Übersetzung oder andere Bearbeitung des Werkes verstanden, die Ihre persönliche geistige Schöpfung ist. Eine freie Benutzung des Werkes wird nicht als Bearbeitung angesehen.
b. Unter den „Lizenzelementen“ werden die folgenden Lizenzcharakteristika verstanden, die vom Lizenzgeber ausgewählt und in der Bezeichnung der Lizenz genannt werden: „Namensnennung“, „Nicht-kommerziell“, „Weitergabe unter gleichen Bedingungen“.
c. Unter dem „Lizenzgeber“ wird die natürliche oder juristische Person verstanden, die den Schutzgegenstand unter den Bedingungen dieser Lizenz anbietet.
d. Unter einem „Sammelwerk“ wird eine Sammlung von Werken, Daten oder anderen unabhängigen Elementen verstanden, die aufgrund der Auswahl oder Anordnung der Elemente eine persönliche geistige Schöpfung ist. Darunter fallen auch solche Sammelwerke, deren Elemente systematisch oder methodisch angeordnet und einzeln mit Hilfe elektronischer Mittel oder auf andere Weise zugänglich sind (Datenbankwerke). Ein Sammelwerk wird im Zusammenhang mit dieser Lizenz nicht als Bearbeitung (wie oben beschrieben) angesehen.
e. Mit „SIE“ und „Ihnen“ ist die natürliche oder juristische Person gemeint, die die durch diese Lizenz gewährten Nutzungsrechte ausübt und die zuvor die Bedingungen dieser Lizenz im Hinblick auf das Werk nicht verletzt hat, oder die die ausdrückliche Erlaubnis des Lizenzgebers erhalten hat, die durch diese Lizenz gewährten Nutzungsrechte trotz einer vorherigen Verletzung auszuüben.
f. Unter dem „Schutzgegenstand“wird das Werk oder Sammelwerk oder das Schutzobjekt eines verwandten Schutzrechts, das Ihnen unter den Bedingungen dieser Lizenz angeboten wird, verstanden
g. Unter dem „Urheber“ wird die natürliche Person verstanden, die das Werk geschaffen hat.
h. Unter einem „verwandten Schutzrecht“ wird das Recht an einem anderen urheberrechtlichen Schutzgegenstand als einem Werk verstanden, zum Beispiel einer wissenschaftlichen Ausgabe, einem nachgelassenen Werk, einem Lichtbild, einer Datenbank, einem Tonträger, einer Funksendung, einem Laufbild oder einer Darbietung eines ausübenden Künstlers.
i. Unter dem „Werk“ wird eine persönliche geistige Schöpfung verstanden, die Ihnen unter den Bedingungen dieser Lizenz angeboten wird.
2. Schranken des Urheberrechts. Diese Lizenz lässt sämtliche Befugnisse unberührt, die sich aus den Schranken des Urheberrechts,aus dem Erschöpfungsgrundsatz oder anderen Beschränkungen der Ausschließlichkeitsrechte des Rechtsinhabers ergeben.
3. Lizenzierung. Unter den Bedingungen dieses Lizenzvertrages räumt Ihnen der Lizenzgeber ein lizenzgebührenfreies, räumlich und zeitlich (für die Dauer des Urheberrechts oder verwandten Schutzrechts) unbeschränktes einfaches Nutzungsrecht ein, den Schutzgegenstand in der folgenden Art und Weise zu nutzen:
a. den Schutzgegenstand in körperlicher Form zu verwerten, insbesondere zu vervielfältigen, zu verbreiten und auszustellen;
b. den Schutzgegenstand in unkörperlicher Form öffentlich wiederzugeben, insbesondere vorzutragen, aufzuführen und vorzuführen, öffentlich zugänglich zu machen, zu senden, durch Bild- und Tonträger wiederzugeben sowie Funksendungen und öffentliche Zugänglichmachungen wiederzugeben;
c. den Schutzgegenstand auf Bild- oder Tonträger aufzunehmen, Lichtbilder davon herzustellen, weiterzusenden und in dem in a. und b. genannten Umfang zu verwerten;
d. den Schutzgegenstand zu bearbeiten oder in anderer Weise umzugestalten und die Bearbeitungen zu veröffentlichen und in dem in a. bis c. genannten Umfang zu verwerten;
Die genannten Nutzungsrechte können für alle bekannten Nutzungsarten ausgeübt werden. Die genannten Nutzungsrechte beinhalten das Recht, solche Veränderungen an dem Werk vorzunehmen, die technisch erforderlich sind, um die Nutzungsrechte für alle Nutzungsarten wahrzunehmen. Insbesondere sind davon die Anpassung an andere Medien und auf andere Dateiformate umfasst.
4. Beschränkungen. Die Einräumung der Nutzungsrechte gemäß Ziffer 3 erfolgt ausdrücklich nur unter den folgenden Bedingungen:
a. Sie dürfen den Schutzgegenstand ausschließlich unter den Bedingungen dieser Lizenz vervielfältigen, verbreiten oder öffentlich wiedergeben, und Sie müssen stets eine Kopie oder die vollständige Internetadresse in Form des Uniform-Resource-Identifier (URI) dieser Lizenz beifügen, wenn Sie den Schutzgegenstandvervielfältigen, verbreiten oder öffentlich wiedergeben. Sie dürfen keine Vertragsbedingungen anbieten oder fordern, die die Bedingungen dieser Lizenz oder die durch sie gewährten Rechte ändern oder beschränken. Sie dürfen den Schutzgegenstand nicht unterlizenzieren. Sie müssen alle Hinweise unverändert lassen, die auf diese Lizenz und den Haftungsausschluss hinweisen. Sie dürfen den Schutzgegenstand mit keinen technischen Schutzmaßnahmen versehen, die den Zugang oder den Gebrauch des Schutzgegenstandes in einer Weise kontrollieren, die mit den Bedingungen dieser Lizenz im Widerspruch stehen. Die genannten Beschränkungen gelten auch für den Fall, dass der Schutzgegenstand einen Bestandteil eines Sammelwerkes bildet; sie verlangen aber nicht, dass das Sammelwerk insgesamt zum Gegenstand dieser Lizenz gemacht wird. Wenn Sie ein Sammelwerk erstellen, müssen Sie - soweit dies praktikabel ist - auf die Mitteilung eines Lizenzgebers oder Urhebers hin aus dem Sammelwerk jeglichen Hinweis auf diesen Lizenzgeber oder diesen Urheber entfernen. Wenn Sie den Schutzgegenstand bearbeiten, müssen Sie - soweit dies praktikabel ist- auf die Aufforderung eines Rechtsinhabers hin von der Bearbeitung jeglichen Hinweis auf diesen Rechtsinhaber entfernen.
b. Sie dürfen eine Bearbeitung ausschließlich unter den Bedingungen dieser Lizenz, einer späteren Version dieser Lizenz mit denselben Lizenzelementen wie diese Lizenz oder einer Creative Commons iCommons Lizenz, die dieselben Lizenzelemente wie diese Lizenz enthält (z.B. Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 2.0 Japan), vervielfältigen, verbreiten oder öffentlich wiedergeben. Sie müssen stets eine Kopie oder die Internetadresse in Form des Uniform-Resource-Identifier (URI) dieser Lizenz oder einer anderen Lizenz der im vorhergehenden Satz beschriebenen Art beifügen, wenn Sie die Bearbeitung vervielfältigen, verbreiten oder öffentlich wiedergeben. Sie dürfen keine Vertragsbedingungen anbieten oder fordern, die die Bedingungen dieser Lizenz oder die durch sie gewährten Rechte ändern oder beschränken, und Sie müssen alle Hinweise unverändert lassen, die auf diese Lizenz und den Haftungsausschluss hinweisen. Sie dürfen eine Bearbeitung nicht mit technischen Schutzmaßnahmen versehen, die den Zugang oder den Gebrauch der Bearbeitung in einer Weise kontrollieren, die mit den Bedingungen dieser Lizenz im Widerspruch stehen. Die genannten Beschränkungen gelten auch für eine Bearbeitung als Bestandteil eines Sammelwerkes; sie erfordern aber nicht, dass das Sammelwerk insgesamt zum Gegenstand dieser Lizenz gemacht wird.
c. Sie dürfen die in Ziffer 3 gewährten Nutzungsrechte in keiner Weise verwenden, die hauptsächlich auf einen geschäftlichen Vorteil oder eine vertraglich geschuldete geldwerte Vergütung abzielt oder darauf gerichtet ist. Erhalten Sie im Zusammenhang mit der Einräumung der Nutzungsrechte ebenfalls einen Schutzgegenstand, ohne dass eine vertragliche Verpflichtung hierzu besteht, so wird dies nicht als geschäftlicher Vorteil oder vertraglich geschuldete geldwerte Vergütung angesehen, wenn keine Zahlung oder geldwerte Vergütung in Verbindung mit dem Austausch der Schutzgegenstände geleistet wird (z.B. File-Sharing).
d. Wenn Sie den Schutzgegenstand oder eine Bearbeitung oder ein Sammelwerk vervielfältigen, verbreiten oder öffentlich wiedergeben, müssen Sie alle Urhebervermerke für den Schutzgegenstand unverändert lassen und die Urheberschaft oder Rechtsinhaberschaft in einer der von Ihnen vorgenommenen Nutzung angemessenen Form anerkennen, indem Sie den Namen (oder das Pseudonym, falls ein solches verwendet wird) des Urhebers oder Rechteinhabers nennen, wenn dieser angegeben ist. Dies gilt auch für den Titel des Schutzgegenstandes, wenn dieser angeben ist, sowie - in einem vernünftigerweise durchführbaren Umfang - für die mit dem Schutzgegenstand zu verbindende Internetadresse in Form des Uniform-Resource-Identifier (URI), wie sie der Lizenzgeber angegeben hat, sofern dies geschehen ist, es sei denn, diese Internetadresse verweist nicht auf den Urhebervermerk oder die Lizenzinformationen zu dem Schutzgegenstand. Bei einer Bearbeitung ist ein Hinweis darauf aufzuführen, in welcher Form der Schutzgegenstand in die Bearbeitung eingegangen ist (z.B. „Französische Übersetzung des ... (Werk) durch ... (Urheber)“ oder „Das Drehbuch beruht auf dem Werk des ... (Urheber)“). Ein solcher Hinweis kann in jeder angemessenen Weise erfolgen, wobei jedoch bei einer Bearbeitung, einer Datenbank oder einem Sammelwerk der Hinweis zumindest an gleicher Stelle und in ebenso auffälliger Weise zu erfolgen hat wie vergleichbare Hinweise auf andere Rechtsinhaber.
e. Obwohl die gemäss Ziffer 3 gewährten Nutzungsrechte in umfassender Weise ausgeübt werden dürfen, findet diese Erlaubnis ihre gesetzliche Grenze in den Persönlichkeitsrechten der Urheber und ausübenden Künstler, deren berechtigte geistige und persönliche Interessen bzw. deren Ansehen oder Ruf nicht dadurch gefährdet werden dürfen, dass ein Schutzgegenstand über das gesetzlich zulässige Maß hinaus beeinträchtigt wird.
5. Gewährleistung. Sofern dies von den Vertragsparteien nicht anderweitig schriftlich vereinbart,, bietet der Lizenzgeber keine Gewährleistung für die erteilten Rechte, außer für den Fall, dass Mängel arglistig verschwiegen wurden. Für Mängel anderer Art, insbesondere bei der mangelhaften Lieferung von Verkörperungen des Schutzgegenstandes, richtet sich die Gewährleistung nach der Regelung, die die Person, die Ihnen den Schutzgegenstand zur Verfügung stellt, mit Ihnen außerhalb dieser Lizenz vereinbart, oder - wenn eine solche Regelung nicht getroffen wurde - nach den gesetzlichen Vorschriften.
6. Haftung. Über die in Ziffer 5 genannte Gewährleistung hinaus haftet Ihnen der Lizenzgeber nur für Vorsatz und grobe Fahrlässigkeit.
7. Vertragsende
a. Dieser Lizenzvertrag und die durch ihn eingeräumten Nutzungsrechte enden automatisch bei jeder Verletzung der Vertragsbedingungen durch Sie. Für natürliche und juristische Personen, die von Ihnen eine Bearbeitung, eine Datenbank oder ein Sammelwerk unter diesen Lizenzbedingungen erhalten haben, gilt die Lizenz jedoch weiter, vorausgesetzt, diese natürlichen oder juristischen Personen erfüllen sämtliche Vertragsbedingungen. Die Ziffern 1, 2, 5, 6, 7 und 8 gelten bei einer Vertragsbeendigung fort.
b. Unter den oben genannten Bedingungen erfolgt die Lizenz auf unbegrenzte Zeit (für die Dauer des Schutzrechts). Dennoch behält sich der Lizenzgeber das Recht vor, den Schutzgegenstand unter anderen Lizenzbedingungen zu nutzen oder die eigene Weitergabe des Schutzgegenstandes jederzeit zu beenden, vorausgesetzt, dass solche Handlungen nicht dem Widerruf dieser Lizenz dienen (oder jeder anderen Lizenzierung, die auf Grundlage dieser Lizenz erfolgt ist oder erfolgen muss) und diese Lizenz wirksam bleibt, bis Sie unter den oben genannten Voraussetzungen endet.
8. Schlussbestimmungen
a. Jedes Mal, wenn Sie den Schutzgegenstand vervielfältigen, verbreiten oder öffentlich wiedergeben, bietet der Lizenzgeber dem Erwerber eine Lizenz für den Schutzgegenstand unter denselben Vertragsbedingungen an, unter denen er Ihnen die Lizenz eingeräumt hat.
b. Jedes Mal, wenn Sie eine Bearbeitung vervielfältigen, verbreiten oder öffentlich wiedergeben, bietet der Lizenzgeber dem Erwerber eine Lizenz für den ursprünglichen Schutzgegenstand unter denselben Vertragsbedingungen an, unter denen er Ihnen die Lizenz eingeräumt hat.
c. Sollte eine Bestimmung dieses Lizenzvertrages unwirksam sein, so wird die Wirksamkeit der übrigen Lizenzbestimmungen dadurch nicht berührt, und an die Stelle der unwirksamen Bestimmung tritt eine Ersatzregelung, die dem mit der unwirksamen Bestimmung angestrebten Zweck am nächsten kommt.
d. Nichts soll dahingehend ausgelegt werden, dass auf eine Bestimmung dieses Lizenzvertrages verzichtet oder einer Vertragsverletzung zugestimmt wird, so lange ein solcher Verzicht oder eine solche Zustimmung nicht schriftlich vorliegen und von der verzichtenden oder zustimmenden Vertragspartei unterschrieben sind
e. Dieser Lizenzvertrag stellt die vollständige Vereinbarung zwischen den Vertragsparteien hinsichtlich des Schutzgegenstandes dar. Es gibt keine weiteren ergänzenden Vereinbarungen oder mündlichen Abreden im Hinblick auf den Schutzgegenstand. Der Lizenzgeber ist an keine zusätzlichen Abreden gebunden, die aus irgendeiner Absprache mit Ihnen entstehen könnten. Der Lizenzvertrag kann nicht ohne eine übereinstimmende schriftliche Vereinbarung zwischen dem Lizenzgeber und Ihnen abgeändert werden.
f. Auf diesen Lizenzvertrag findet das Recht der Bundesrepublik Deutschland Anwendung.
CREATIVE COMMONS IST KEINE VERTRAGSPARTEI DIESES LIZENZVERTRAGES UND ÜBERNIMMT KEINERLEI GEWÄHRLEISTUNG FÜR DAS WERK. CREATIVE COMMONS IST IHNEN ODER DRITTEN GEGENÜBER NICHT HAFTBAR FÜR SCHÄDEN JEDWEDER ART. UNGEACHTET DER VORSTEHENDEN ZWEI (2) SÄTZE HAT CREATIVE COMMONS ALL RECHTE UND PFLICHTEN EINES LIZENSGEBERS, WENN SICH CREATIVE COMMONS AUSDRÜCKLICH ALS LIZENZGEBER BEZEICHNET.
AUSSER FÜR DEN BESCHRÄNKTEN ZWECK EINES HINWEISES AN DIE ÖFFENTLICHKEIT, DASS DAS WERK UNTER DER CCPL LIZENSIERT WIRD, DARF KENIE VERTRAGSPARTEI DIE MARKE “CREATIVE COMMONS” ODER EINE ÄHNLICHE MARKE ODER DAS LOGO VON CREATIVE COMMONS OHNE VORHERIGE GENEHMIGUNG VON CREATIVE COMMONS NUTZEN. JEDE GESTATTETE NUTZUNG HAT IN ÜBREEINSTIMMUNG MIT DEN JEWEILS GÜLTIGEN NUTZUNGSBEDINGUNGEN FÜR MARKEN VON CREATIVE COMMONS ZU ERFOLGEN, WIE SIE AUF DER WEBSITE ODER IN ANDERER WEISE AUF ANFRAGE VON ZEIT ZU ZEIT ZUGÄNGLICH GEMACHT WERDEN.
CREATIVE COMMONS KANN UNTER https://creativecommons.org KONTAKTIERT WERDEN.

View File

@ -0,0 +1,107 @@
Creative Commons Attribution-ShareAlike 3.0 IGO
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM ITS USE. THE LICENSOR IS NOT NECESSARILY AN INTERGOVERNMENTAL ORGANIZATION (IGO), AS DEFINED IN THE LICENSE BELOW.
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("LICENSE"). THE LICENSOR (DEFINED BELOW) HOLDS COPYRIGHT AND OTHER RIGHTS IN THE WORK. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION FOR YOUR ACCEPTANCE AND AGREEMENT TO THE TERMS OF THE LICENSE.
1. Definitions
a. "IGO" means, solely and exclusively for purposes of this License, an organization established by a treaty or other instrument governed by international law and possessing its own international legal personality. Other organizations established to carry out activities across national borders and that accordingly enjoy immunity from legal process are also IGOs for the sole and exclusive purposes of this License. IGOs may include as members, in addition to states, other entities.
b. "Work" means the literary and/or artistic work eligible for copyright protection, whatever may be the mode or form of its expression including digital form, and offered under the terms of this License. It is understood that a database, which by reason of the selection and arrangement of its contents constitutes an intellectual creation, is considered a Work.
c. "Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License and may be, but is not necessarily, an IGO.
d. "You" means an individual or entity exercising rights under this License.
e. "License Elements" means the following high-level license attributes as selected by the Licensor and indicated in the title of this License: Attribution, ShareAlike.
f. "Reproduce" means to make a copy of the Work in any manner or form, and by any means.
g. "Distribute" means the activity of making publicly available the Work or Adaptation (or copies of the Work or Adaptation), as applicable, by sale, rental, public lending or any other known form of transfer of ownership or possession of the Work or copy of the Work.
h. "Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
i. "Adaptation" means a work derived from or based upon the Work, or upon the Work and other pre-existing works. Adaptations may include works such as translations, derivative works, or any alterations and arrangements of any kind involving the Work. For purposes of this License, where the Work is a musical work, performance, or phonogram, the synchronization of the Work in timed-relation with a moving image is an Adaptation. For the avoidance of doubt, including the Work in a Collection is not an Adaptation.
j. "Collection" means a collection of literary or artistic works or other works or subject matter other than works listed in Section 1(b) which by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. For the avoidance of doubt, a Collection will not be considered as an Adaptation.
k. "Creative Commons Compatible License" means a license that is listed at https://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License.
2. Scope of this License. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright protection.
3. License Grant. Subject to the terms and conditions of this License, the Licensor hereby grants You a worldwide, royalty-free, non-exclusive license to exercise the rights in the Work as follows:
a. to Reproduce, Distribute and Publicly Perform the Work, to incorporate the Work into one or more Collections, and to Reproduce, Distribute and Publicly Perform the Work as incorporated in the Collections; and,
b. to create, Reproduce, Distribute and Publicly Perform Adaptations, provided that You clearly label, demarcate or otherwise identify that changes were made to the original Work.
c. For the avoidance of doubt:
i. Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
ii. Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
ii. Voluntary License Schemes. To the extent possible, the Licensor waives the right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary licensing scheme.
This License lasts for the duration of the term of the copyright in the Work licensed by the Licensor. The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by the Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
a. You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work (see section 8(a)). You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from a Licensor You must, to the extent practicable, remove from the Collection any credit (inclusive of any logo, trademark, official mark or official emblem) as required by Section 4(c), as requested. If You create an Adaptation, upon notice from a Licensor You must, to the extent practicable, remove from the Adaptation any credit (inclusive of any logo, trademark, official mark or official emblem) as required by Section 4(c), as requested.
b. You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) either the unported Creative Commons license or a ported Creative Commons license (either this or a later license version) containing the same License Elements; or (iv) a Creative Commons Compatible License. If You license the Adaptation under one of the licenses mentioned in (iv), You must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), You must comply with terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform. (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License. (III) You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform. (IV) When You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License.
c. If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) any attributions that the Licensor indicates be associated with the Work as indicated in a copyright notice, (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that the Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and, (iv) consistent with Section 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation. The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of an Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributors to the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Licensor or others designated for attribution, of You or Your use of the Work, without the separate, express prior written permission of the Licensor or such others.
d. Except as otherwise agreed in writing by the Licensor, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the honor or reputation of the Licensor where moral rights apply.
5. Representations, Warranties and Disclaimer
THE LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE.
6. Limitation on Liability
IN NO EVENT WILL THE LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
a. Subject to the terms and conditions set forth in this License, the license granted here lasts for the duration of the term of the copyright in the Work licensed by the Licensor as stated in Section 3. Notwithstanding the above, the Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated below.
b. If You fail to comply with this License, then this License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License. Notwithstanding the foregoing, this License reinstates automatically as of the date the violation is cured, provided it is cured within 30 days of You discovering the violation, or upon express reinstatement by the Licensor. For the avoidance of doubt, this Section 7(b) does not affect any rights the Licensor may have to seek remedies for violations of this License by You.
8. Miscellaneous
a. Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
b. Each time You Distribute or Publicly Perform an Adaptation, the Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
c. If any provision of this License is invalid or unenforceable, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
d. No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the Licensor.
e. This License constitutes the entire agreement between You and the Licensor with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. The Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
f. The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). Interpretation of the scope of the rights granted by the Licensor and the conditions imposed on You under this License, this License, and the rights and conditions set forth herein shall be made with reference to copyright as determined in accordance with general principles of international law, including the above mentioned conventions.
g. Nothing in this License constitutes or may be interpreted as a limitation upon or waiver of any privileges and immunities that may apply to the Licensor or You, including immunity from the legal processes of any jurisdiction, national court or other authority.
h. Where the Licensor is an IGO, any and all disputes arising under this License that cannot be settled amicably shall be resolved in accordance with the following procedure:
i. Pursuant to a notice of mediation communicated by reasonable means by either You or the Licensor to the other, the dispute shall be submitted to non-binding mediation conducted in accordance with rules designated by the Licensor in the copyright notice published with the Work, or if none then in accordance with those communicated in the notice of mediation. The language used in the mediation proceedings shall be English unless otherwise agreed.
ii. If any such dispute has not been settled within 45 days following the date on which the notice of mediation is provided, either You or the Licensor may, pursuant to a notice of arbitration communicated by reasonable means to the other, elect to have the dispute referred to and finally determined by arbitration. The arbitration shall be conducted in accordance with the rules designated by the Licensor in the copyright notice published with the Work, or if none then in accordance with the UNCITRAL Arbitration Rules as then in force. The arbitral tribunal shall consist of a sole arbitrator and the language of the proceedings shall be English unless otherwise agreed. The place of arbitration shall be where the Licensor has its headquarters. The arbitral proceedings shall be conducted remotely (e.g., via telephone conference or written submissions) whenever practicable.
iii. Interpretation of this License in any dispute submitted to mediation or arbitration shall be as set forth in Section 8(f), above.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of the Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of this License.
Creative Commons may be contacted at https://creativecommons.org/.

7
options/license/CFITSIO Normal file
View File

@ -0,0 +1,7 @@
Copyright (Unpublished-all rights reserved under the copyright laws of the United States), U.S. Government as represented by the Administrator of the National Aeronautics and Space Administration. No copyright is claimed in the United States under Title 17, U.S. Code.
Permission to freely use, copy, modify, and distribute this software and its documentation without fee is hereby granted, provided that this copyright notice and disclaimer of warranty appears in all copies.
DISCLAIMER:
THE SOFTWARE IS PROVIDED 'AS IS' WITHOUT ANY WARRANTY OF ANY KIND, EITHER EXPRESSED, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTY THAT THE SOFTWARE WILL CONFORM TO SPECIFICATIONS, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND FREEDOM FROM INFRINGEMENT, AND ANY WARRANTY THAT THE DOCUMENTATION WILL CONFORM TO THE SOFTWARE, OR ANY WARRANTY THAT THE SOFTWARE WILL BE ERROR FREE. IN NO EVENT SHALL NASA BE LIABLE FOR ANY DAMAGES, INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES, ARISING OUT OF, RESULTING FROM, OR IN ANY WAY CONNECTED WITH THIS SOFTWARE, WHETHER OR NOT BASED UPON WARRANTY, CONTRACT, TORT , OR OTHERWISE, WHETHER OR NOT INJURY WAS SUSTAINED BY PERSONS OR PROPERTY OR OTHERWISE, AND WHETHER OR NOT LOSS WAS SUSTAINED FROM, OR AROSE OUT OF THE RESULTS OF, OR USE OF, THE SOFTWARE OR SERVICES PROVIDED HEREUNDER."

22
options/license/CMU-Mach Normal file
View File

@ -0,0 +1,22 @@
Copyright (c) 1991,1990,1989 Carnegie Mellon University
All Rights Reserved.
Permission to use, copy, modify and distribute this software and its
documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation.
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
Carnegie Mellon requests users of this software to return to
Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
School of Computer Science
Carnegie Mellon University
Pittsburgh PA 15213-3890
any improvements or extensions that they make and grant Carnegie Mellon
the rights to redistribute these changes.

15
options/license/Clips Normal file
View File

@ -0,0 +1,15 @@
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, and/or sell copies of the Software, and to permit persons
to whom the Software is furnished to do so.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -0,0 +1,20 @@
Copyright (c) 1993 Cornell University, Kongji Huang
All rights reserved.
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without written
agreement is hereby granted, provided that the above copyright notice
and the following two paragraphs appear in all copies of this
software.
IN NO EVENT SHALL THE CORNELL UNIVERSITY BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF CORNELL
UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THE CORNELL UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND CORNELL UNIVERSITY HAS
NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
OR MODIFICATIONS.

View File

@ -1,5 +1,5 @@
Copyright (C) 1995-2009 Gerd Neugebauer
cwpuzzle.dtx is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing.
.
Everyone is granted permission to copy, modify and redistribute cwpuzzle.dtx, provided this copyright notice is preserved and any modifications are indicated.

View File

@ -0,0 +1,25 @@
DL-DE->Zero-2.0
Datenlizenz Deutschland Zero Version 2.0
Jede Nutzung ist ohne Einschränkungen oder Bedingungen zulässig.
Die bereitgestellten Daten und Metadaten dürfen für die kommerzielle und nicht kommerzielle Nutzung insbesondere
vervielfältigt, ausgedruckt, präsentiert, verändert, bearbeitet sowie an Dritte übermittelt werden;
mit eigenen Daten und Daten Anderer zusammengeführt und zu selbständigen neuen Datensätzen verbunden werden;
in interne und externe Geschäftsprozesse, Produkte und Anwendungen in öffentlichen und nicht öffentlichen elektronischen Netzwerken eingebunden werden.
Data licence Germany Zero version 2.0
Any use is permitted without restrictions or conditions.
The data and meta-data provided may, for commercial and non-commercial use, in particular
be copied, printed, presented, altered, processed and transmitted to third parties;
be merged with own data and with the data of others and be combined to form new and independent datasets;
be integrated in internal and external business processes, products and applications in public and non-public electronic networks.
URL: https://www.govdata.de/dl-de/zero-2-0

6
options/license/FBM Normal file
View File

@ -0,0 +1,6 @@
Portions of this code Copyright (C) 1989 by Michael Mauldin.
Permission is granted to use this file in whole or in
part for any purpose, educational, recreational or commercial,
provided that this copyright notice is retained unchanged.
This software is available to all free of charge by anonymous
FTP and in the UUNET archives.

11
options/license/FSFULLRWD Normal file
View File

@ -0,0 +1,11 @@
Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
This Makefile.in is free software; the Free Software Foundation
gives unlimited permission to copy and/or distribute it,
with or without modifications, as long as this notice is preserved.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY, to the extent permitted by law; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

View File

@ -5,5 +5,3 @@ Fair License
Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument.
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
[2004, Fair License: rhid.com/fair (this URL no longer works)]

View File

@ -0,0 +1,15 @@
The author hereby grants a perpetual license to everybody to
use this code for any purpose as long as the copyright message is included
in the source code of this or any derived work.
Yes, this means that you, your company, your club, and anyone else
can use this code anywhere you want. You can change it and distribute it
under the GPL, include it in your commercial product without releasing
the source code, put it on the web, etc.
The only thing you cannot do is remove my copyright message,
or distribute any source code based on this implementation that does not
include my copyright message.
I appreciate a mention in the documentation or credits,
but I understand if that is difficult to do.
I also appreciate it if you tell me where and why you used my code.

View File

@ -0,0 +1,6 @@
As a special exception, if other files instantiate generics from this
unit, or you link this unit with other files to produce an executable,
this unit does not by itself cause the resulting executable to be
covered by the GNU General Public License. This exception does not
however invalidate any other reasons why the executable file might be
covered by the GNU Public License.

Some files were not shown because too many files have changed in this diff Show More