forked from Gitlink/forgeplus
Compare commits
376 Commits
hh_dev_tru
...
standalone
| Author | SHA1 | Date |
|---|---|---|
|
|
8bfe421eaa | |
|
|
f2bee32eec | |
|
|
21de628c11 | |
|
|
0fc00da95f | |
|
|
41022950a5 | |
|
|
a7caca7210 | |
|
|
d9e4f26819 | |
|
|
6782380ff7 | |
|
|
683c00a73e | |
|
|
74a7bc62ea | |
|
|
a5e5dbb6bf | |
|
|
da30ba189c | |
|
|
b5047392a6 | |
|
|
5b19a333ef | |
|
|
401798ebdd | |
|
|
cd9a454a80 | |
|
|
24ec039895 | |
|
|
43d125100d | |
|
|
fdcf450eab | |
|
|
94d5565f56 | |
|
|
9ffe10bd5b | |
|
|
748e8cc92a | |
|
|
c52f40adbd | |
|
|
3ce8723de2 | |
|
|
dbe47dbddf | |
|
|
bd9759a3ed | |
|
|
7d98bd0bbe | |
|
|
9157bc3eb9 | |
|
|
88a7456300 | |
|
|
dbdd2e2dd3 | |
|
|
d54dcb6b67 | |
|
|
8252cb7e71 | |
|
|
62e8cf76b9 | |
|
|
33a5b7f4f9 | |
|
|
d58d4136ad | |
|
|
fddd466907 | |
|
|
ff97daac54 | |
|
|
2d4f083164 | |
|
|
0885b7d75d | |
|
|
1dcc38f617 | |
|
|
0d60e58304 | |
|
|
1b87a7a733 | |
|
|
21af31f23c | |
|
|
490ce7a234 | |
|
|
d176508010 | |
|
|
73f558d7c3 | |
|
|
4567c32b97 | |
|
|
9899a8aab6 | |
|
|
37e5e6d547 | |
|
|
a4ee529216 | |
|
|
da3625a0a8 | |
|
|
6f5f42c23a | |
|
|
3c44ffe7df | |
|
|
4ebb6a5e74 | |
|
|
c5a0d025cc | |
|
|
a8972276ec | |
|
|
2a09fadf71 | |
|
|
ffa0715374 | |
|
|
79b394d291 | |
|
|
5cbe83f9d4 | |
|
|
7030e0b5bc | |
|
|
94a6cd96c6 | |
|
|
98a45eb05c | |
|
|
00100e59c4 | |
|
|
018745c062 | |
|
|
1198830422 | |
|
|
3d8b19fa73 | |
|
|
8ba1198b4a | |
|
|
01377bc20a | |
|
|
976c4b26c3 | |
|
|
da960a916e | |
|
|
2587ccea28 | |
|
|
d5e9005253 | |
|
|
f01bfe6435 | |
|
|
1f451779de | |
|
|
fb25eb87d7 | |
|
|
1fa44535bb | |
|
|
c4c3a451c8 | |
|
|
ac6aa7559d | |
|
|
829e36cfce | |
|
|
fb73fa458c | |
|
|
7c8843fda7 | |
|
|
a1cbd8aa30 | |
|
|
0bdbc09ec0 | |
|
|
301f82f84d | |
|
|
48b5117062 | |
|
|
350502b499 | |
|
|
40654061ce | |
|
|
3325ec842d | |
|
|
ad3e1c706b | |
|
|
a22327d0df | |
|
|
6e653f768a | |
|
|
46ab55d50f | |
|
|
f957b6f95e | |
|
|
9d5503f09f | |
|
|
76183344bc | |
|
|
588850440e | |
|
|
9685c97177 | |
|
|
689f265858 | |
|
|
f7ba082944 | |
|
|
59fe010fdb | |
|
|
aabfaad458 | |
|
|
b07781a514 | |
|
|
c1db02171a | |
|
|
69b8e0710c | |
|
|
194a2f4e36 | |
|
|
520b0ef1be | |
|
|
bd1cd7ee13 | |
|
|
d1f5c32f68 | |
|
|
c9bd81af4e | |
|
|
c39990fff3 | |
|
|
cae59383b4 | |
|
|
1d0255440a | |
|
|
f013ddcb72 | |
|
|
24e77300ad | |
|
|
46a083239b | |
|
|
133713ae7f | |
|
|
ab6b597d7b | |
|
|
33473eecc2 | |
|
|
bbcca413c6 | |
|
|
206bba1c49 | |
|
|
ec22124004 | |
|
|
6466ef523b | |
|
|
333d6a8ea4 | |
|
|
af7488505d | |
|
|
91feb8cf89 | |
|
|
1c3ca34efc | |
|
|
4841943419 | |
|
|
60720c309f | |
|
|
fdbc657846 | |
|
|
317205d185 | |
|
|
a825271a36 | |
|
|
14949c0bfd | |
|
|
4f3dc2b627 | |
|
|
88d29ebe33 | |
|
|
be5b3864cd | |
|
|
fae1df9e65 | |
|
|
c9a902d416 | |
|
|
3a22ece871 | |
|
|
04207595d8 | |
|
|
6b68ea998d | |
|
|
1c27e9ccd8 | |
|
|
5b16138c5a | |
|
|
e5199425ee | |
|
|
53212975f1 | |
|
|
0581c59a84 | |
|
|
d957e0544f | |
|
|
a910b11860 | |
|
|
d13006ca09 | |
|
|
a2ae8f1630 | |
|
|
74a4b499a9 | |
|
|
12681b0842 | |
|
|
9a7a5ca3a1 | |
|
|
18b0c76082 | |
|
|
228becfe07 | |
|
|
76268c4952 | |
|
|
08de4819d7 | |
|
|
a5861ce1d6 | |
|
|
41d04e9e99 | |
|
|
a1679cfc53 | |
|
|
dbcbc01251 | |
|
|
b8a52107a5 | |
|
|
cb76a946ef | |
|
|
88bc5f29ff | |
|
|
91e6e0384e | |
|
|
8a02981a2e | |
|
|
fa0021b504 | |
|
|
65af40c29b | |
|
|
ca4f416f0a | |
|
|
91676492ab | |
|
|
a8c75f3b20 | |
|
|
a0b6041394 | |
|
|
8ad087820e | |
|
|
465a3a67a5 | |
|
|
877a20350d | |
|
|
86d634d94f | |
|
|
0cbfc895ca | |
|
|
2fab120118 | |
|
|
39806c7811 | |
|
|
8c60ce1d76 | |
|
|
629729436c | |
|
|
00ed177089 | |
|
|
e594c72c43 | |
|
|
26c0d36227 | |
|
|
ac30cfd7b8 | |
|
|
29ec3bed09 | |
|
|
c82635f6c3 | |
|
|
cd569f4b8a | |
|
|
96c79ffade | |
|
|
4c41d50506 | |
|
|
02f8e453f1 | |
|
|
6d581de018 | |
|
|
90ace8b753 | |
|
|
7549557a62 | |
|
|
36adfcf016 | |
|
|
f5ffd978ac | |
|
|
e38539445d | |
|
|
67d4544d6b | |
|
|
d5de6aa66b | |
|
|
3e8df9316c | |
|
|
b0d22b3053 | |
|
|
84aed0391a | |
|
|
74a9743bcc | |
|
|
30e4ab98db | |
|
|
86c98a1716 | |
|
|
143e88593f | |
|
|
cb1d77ee6d | |
|
|
468c1a31ab | |
|
|
7c86779c37 | |
|
|
9926bff60d | |
|
|
0672a714a0 | |
|
|
e9915cb654 | |
|
|
784521e58a | |
|
|
e93873c3d4 | |
|
|
635f572907 | |
|
|
a422aa638d | |
|
|
c52458a7e3 | |
|
|
5b7f8e8da6 | |
|
|
39dbadeec9 | |
|
|
48f66f345c | |
|
|
039779339a | |
|
|
99e3aaf780 | |
|
|
7d12a25088 | |
|
|
40c6425aee | |
|
|
c50f9ef28d | |
|
|
7e8e3e1b39 | |
|
|
f1586c320b | |
|
|
4cb71179fd | |
|
|
fe7dfcea52 | |
|
|
d1246b8e30 | |
|
|
8832114805 | |
|
|
85d1aa3a85 | |
|
|
0f57844106 | |
|
|
b9bf3fb5ff | |
|
|
c9e265f95c | |
|
|
cf8278ee5e | |
|
|
ccd477e519 | |
|
|
7d26fba3c0 | |
|
|
5637001b16 | |
|
|
8c11759b6c | |
|
|
65e5420246 | |
|
|
598beedc7b | |
|
|
fbede59261 | |
|
|
f03182c771 | |
|
|
68712f9b4c | |
|
|
43add36d29 | |
|
|
c3b9d2e0b5 | |
|
|
4d7d587419 | |
|
|
c8b21f818d | |
|
|
23b8342283 | |
|
|
299e8534d1 | |
|
|
3caa751d4d | |
|
|
eafc8ea527 | |
|
|
f996525e8e | |
|
|
486ed960ca | |
|
|
8a90162ac6 | |
|
|
258272d439 | |
|
|
8b809fb813 | |
|
|
e8496e77dc | |
|
|
155f288c81 | |
|
|
0f45e8f44b | |
|
|
d7362925f2 | |
|
|
43945b00b8 | |
|
|
b11d515ec6 | |
|
|
495d7773fe | |
|
|
9425d2e59d | |
|
|
0654f81565 | |
|
|
ede2f7199a | |
|
|
ea98528100 | |
|
|
6f010d992d | |
|
|
ffb58b788a | |
|
|
a53367b7eb | |
|
|
63fccd03f8 | |
|
|
07a38ac3f7 | |
|
|
18227c232b | |
|
|
eb56c34c41 | |
|
|
f1d79e4d9f | |
|
|
20e2e22be5 | |
|
|
27e5febef2 | |
|
|
c748f4eaed | |
|
|
bfef459b75 | |
|
|
eeb69daff1 | |
|
|
4b8bb8a65f | |
|
|
4d6ec8088a | |
|
|
264a831a1c | |
|
|
8b53aac8a6 | |
|
|
cb1a4d8c8c | |
|
|
ebc4305ca8 | |
|
|
fb23e733d6 | |
|
|
512bff426d | |
|
|
8905f60265 | |
|
|
671c2c2257 | |
|
|
c6f2021017 | |
|
|
f334864f1b | |
|
|
f5e07ab3ec | |
|
|
fcc7736c34 | |
|
|
581b147b3c | |
|
|
deebfc3292 | |
|
|
6c4d17bed8 | |
|
|
e68c13f1a2 | |
|
|
0db334217e | |
|
|
32fe6958df | |
|
|
15eb1f4a17 | |
|
|
a1cb9a11d6 | |
|
|
e4fda9243b | |
|
|
0884a0de1b | |
|
|
900fdd2691 | |
|
|
aeaa5d4366 | |
|
|
d4b9881f2d | |
|
|
a543c3e08f | |
|
|
998381585a | |
|
|
2ddf1dbd01 | |
|
|
fd3fab99ae | |
|
|
4520055de2 | |
|
|
193d1b21df | |
|
|
de2b54c39e | |
|
|
ed8e079595 | |
|
|
4929734a1a | |
|
|
55a0bcfb82 | |
|
|
8f1aa3f4b1 | |
|
|
1c6d8fc2f3 | |
|
|
d271a684fa | |
|
|
b054094798 | |
|
|
2d648e516e | |
|
|
34c3a83df4 | |
|
|
71e039efb8 | |
|
|
9ac21938e6 | |
|
|
fa8594d2ab | |
|
|
3614f3e15b | |
|
|
7c23b40661 | |
|
|
ff21916f18 | |
|
|
d9162cb3bf | |
|
|
e76d475fef | |
|
|
1392024657 | |
|
|
ca1fd3cd4f | |
|
|
b45ab12279 | |
|
|
c3bc4166d9 | |
|
|
16ea03dcc8 | |
|
|
6f19093dc2 | |
|
|
fa8f1155f5 | |
|
|
e31176c696 | |
|
|
fc60278f9a | |
|
|
b59376d3e3 | |
|
|
c5d73b7cf8 | |
|
|
b012740195 | |
|
|
0f79238f0e | |
|
|
fdfbf505ed | |
|
|
a7695b16a4 | |
|
|
1a0fd38d15 | |
|
|
8a10a183e0 | |
|
|
5eaaf0070f | |
|
|
aeeaedbd7a | |
|
|
6d1bcabd51 | |
|
|
b0b224fe76 | |
|
|
57d9da002e | |
|
|
60b22b3912 | |
|
|
86f03ffafc | |
|
|
b161b66d79 | |
|
|
8a536e83af | |
|
|
016cf648da | |
|
|
713e0bba18 | |
|
|
3af75e1a1c | |
|
|
0852d0ac61 | |
|
|
ee5090de96 | |
|
|
37005342ab | |
|
|
9591c0a82a | |
|
|
ffee782591 | |
|
|
c55c04b137 | |
|
|
049e5a6d5f | |
|
|
be6bb690d2 | |
|
|
7c2aa2209d | |
|
|
a56ee23224 | |
|
|
fc95fe9b82 | |
|
|
838fd8b4c9 | |
|
|
8ca1311626 | |
|
|
869750e774 |
|
|
@ -37,13 +37,11 @@ public/react/yarn.lock
|
|||
|
||||
# Ignore react node_modules
|
||||
public/system/*
|
||||
public/react/*
|
||||
/public/react/.cache
|
||||
/public/react/node_modules/
|
||||
/public/react/config/stats.json
|
||||
/public/react/stats.json
|
||||
/public/react/.idea/*
|
||||
/public/react/build/*
|
||||
/public/h5build
|
||||
/public/npm-debug.log
|
||||
|
||||
|
|
@ -74,6 +72,7 @@ vendor/bundle/
|
|||
/log
|
||||
/public/admin
|
||||
/mysql_data
|
||||
/public/repo/
|
||||
|
||||
|
||||
.generators
|
||||
|
|
@ -85,3 +84,4 @@ redis_data/
|
|||
Dockerfile
|
||||
dump.rdb
|
||||
.tags*
|
||||
ceshi_user.xlsx
|
||||
|
|
@ -1,529 +0,0 @@
|
|||
import React, {Component} from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import {LocaleProvider} from 'antd'
|
||||
import zhCN from 'antd/lib/locale-provider/zh_CN';
|
||||
import {
|
||||
BrowserRouter as Router,
|
||||
Route,
|
||||
Switch
|
||||
} from 'react-router-dom';
|
||||
import axios from 'axios';
|
||||
import '@icedesign/base/dist/ICEDesignBase.css';
|
||||
|
||||
import '@icedesign/base/index.scss';
|
||||
|
||||
import LoginDialog from './modules/login/LoginDialog';
|
||||
import Notcompletedysl from './modules/user/Notcompletedysl';
|
||||
import Trialapplicationysl from './modules/login/Trialapplicationysl';
|
||||
import Trialapplicationreview from './modules/user/Trialapplicationreview';
|
||||
import Addcourses from "./modules/courses/coursesPublic/Addcourses";
|
||||
import AccountProfile from"./modules/user/AccountProfile";
|
||||
|
||||
|
||||
import Trialapplication from './modules/login/Trialapplication'
|
||||
|
||||
import NotFoundPage from './NotFoundPage'
|
||||
|
||||
import Loading from './Loading'
|
||||
|
||||
import Loadable from 'react-loadable';
|
||||
|
||||
|
||||
import moment from 'moment'
|
||||
|
||||
import {MuiThemeProvider, createMuiTheme} from 'material-ui/styles';
|
||||
|
||||
// import './AppConfig'
|
||||
|
||||
import history from './history';
|
||||
|
||||
import {SnackbarHOC} from 'educoder'
|
||||
import {initAxiosInterceptors} from './AppConfig'
|
||||
|
||||
|
||||
// !!!tpi需要这个来加载css
|
||||
import {TPMIndexHOC} from './modules/tpm/TPMIndexHOC';
|
||||
|
||||
|
||||
const theme = createMuiTheme({
|
||||
palette: {
|
||||
primary: {
|
||||
main: '#4CACFF',
|
||||
contrastText: 'rgba(255, 255, 255, 0.87)'
|
||||
},
|
||||
secondary: {main: '#4CACFF'}, // #11cb5f This is just green.A700 as hex.
|
||||
},
|
||||
});
|
||||
//
|
||||
// const Trialapplication= Loadable({
|
||||
// loader: () =>import('./modules/login/Trialapplication'),
|
||||
// loading:Loading,
|
||||
// })
|
||||
//登入
|
||||
const EducoderLogin = Loadable({
|
||||
loader: () => import('./modules/login/EducoderLogin'),
|
||||
loading: Loading,
|
||||
})
|
||||
const TestIndex = Loadable({
|
||||
loader: () => import('./modules/test'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
const IndexWrapperComponent = Loadable({
|
||||
loader: () => import('./modules/page/IndexWrapper'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
const CommentComponent = Loadable({
|
||||
loader: () => import('./modules/comment/CommentContainer'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
const TestMaterialDesignComponent = Loadable({
|
||||
loader: () => import('./modules/test/md/TestMaterialDesign'),
|
||||
loading: Loading,
|
||||
})
|
||||
const TestCodeMirrorComponent = Loadable({
|
||||
loader: () => import('./modules/test/codemirror/TestCodeMirror'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
const TestComponent = Loadable({
|
||||
loader: () => import('./modules/test/TestRC'),
|
||||
loading: Loading,
|
||||
})
|
||||
const TestUrlQueryComponent = Loadable({
|
||||
loader: () => import('./modules/test/urlquery/TestUrlQuery'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
const TPMIndexComponent = Loadable({
|
||||
loader: () => import('./modules/tpm/TPMIndex'),
|
||||
loading: Loading,
|
||||
})
|
||||
const TPMShixunsIndexComponent = Loadable({
|
||||
loader: () => import('./modules/tpm/shixuns/ShixunsIndex'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
//实训课程(原实训路径)
|
||||
const ShixunPaths = Loadable({
|
||||
loader: () => import('./modules/paths/Index'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
//在线课堂
|
||||
const CoursesIndex = Loadable({
|
||||
loader: () => import('./modules/courses/Index'),
|
||||
loading: Loading,
|
||||
})
|
||||
const SearchPage = Loadable({
|
||||
loader: () => import('./search/SearchPage'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
//教学案例
|
||||
const MoopCases = Loadable({
|
||||
loader: () => import('./modules/moop_cases/index'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
// 课堂讨论
|
||||
// const BoardIndex = Loadable({
|
||||
// loader: () => import('./modules/courses/boards/BoardIndex'),
|
||||
// loading:Loading,
|
||||
// })
|
||||
|
||||
// //课堂普通作业&分组作业
|
||||
// const CoursesWorkIndex = Loadable({
|
||||
// loader: () => import('./modules/courses/busyWork/Index'),
|
||||
// loading:Loading,
|
||||
// })
|
||||
//
|
||||
|
||||
// const TPMShixunchildIndexComponent = Loadable({
|
||||
// loader: () => import('./modules/tpm/shixunchild/ShixunChildIndex'),
|
||||
// loading: Loading,
|
||||
// })
|
||||
|
||||
|
||||
// const TPMshixunfork_listIndexComponent = Loadable({
|
||||
// loader: () => import('./modules/tpm/shixunchild/Shixunfork_list'),
|
||||
// loading: Loading,
|
||||
// })
|
||||
|
||||
|
||||
const ForumsIndexComponent = Loadable({
|
||||
loader: () => import('./modules/forums/ForumsIndex'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
// trustie plus forum
|
||||
// const TPForumsIndexComponent = Loadable({
|
||||
// loader: () => import('./modules/tp-forums/TPForumsIndex'),
|
||||
// loading: Loading,
|
||||
// })
|
||||
|
||||
|
||||
// const TestPageComponent = Loadable({
|
||||
// loader: () => import('./modules/page/Index'),
|
||||
// loading: Loading,
|
||||
// })
|
||||
|
||||
|
||||
//新建实训
|
||||
const Newshixuns = Loadable({
|
||||
loader: () => import('./modules/tpm/newshixuns/Newshixuns'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
|
||||
//实训首页
|
||||
const ShixunsHome = Loadable({
|
||||
loader: () => import('./modules/home/shixunsHome'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
|
||||
const CompatibilityPageLoadable = Loadable({
|
||||
loader: () => import('./modules/common/CompatibilityPage'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
//403页面
|
||||
const Shixunauthority = Loadable({
|
||||
loader: () => import('./modules/403/Shixunauthority'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
|
||||
//404页面
|
||||
const Shixunnopage = Loadable({
|
||||
loader: () => import('./modules/404/Shixunnopage'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
//500页面
|
||||
const http500 = Loadable({
|
||||
loader: () => import('./modules/500/http500'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
// 登录注册
|
||||
const LoginRegisterPage = Loadable({
|
||||
loader: () => import('./modules/user/LoginRegisterPage'),
|
||||
loading: Loading,
|
||||
})
|
||||
const AccountPage = Loadable({
|
||||
loader: () => import('./modules/user/AccountPage'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
// 个人主页
|
||||
const UsersInfo = Loadable({
|
||||
loader: () => import('./modules/user/usersInfo/Infos'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
// 兴趣页面
|
||||
const Interestpage = Loadable({
|
||||
loader: () => import('./modules/login/EducoderInteresse'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
//众包创新
|
||||
const ProjectPackages=Loadable({
|
||||
loader: () => import('./modules/projectPackages/ProjectPackageIndex'),
|
||||
loading: Loading,
|
||||
})
|
||||
|
||||
class App extends Component {
|
||||
constructor(props) {
|
||||
super(props)
|
||||
// this.state = {
|
||||
// isRenders:false,
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
// force an update if the URL changes
|
||||
history.listen(() => {
|
||||
this.forceUpdate()
|
||||
const $ = window.$
|
||||
// https://www.trustie.net/issues/21919 可能会有问题
|
||||
$("html").animate({ scrollTop: $('html').scrollTop() - 0 })
|
||||
});
|
||||
|
||||
initAxiosInterceptors(this.props)
|
||||
|
||||
//
|
||||
// axios.interceptors.response.use((response) => {
|
||||
// // console.log("response"+response);
|
||||
// if(response!=undefined)
|
||||
// // console.log("response"+response.data.statu);
|
||||
// if (response&&response.data.status === 407) {
|
||||
// this.setState({
|
||||
// isRenders: true,
|
||||
// })
|
||||
// }
|
||||
// return response;
|
||||
// }, (error) => {
|
||||
// //TODO 这里如果样式变了会出现css不加载的情况
|
||||
// });
|
||||
}
|
||||
//修改登录方法
|
||||
Modifyloginvalue=()=>{
|
||||
this.setState({
|
||||
isRender:false,
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
|
||||
|
||||
return (
|
||||
<LocaleProvider locale={zhCN}>
|
||||
|
||||
|
||||
<MuiThemeProvider theme={theme}>
|
||||
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={()=>this.Modifyloginvalue()}></LoginDialog>
|
||||
<Notcompletedysl {...this.props} {...this.state}></Notcompletedysl>
|
||||
<Trialapplicationysl {...this.props} {...this.state}></Trialapplicationysl>
|
||||
<Trialapplicationreview {...this.props} {...this.state}></Trialapplicationreview>
|
||||
<Addcourses {...this.props} {...this.state}/>
|
||||
<AccountProfile {...this.props} {...this.state}/>
|
||||
{/*{*/}
|
||||
{/* isRender === true?*/}
|
||||
{/* <LoginDialog></LoginDialog> : ""*/}
|
||||
{/*}*/}
|
||||
|
||||
{/*{*/}
|
||||
{/* isRenders === true?*/}
|
||||
{/*<Trialapplication></Trialapplication>*/}
|
||||
{/*:""*/}
|
||||
{/*}*/}
|
||||
|
||||
<Router>
|
||||
<Switch>
|
||||
{/*<Route path="/login" component={LoginRegisterPage}/>*/}
|
||||
|
||||
{/*众包创新*/}
|
||||
<Route path={"/crowdsourcings"} component={ProjectPackages}/>
|
||||
{/*认证*/}
|
||||
<Route path="/account" component={AccountPage}/>
|
||||
|
||||
{/*403*/}
|
||||
<Route path="/403" component={Shixunauthority}/>
|
||||
|
||||
<Route path="/500" component={http500}/>
|
||||
|
||||
{/*404*/}
|
||||
<Route path="/nopage" component={Shixunnopage}/>
|
||||
|
||||
<Route path="/compatibility" component={CompatibilityPageLoadable}/>
|
||||
<Route
|
||||
path="/login" component={EducoderLogin}
|
||||
/>
|
||||
<Route
|
||||
path="/register" component={EducoderLogin}
|
||||
/>
|
||||
<Route path="/users/:username"
|
||||
render={
|
||||
(props) => (<UsersInfo {...this.props} {...props} {...this.state} />)
|
||||
}></Route>
|
||||
{/*<Route*/}
|
||||
{/* path="/trialapplication" component={Trialapplication}*/}
|
||||
{/*/>*/}
|
||||
<Route
|
||||
path="/changepassword" component={EducoderLogin}
|
||||
/>
|
||||
<Route
|
||||
path="/interesse" component={Interestpage}
|
||||
|
||||
/>
|
||||
|
||||
<Route path="/shixuns/new" component={Newshixuns}>
|
||||
</Route>
|
||||
|
||||
<Route path="/tasks/:stageId" component={IndexWrapperComponent}/>
|
||||
|
||||
<Route path="/shixuns/:shixunId" component={TPMIndexComponent}>
|
||||
</Route>
|
||||
|
||||
{/*列表页*/}
|
||||
<Route path="/shixuns" component={TPMShixunsIndexComponent}/>
|
||||
|
||||
{/* <Route path="/shixunchild" component={TPMShixunchildIndexComponent}>
|
||||
</Route>
|
||||
<Route path="/fork_list" component={TPMshixunfork_listIndexComponent}>
|
||||
</Route> */}
|
||||
|
||||
{/*<Route path="/forums" component={ForumsIndexComponent}>*/}
|
||||
{/*</Route>*/}
|
||||
|
||||
|
||||
{/*实训课程(原实训路径)*/}
|
||||
<Route path="/paths" component={ShixunPaths}></Route>
|
||||
|
||||
<Route path="/search"
|
||||
render={
|
||||
(props)=>(<SearchPage {...this.props} {...props} {...this.state}></SearchPage>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/*课堂*/}
|
||||
<Route path="/courses" component={CoursesIndex} {...this.props}></Route>
|
||||
|
||||
{/* 课堂讨论 */}
|
||||
{/* <Route path="/board" component = {BoardIndex} {...this.props}></Route> */}
|
||||
|
||||
{/* <Route path="/tpforums" component={TPForumsIndexComponent}>
|
||||
</Route> */}
|
||||
|
||||
{/* <Route path="/myshixuns/:shixunId/stages/:stageId" component={Index}/> */}
|
||||
{/* 兴趣页面*/}
|
||||
{/*<Route path="/interest" component={Interestpage}/>*/}
|
||||
|
||||
<Route path="/comment" component={CommentComponent}/>
|
||||
<Route path="/testMaterial" component={TestMaterialDesignComponent}/>
|
||||
<Route path="/test" component={TestIndex}/>
|
||||
<Route path="/testCodeMirror" component={TestCodeMirrorComponent}/>
|
||||
<Route path="/testRCComponent" component={TestComponent}/>
|
||||
<Route path="/testUrlQuery" component={TestUrlQueryComponent}/>
|
||||
|
||||
{/* 教学案例 */}
|
||||
<Route path="/moop_cases"render={
|
||||
(props) => (<MoopCases {...this.props} {...props} {...this.state} />)
|
||||
}/>
|
||||
|
||||
{/* <Route component={NotFoundPage}/> */}
|
||||
{/*列表页*/}
|
||||
{/*<Route component={TPMShixunsIndexComponent}/>*/}
|
||||
{/*首页*/}
|
||||
<Route exact path="/" component={ShixunsHome}/>
|
||||
<Route component={Shixunnopage}/>
|
||||
|
||||
{/*<Route component={ShixunsHome}/>*/}
|
||||
|
||||
</Switch>
|
||||
</Router>
|
||||
</MuiThemeProvider>
|
||||
</LocaleProvider>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// moment国际化,设置为中文
|
||||
moment.defineLocale('zh-cn', {
|
||||
months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split('_'),
|
||||
monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
|
||||
weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
|
||||
weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
|
||||
weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
|
||||
longDateFormat: {
|
||||
LT: 'Ah点mm分',
|
||||
LTS: 'Ah点m分s秒',
|
||||
L: 'YYYY-MM-DD',
|
||||
LL: 'YYYY年MMMD日',
|
||||
LLL: 'YYYY年MMMD日Ah点mm分',
|
||||
LLLL: 'YYYY年MMMD日ddddAh点mm分',
|
||||
l: 'YYYY-MM-DD',
|
||||
ll: 'YYYY年MMMD日',
|
||||
lll: 'YYYY年MMMD日Ah点mm分',
|
||||
llll: 'YYYY年MMMD日ddddAh点mm分'
|
||||
},
|
||||
meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
|
||||
meridiemHour: function (hour, meridiem) {
|
||||
if (hour === 12) {
|
||||
hour = 0;
|
||||
}
|
||||
if (meridiem === '凌晨' || meridiem === '早上' ||
|
||||
meridiem === '上午') {
|
||||
return hour;
|
||||
} else if (meridiem === '下午' || meridiem === '晚上') {
|
||||
return hour + 12;
|
||||
} else {
|
||||
// '中午'
|
||||
return hour >= 11 ? hour : hour + 12;
|
||||
}
|
||||
},
|
||||
meridiem: function (hour, minute, isLower) {
|
||||
var hm = hour * 100 + minute;
|
||||
if (hm < 600) {
|
||||
return '凌晨';
|
||||
} else if (hm < 900) {
|
||||
return '早上';
|
||||
} else if (hm < 1130) {
|
||||
return '上午';
|
||||
} else if (hm < 1230) {
|
||||
return '中午';
|
||||
} else if (hm < 1800) {
|
||||
return '下午';
|
||||
} else {
|
||||
return '晚上';
|
||||
}
|
||||
},
|
||||
calendar: {
|
||||
sameDay: function () {
|
||||
return this.minutes() === 0 ? '[今天]Ah[点整]' : '[今天]LT';
|
||||
},
|
||||
nextDay: function () {
|
||||
return this.minutes() === 0 ? '[明天]Ah[点整]' : '[明天]LT';
|
||||
},
|
||||
lastDay: function () {
|
||||
return this.minutes() === 0 ? '[昨天]Ah[点整]' : '[昨天]LT';
|
||||
},
|
||||
nextWeek: function () {
|
||||
var startOfWeek, prefix;
|
||||
startOfWeek = moment().startOf('week');
|
||||
prefix = this.unix() - startOfWeek.unix() >= 7 * 24 * 3600 ? '[下]' : '[本]';
|
||||
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
||||
},
|
||||
lastWeek: function () {
|
||||
var startOfWeek, prefix;
|
||||
startOfWeek = moment().startOf('week');
|
||||
prefix = this.unix() < startOfWeek.unix() ? '[上]' : '[本]';
|
||||
return this.minutes() === 0 ? prefix + 'dddAh点整' : prefix + 'dddAh点mm';
|
||||
},
|
||||
sameElse: 'LL'
|
||||
},
|
||||
ordinalParse: /\d{1,2}(日|月|周)/,
|
||||
ordinal: function (number, period) {
|
||||
switch (period) {
|
||||
case 'd':
|
||||
case 'D':
|
||||
case 'DDD':
|
||||
return number + '日';
|
||||
case 'M':
|
||||
return number + '月';
|
||||
case 'w':
|
||||
case 'W':
|
||||
return number + '周';
|
||||
default:
|
||||
return number;
|
||||
}
|
||||
},
|
||||
relativeTime: {
|
||||
future: '%s内',
|
||||
past: '%s前',
|
||||
s: '几秒',
|
||||
m: '1分钟',
|
||||
mm: '%d分钟',
|
||||
h: '1小时',
|
||||
hh: '%d小时',
|
||||
d: '1天',
|
||||
dd: '%d天',
|
||||
M: '1个月',
|
||||
MM: '%d个月',
|
||||
y: '1年',
|
||||
yy: '%d年'
|
||||
},
|
||||
week: {
|
||||
// GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
|
||||
dow: 1, // Monday is the first day of the week.
|
||||
doy: 4 // The week that contains Jan 4th is the first week of the year.
|
||||
}
|
||||
});
|
||||
export default SnackbarHOC()(App);
|
||||
31
CHANGELOG.md
31
CHANGELOG.md
|
|
@ -1,4 +1,35 @@
|
|||
# Changelog
|
||||
## [v3.2.0](https://forgeplus.trustie.net/projects/jasder/forgeplus/releases) - 2021-06-09
|
||||
|
||||
### ENHANCEMENTS
|
||||
* ADD 集成邮件和平台站内信等通知系统
|
||||
* Fix 代码库二级页面-优化文件子目录浏览功能(#50388)
|
||||
* Fix 代码库二级页面-优化commit提交详情页页面排版及数据显示(#50372)
|
||||
* Fix 代码库二级页面-优化commit提交信息列表页加载方式和数据排序功能(#50348)
|
||||
* Fix 代码库二级页面-优化创建发行版功能(#50346)
|
||||
* Fix 代码库二级页面-优化标签列表页功能(#50344)
|
||||
* Fix 代码库二级页面-优化发行版本列表页功能(#50345)
|
||||
* Fix 代码库二级页面-优化分支列表页功能(#50343)
|
||||
* Fix 其他问题优化(#51581) (#51343) (#51108)
|
||||
|
||||
---
|
||||
|
||||
### BUGFIXES
|
||||
* Fix 发行版—标签跳转链接错误(#51666)
|
||||
* Fix 文件预览报错(#51660)
|
||||
* Fix 标签创建时间显示错误(#51658)
|
||||
* Fix 分支列表中头像显示问题(#51656)
|
||||
* Fix 文本信息过长(#51630) (#51626)
|
||||
* Fix 版本库中附件下载400(#51625)
|
||||
* Fix loading页面优化(#51588)
|
||||
* Fix 提交详情页面优化(#51577)
|
||||
* Fix 修复易修复制功能(#51569)
|
||||
* Fix 修复新建发行版用户信息显示错误的问题(#51665)
|
||||
* Fix 修复查看文件详细信息报错的问题(#51561)
|
||||
* Fix 修复提交记录中时间显示格式问题(#51526)
|
||||
* Fix 组织下项目更加更新时间倒序排序(#50833)
|
||||
|
||||
|
||||
## [v3.1.0](https://forgeplus.trustie.net/projects/jasder/forgeplus/releases) - 2021-06-09
|
||||
|
||||
* ENHANCEMENTS
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ rails db:migrate RAILS_ENV=development
|
|||
git clone -b standalone https://git.trustie.net/jasder/build.git
|
||||
```
|
||||
|
||||
#### 12. 启动redis(此处已mac系统为例)
|
||||
#### 12. 启动redis(此处以macOS系统为例)
|
||||
```bash
|
||||
redis-server&
|
||||
```
|
||||
|
|
|
|||
|
|
@ -338,10 +338,10 @@ http://localhost:3000/api/projects/ | jq
|
|||
|-|-|-|-|
|
||||
|user_id |是|int |用户id或者组织id |
|
||||
|name |是|string |项目名称 |
|
||||
|description |是|string |项目描述 |
|
||||
|description |否|string |项目描述 |
|
||||
|repository_name |是|string |仓库名称, 只含有数字、字母、下划线不能以下划线开头和结尾,且唯一 |
|
||||
|project_category_id|是|int |项目类别id |
|
||||
|project_language_id|是|int |项目语言id |
|
||||
|project_category_id|否|int |项目类别id |
|
||||
|project_language_id|否|int |项目语言id |
|
||||
|ignore_id |否|int |gitignore相关id |
|
||||
|license_id |否|int |开源许可证id |
|
||||
|private |否|boolean|项目是否私有, true:为私有,false: 公开,默认为公开 |
|
||||
|
|
@ -374,9 +374,7 @@ curl -X POST \
|
|||
-d "user_id=36408" \
|
||||
-d "clone_addr=https://gitea.com/mx8090alex/golden.git" \
|
||||
-d "name=golden_mirror1" \
|
||||
-d "description=golden_mirror" \
|
||||
-d "project_category_id=1" \
|
||||
-d "project_language_id=2" \
|
||||
-d "repository_name=golden_mirror1" \
|
||||
http://localhost:3000/api/projects/migrate.json | jq
|
||||
```
|
||||
*请求参数说明:*
|
||||
|
|
@ -388,8 +386,8 @@ http://localhost:3000/api/projects/migrate.json | jq
|
|||
|clone_addr |是|string |镜像项目clone地址 |
|
||||
|description |否|string |项目描述 |
|
||||
|repository_name |是|string |仓库名称, 只含有数字、字母、下划线不能以下划线开头和结尾,且唯一 |
|
||||
|project_category_id|是|int |项目类别id |
|
||||
|project_language_id|是|int |项目语言id |
|
||||
|project_category_id|否|int |项目类别id |
|
||||
|project_language_id|否|int |项目语言id |
|
||||
|is_mirror |否|boolean|是否设置为镜像, true:是, false:否,默认为否 |
|
||||
|auth_username |否|string|镜像源仓库的登录用户名 |
|
||||
|auth_password |否|string|镜像源仓库的登录秘密 |
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-courses-index-page').length > 0) {
|
||||
let searchContainer = $(".course-list-form");
|
||||
let searchForm = $("form.search-form",searchContainer);
|
||||
var searchContainer = $(".course-list-form");
|
||||
var searchForm = $("form.search-form",searchContainer);
|
||||
|
||||
searchContainer.on('change', '.course-homepage-show', function(){
|
||||
searchForm.find('input[type="submit"]').trigger('click');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* @Description: Do not edit
|
||||
* @Date: 2021-08-31 11:16:45
|
||||
* @LastEditors: viletyy
|
||||
* @Author: viletyy
|
||||
* @LastEditTime: 2021-08-31 14:19:46
|
||||
* @FilePath: /forgeplus/app/assets/javascripts/admins/reversed_keywords/index.js
|
||||
*/
|
||||
$(document).on('turbolinks:load', function(){
|
||||
|
||||
var showSuccessNotify = function() {
|
||||
$.notify({
|
||||
message: '操作成功'
|
||||
},{
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
// close user
|
||||
$('.reversed-keyword-list-container').on('click', '.close-action', function(){
|
||||
var $closeAction = $(this);
|
||||
var $uncloseAction = $closeAction.siblings('.unclose-action');
|
||||
|
||||
var keywordID = $closeAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认关闭限制吗?',
|
||||
ok: function(){
|
||||
$.ajax({
|
||||
url: '/admins/reversed_keywords/' + keywordID,
|
||||
method: 'PUT',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
reversed_keyword: {
|
||||
closed: true
|
||||
}
|
||||
},
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$closeAction.hide();
|
||||
$uncloseAction.show();
|
||||
$(".reversed-keyword-item-"+keywordID).children('td').eq(3).text("")
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// unclose user
|
||||
$('.reversed-keyword-list-container').on('click', '.unclose-action', function(){
|
||||
var $uncloseAction = $(this);
|
||||
var $closeAction = $uncloseAction.siblings('.close-action');
|
||||
|
||||
var keywordID = $uncloseAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认开启限制吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/reversed_keywords/' + keywordID,
|
||||
method: 'PUT',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
reversed_keyword: {
|
||||
closed: false
|
||||
}
|
||||
},
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$closeAction.show();
|
||||
$uncloseAction.hide();
|
||||
$(".reversed-keyword-item-"+keywordID).children('td').eq(3).text("√")
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
|
|
@ -1,7 +1,15 @@
|
|||
/*
|
||||
* @Description: Do not edit
|
||||
* @Date: 2021-07-16 11:58:16
|
||||
* @LastEditors: viletyy
|
||||
* @Author: viletyy
|
||||
* @LastEditTime: 2021-08-31 14:48:59
|
||||
* @FilePath: /forgeplus/app/assets/javascripts/admins/shixun_settings/index.js
|
||||
*/
|
||||
$(document).on('turbolinks:load', function() {
|
||||
if ($('body.admins-shixun-settings-index-page').length > 0) {
|
||||
let searchContainer = $(".shixun-settings-list-form");
|
||||
let searchForm = $("form.search-form",searchContainer);
|
||||
var searchContainer = $(".shixun-settings-list-form");
|
||||
var searchForm = $("form.search-form",searchContainer);
|
||||
|
||||
searchContainer.on('change', '.shixun-settings-select', function(){
|
||||
searchForm.find('input[type="submit"]').trigger('click');
|
||||
|
|
|
|||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* @Description: Do not edit
|
||||
* @Date: 2021-08-31 11:16:45
|
||||
* @LastEditors: viletyy
|
||||
* @Author: viletyy
|
||||
* @LastEditTime: 2021-08-31 14:19:46
|
||||
* @FilePath: /forgeplus/app/assets/javascripts/admins/system_notifications/index.js
|
||||
*/
|
||||
$(document).on('turbolinks:load', function(){
|
||||
|
||||
var showSuccessNotify = function() {
|
||||
$.notify({
|
||||
message: '操作成功'
|
||||
},{
|
||||
type: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
// close user
|
||||
$('.system-notification-list-container').on('click', '.close-action', function(){
|
||||
var $closeAction = $(this);
|
||||
var $uncloseAction = $closeAction.siblings('.unclose-action');
|
||||
|
||||
var keywordID = $closeAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认取消置顶吗?',
|
||||
ok: function(){
|
||||
$.ajax({
|
||||
url: '/admins/system_notifications/' + keywordID,
|
||||
method: 'PUT',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
system_notification: {
|
||||
is_top: false
|
||||
}
|
||||
},
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$closeAction.hide();
|
||||
$uncloseAction.show();
|
||||
$(".system-notification-item-"+keywordID).children('td').eq(3).text("")
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// unclose user
|
||||
$('.system-notification-list-container').on('click', '.unclose-action', function(){
|
||||
var $uncloseAction = $(this);
|
||||
var $closeAction = $uncloseAction.siblings('.close-action');
|
||||
|
||||
var keywordID = $uncloseAction.data('id');
|
||||
customConfirm({
|
||||
content: '确认置顶吗?',
|
||||
ok: function () {
|
||||
$.ajax({
|
||||
url: '/admins/system_notifications/' + keywordID,
|
||||
method: 'PUT',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
system_notification: {
|
||||
is_top: true
|
||||
}
|
||||
},
|
||||
success: function() {
|
||||
showSuccessNotify();
|
||||
$closeAction.show();
|
||||
$uncloseAction.hide();
|
||||
$(".system-notification-item-"+keywordID).children('td').eq(3).text("√")
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
});
|
||||
})
|
||||
|
|
@ -9,6 +9,7 @@ class AccountsController < ApplicationController
|
|||
# 其他平台同步注册的用户
|
||||
def remote_register
|
||||
username = params[:username]&.gsub(/\s+/, "")
|
||||
tip_exception("无法使用以下关键词:#{username},请重新命名") if ReversedKeyword.is_reversed(username).present?
|
||||
email = params[:email]&.gsub(/\s+/, "")
|
||||
password = params[:password]
|
||||
platform = (params[:platform] || 'forge')&.gsub(/\s+/, "")
|
||||
|
|
@ -141,7 +142,9 @@ class AccountsController < ApplicationController
|
|||
|
||||
code = generate_identifier User, 8, pre
|
||||
login = pre + code
|
||||
@user = User.new(admin: false, login: login, mail: email, phone: phone, type: "User")
|
||||
|
||||
is_admin = !User.exists?(type: 'User')
|
||||
@user = User.new(admin: is_admin, login: login, mail: email, phone: phone, type: "User")
|
||||
@user.password = params[:password]
|
||||
# 现在因为是验证码,所以在注册的时候就可以激活
|
||||
@user.activate
|
||||
|
|
@ -154,6 +157,11 @@ class AccountsController < ApplicationController
|
|||
@user.gitea_token = result['sha1']
|
||||
@user.gitea_uid = gitea_user[:body]['id']
|
||||
if @user.save!
|
||||
# set user for admin role
|
||||
if @user.admin?
|
||||
sync_params = { email: @user.mail, admin: true }
|
||||
Gitea::User::UpdateInteractor.call(@user.login, sync_params)
|
||||
end
|
||||
UserExtension.create!(user_id: @user.id)
|
||||
successful_authentication(@user)
|
||||
normal_status("注册成功")
|
||||
|
|
|
|||
|
|
@ -0,0 +1,55 @@
|
|||
class Admins::EduSettingsController < Admins::BaseController
|
||||
before_action :find_setting, only: [:edit,:update, :destroy]
|
||||
|
||||
def index
|
||||
default_sort('id', 'desc')
|
||||
|
||||
edu_settings = Admins::EduSettingQuery.call(params)
|
||||
@edu_settings = paginate edu_settings
|
||||
end
|
||||
|
||||
def new
|
||||
@edu_setting = EduSetting.new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@edu_setting = EduSetting.new(edu_setting_params)
|
||||
if @edu_setting.save
|
||||
redirect_to admins_edu_settings_path
|
||||
flash[:success] = '创建成功'
|
||||
else
|
||||
redirect_to admins_edu_settings_path
|
||||
flash[:danger] = @edu_setting.errors.full_messages.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @edu_setting.update!(edu_setting_params)
|
||||
flash[:success] = '更新成功'
|
||||
else
|
||||
flash[:danger] = @edu_setting.errors.full_messages.join(",")
|
||||
end
|
||||
redirect_to admins_edu_settings_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @edu_setting.destroy!
|
||||
flash[:success] = '删除成功'
|
||||
else
|
||||
lash[:danger] = '删除失败'
|
||||
end
|
||||
redirect_to admins_edu_settings_path
|
||||
end
|
||||
|
||||
private
|
||||
def find_setting
|
||||
@edu_setting ||= EduSetting.find(params[:id])
|
||||
end
|
||||
|
||||
def edu_setting_params
|
||||
params.require(:edu_setting).permit(:name, :value, :description)
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
class Admins::MessageTemplatesController < Admins::BaseController
|
||||
before_action :get_template, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
message_templates = MessageTemplate.group(:type).count.keys
|
||||
@message_templates = kaminari_array_paginate(message_templates)
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @message_template.update_attributes(message_template_params)
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:success] = '消息模版更新成功'
|
||||
else
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:danger] = @message_template.errors.full_messages.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
def init_data
|
||||
if MessageTemplate.build_init_data
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:success] = '消息模版初始化成功'
|
||||
else
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:danger] = '消息模版初始化失败'
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def message_template_params
|
||||
params.require(@message_template.type.split("::").join("_").underscore.to_sym).permit!
|
||||
end
|
||||
|
||||
def get_template
|
||||
@message_template = MessageTemplate.find_by(id: params[:id])
|
||||
unless @message_template.present?
|
||||
redirect_to admins_message_templates_path
|
||||
flash[:danger] = "消息模版不存在"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
class Admins::ReversedKeywordsController < Admins::BaseController
|
||||
before_action :get_keyword, only: [:edit,:update, :destroy]
|
||||
# before_action :validate_identifer, only: [:create, :update]
|
||||
|
||||
def index
|
||||
sort_by = ReversedKeyword.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_at'
|
||||
sort_direction = %w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc'
|
||||
q = ReversedKeyword.ransack(identifier_cont: params[:search])
|
||||
keywords = q.result(distinct: true).order("#{sort_by} #{sort_direction}")
|
||||
@keywords = paginate(keywords)
|
||||
|
||||
end
|
||||
|
||||
def new
|
||||
@keyword = ReversedKeyword.new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@keyword = ReversedKeyword.new(keyword_params)
|
||||
if @keyword.save
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:success] = '系统保留关键词创建成功'
|
||||
else
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:danger] = @keyword.errors.full_messages.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
respond_to do |format|
|
||||
if @keyword.update_attributes(keyword_params)
|
||||
format.html do
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:success] = '系统保留关键词更新成功'
|
||||
end
|
||||
format.js {render_ok}
|
||||
else
|
||||
format.html do
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:danger] = @keyword.errors.full_messages.join(",")
|
||||
end
|
||||
format.js {render_js_error}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @keyword.destroy
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:success] = "系统保留关键词删除成功"
|
||||
else
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:danger] = "系统保留关键词删除失败"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def keyword_params
|
||||
params.require(:reversed_keyword).permit!
|
||||
end
|
||||
|
||||
def get_keyword
|
||||
@keyword = ReversedKeyword.find_by(id: params[:id])
|
||||
unless @keyword.present?
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:danger] = "系统保留关键词不存在"
|
||||
end
|
||||
end
|
||||
|
||||
def validate_identifer
|
||||
identifer = keyword_params[:identifier].to_s.downcase
|
||||
if identifer.blank?
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:danger] = '系统保留关键词标识不能为空'
|
||||
elsif ProjectLanguage.exists?(name: identifer)
|
||||
redirect_to admins_reversed_keywords_path
|
||||
flash[:danger] = '系统保留关键词已存在'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
class Admins::SitesController < Admins::BaseController
|
||||
before_action :find_site, only: [:edit,:update, :destroy]
|
||||
|
||||
def index
|
||||
default_sort('id', 'desc')
|
||||
|
||||
sites = Admins::SiteQuery.call(params)
|
||||
@sites = paginate sites
|
||||
end
|
||||
|
||||
def new
|
||||
@site = Site.new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@site = Site.new(site_params)
|
||||
if @site.save
|
||||
redirect_to admins_sites_path
|
||||
flash[:success] = '创建成功'
|
||||
else
|
||||
redirect_to admins_sites_path
|
||||
flash[:danger] = @site.errors.full_messages.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
if @site.update!(site_params)
|
||||
flash[:success] = '更新成功'
|
||||
else
|
||||
flash[:danger] = @site.errors.full_messages.join(",")
|
||||
end
|
||||
redirect_to admins_sites_path
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @site.destroy!
|
||||
flash[:success] = '删除成功'
|
||||
else
|
||||
lash[:danger] = '删除失败'
|
||||
end
|
||||
redirect_to admins_sites_path
|
||||
end
|
||||
|
||||
private
|
||||
def find_site
|
||||
@site ||= Site.find(params[:id])
|
||||
end
|
||||
|
||||
def site_params
|
||||
params.require(:site).permit(:name, :url, :key, :site_type)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
class Admins::SystemNotificationsController < Admins::BaseController
|
||||
before_action :get_notification, only: [:history, :edit,:update, :destroy]
|
||||
# before_action :validate_identifer, only: [:create, :update]
|
||||
|
||||
def index
|
||||
sort_by = SystemNotification.column_names.include?(params[:sort_by]) ? params[:sort_by] : 'created_at'
|
||||
sort_direction = %w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc'
|
||||
q = SystemNotification.ransack(subject_cont: params[:search])
|
||||
notifications = q.result(distinct: true).reorder("#{sort_by} #{sort_direction},created_at desc")
|
||||
@notifications = paginate(notifications)
|
||||
end
|
||||
|
||||
def new
|
||||
@notification = SystemNotification.new
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def create
|
||||
@notification = SystemNotification.new(notification_params)
|
||||
if @notification.save
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:success] = '系统消息创建成功'
|
||||
else
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:danger] = @notification.errors.full_messages.join(",")
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
respond_to do |format|
|
||||
if @notification.update_attributes(notification_params)
|
||||
format.html do
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:success] = '系统消息更新成功'
|
||||
end
|
||||
format.js {render_ok}
|
||||
else
|
||||
format.html do
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:danger] = @notification.errors.full_messages.join(",")
|
||||
end
|
||||
format.js {render_js_error}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
if @notification.destroy
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:success] = "系统消息删除成功"
|
||||
else
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:danger] = "系统消息删除失败"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def notification_params
|
||||
params.require(:system_notification).permit!
|
||||
end
|
||||
|
||||
def get_notification
|
||||
@notification = SystemNotification.find_by(id: params[:id])
|
||||
unless @notification.present?
|
||||
redirect_to admins_system_notifications_path
|
||||
flash[:danger] = "系统消息不存在"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -246,6 +246,14 @@ class ApplicationController < ActionController::Base
|
|||
tip_exception(401, "请登录后再操作") unless User.current.logged?
|
||||
end
|
||||
|
||||
def require_profile_completed
|
||||
tip_exception(411, "请完善资料后再操作") unless User.current.profile_is_completed?
|
||||
end
|
||||
|
||||
def require_user_profile_completed(user)
|
||||
tip_exception(412, "请用户完善资料后再操作") unless user.profile_is_completed?
|
||||
end
|
||||
|
||||
# 异常提醒
|
||||
def tip_exception(status = -1, message)
|
||||
raise Educoder::TipException.new(status, message)
|
||||
|
|
@ -272,7 +280,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
# 资料是否完善
|
||||
def check_account
|
||||
if !current_user.profile_completed?
|
||||
if !current_user. profile_is_completed?
|
||||
#info_url = '/account/profile'
|
||||
tip_exception(402, nil)
|
||||
end
|
||||
|
|
@ -753,10 +761,10 @@ class ApplicationController < ActionController::Base
|
|||
if @project and current_user.can_read_project?(@project)
|
||||
logger.info "###########: has project and can read project"
|
||||
@project
|
||||
elsif @project && current_user.is_a?(AnonymousUser)
|
||||
logger.info "###########:This is AnonymousUser"
|
||||
@project = nil if !@project.is_public?
|
||||
render_forbidden and return
|
||||
# elsif @project && current_user.is_a?(AnonymousUser)
|
||||
# logger.info "###########:This is AnonymousUser"
|
||||
# @project = nil if !@project.is_public?
|
||||
# render_forbidden and return
|
||||
else
|
||||
logger.info "###########:project not found"
|
||||
@project = nil
|
||||
|
|
@ -774,7 +782,8 @@ class ApplicationController < ActionController::Base
|
|||
end
|
||||
|
||||
def convert_image!
|
||||
@image = params[:image] || user_params[:image]
|
||||
@image = params[:image]
|
||||
@image = @image.nil? && params[:user].present? ? params[:user][:image] : @image
|
||||
return unless @image.present?
|
||||
max_size = EduSetting.get('upload_avatar_max_size') || 2 * 1024 * 1024 # 2M
|
||||
if @image.class == ActionDispatch::Http::UploadedFile
|
||||
|
|
|
|||
|
|
@ -32,8 +32,17 @@ class AttachmentsController < ApplicationController
|
|||
def get_file
|
||||
normal_status(-1, "参数缺失") if params[:download_url].blank?
|
||||
url = URI.encode(params[:download_url].to_s.gsub("http:", "https:"))
|
||||
response = Faraday.get(url)
|
||||
filename = params[:download_url].to_s.split("/").pop()
|
||||
if url.starts_with?(base_url)
|
||||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
url = url.split(base_url)[1].gsub("api", "repos").gsub('?filepath=', '/').gsub('&', '?')
|
||||
request_url = [domain, api_url, url, "?ref=#{params[:ref]}&access_token=#{current_user&.gitea_token}"].join
|
||||
response = Faraday.get(request_url)
|
||||
filename = url.to_s.split("/").pop()
|
||||
else
|
||||
response = Faraday.get(url)
|
||||
filename = params[:download_url].to_s.split("/").pop()
|
||||
end
|
||||
send_data(response.body.force_encoding("UTF-8"), filename: filename, type: "application/octet-stream", disposition: 'attachment')
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -6,26 +6,48 @@ class CompareController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
load_compare_params
|
||||
compare
|
||||
@merge_status, @merge_message = get_merge_message
|
||||
end
|
||||
|
||||
private
|
||||
def get_merge_message
|
||||
if @base.blank? || @head.blank?
|
||||
return -2, "请选择分支"
|
||||
else
|
||||
if @head.include?(":")
|
||||
fork_project = @project.forked_projects.joins(:owner).where(users: {login: @head.to_s.split("/")[0]}).take
|
||||
return -2, "请选择正确的仓库" unless fork_project.present?
|
||||
@exist_pullrequest = @project.pull_requests.where(is_original: true, head: @head.to_s.split(":")[1], base: @base, status: 0, fork_project_id: fork_project.id).take
|
||||
else
|
||||
@exist_pullrequest = @project.pull_requests.where(is_original: false, head: @base, base: @head, status: 0).take
|
||||
end
|
||||
if @exist_pullrequest.present?
|
||||
return -2, "在这些分支之间的合并请求已存在:<a href='/#{@owner.login}/#{@project.identifier}/pulls/#{@exist_pullrequest.id}'>#{@exist_pullrequest.try(:title)}</a>"
|
||||
else
|
||||
if @compare_result["Commits"].blank? && @compare_result["Diff"].blank?
|
||||
return -2, "分支内容相同,无需创建合并请求"
|
||||
end
|
||||
end
|
||||
end
|
||||
return 0, "可以合并"
|
||||
end
|
||||
|
||||
def compare
|
||||
base, head = compare_params
|
||||
|
||||
# TODO: 处理fork的项目向源项目发送PR的base、head参数问题
|
||||
@compare_result ||=
|
||||
head.include?(":") ? gitea_compare(base, head) : gitea_compare(head, base)
|
||||
@head.include?(":") ? gitea_compare(@base, @head) : gitea_compare(@head, @base)
|
||||
end
|
||||
|
||||
def compare_params
|
||||
base = Addressable::URI.unescape(params[:base])
|
||||
head = params[:head].include?('json') ? params[:head]&.split('.json')[0] : params[:head]
|
||||
def load_compare_params
|
||||
@base = Addressable::URI.unescape(params[:base])
|
||||
@head = params[:head].include?('json') ? params[:head]&.split('.json')[0] : params[:head]
|
||||
|
||||
[base, head]
|
||||
end
|
||||
|
||||
def gitea_compare(base, head)
|
||||
Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, base, head)
|
||||
Gitea::Repository::Commits::CompareService.call(@owner.login, @project.identifier, base, head, current_user.gitea_token)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ module LaboratoryHelper
|
|||
my_courses: "https://www.trustie.net/users/#{current_user.try(:login)}/user_courselist",
|
||||
my_projects: "/users/#{current_user.try(:login)}/projects",
|
||||
my_organ: "https://www.trustie.net/users/#{current_user.try(:login)}/user_organizations",
|
||||
default_url: "https://www.trustie.net/",
|
||||
default_url: Rails.application.config_for(:configuration)['platform_url'],
|
||||
tiding_url: "https://www.trustie.net/users/#{current_user.try(:login)}/user_messages",
|
||||
register_url: "https://www.trustie.net/login?login=false"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,8 @@ class EduSettingsController < ApplicationController
|
|||
|
||||
respond_to do |format|
|
||||
if @edu_setting.save
|
||||
format.html { redirect_to @edu_setting, notice: 'Edu setting was successfully created.' }
|
||||
format.json { render :show, status: :created, location: @edu_setting }
|
||||
else
|
||||
format.html { render :new }
|
||||
format.json { render json: @edu_setting.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
|
@ -43,10 +41,8 @@ class EduSettingsController < ApplicationController
|
|||
def update
|
||||
respond_to do |format|
|
||||
if @edu_setting.update(edu_setting_params)
|
||||
format.html { redirect_to @edu_setting, notice: 'Edu setting was successfully updated.' }
|
||||
format.json { render :show, status: :ok, location: @edu_setting }
|
||||
else
|
||||
format.html { render :edit }
|
||||
format.json { render json: @edu_setting.errors, status: :unprocessable_entity }
|
||||
end
|
||||
end
|
||||
|
|
@ -57,7 +53,6 @@ class EduSettingsController < ApplicationController
|
|||
def destroy
|
||||
@edu_setting.destroy
|
||||
respond_to do |format|
|
||||
format.html { redirect_to edu_settings_url, notice: 'Edu setting was successfully destroyed.' }
|
||||
format.json { head :no_content }
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class ForksController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_project
|
||||
before_action :authenticate_project!, :authenticate_user!
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ class IssueTagsController < ApplicationController
|
|||
|
||||
|
||||
def index
|
||||
issue_tags = @project.issue_tags.order("#{order_name} #{order_type}")
|
||||
issue_tags = @project.issue_tags.reorder("#{order_name} #{order_type}")
|
||||
@user_admin_or_member = current_user.present? && (current_user.admin || @project.member?(current_user))
|
||||
@page = params[:page] || 1
|
||||
@limit = params[:limit] || 15
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
class IssuesController < ApplicationController
|
||||
before_action :require_login, except: [:index, :show, :index_chosen]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_project
|
||||
before_action :set_user
|
||||
before_action :check_menu_authorize, except: [:index_chosen]
|
||||
before_action :check_issue_permission
|
||||
before_action :operate_issue_permission, only:[:create, :update, :destroy, :clean, :series_update, :copy]
|
||||
before_action :check_project_public, only: [:index ,:show, :copy, :index_chosen, :close_issue]
|
||||
|
|
@ -13,8 +15,7 @@ class IssuesController < ApplicationController
|
|||
include TagChosenHelper
|
||||
|
||||
def index
|
||||
return render_not_found unless @project.has_menu_permission("issues")
|
||||
@user_admin_or_member = current_user.present? && current_user.logged? && (current_user.admin || @project.member?(current_user))
|
||||
@user_admin_or_member = current_user.present? && current_user.logged? && (current_user.admin || @project.member?(current_user) || @project.is_public?)
|
||||
issues = @project.issues.issue_issue.issue_index_includes
|
||||
issues = issues.where(is_private: false) unless @user_admin_or_member
|
||||
|
||||
|
|
@ -110,6 +111,8 @@ class IssuesController < ApplicationController
|
|||
Issues::CreateForm.new({subject:issue_params[:subject]}).validate!
|
||||
@issue = Issue.new(issue_params)
|
||||
if @issue.save!
|
||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('ProjectIssue', current_user.id, @issue&.id) if Site.has_notice_menu?
|
||||
if params[:attachment_ids].present?
|
||||
params[:attachment_ids].each do |id|
|
||||
attachment = Attachment.select(:id, :container_id, :container_type)&.find_by_id(id)
|
||||
|
|
@ -157,6 +160,7 @@ class IssuesController < ApplicationController
|
|||
def update
|
||||
last_token = @issue.token
|
||||
last_status_id = @issue.status_id
|
||||
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?
|
||||
if params[:issue_tag_ids].present? && !@issue&.issue_tags_relates.where(issue_tag_id: params[:issue_tag_ids]).exists?
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
|
|
@ -201,6 +205,26 @@ class IssuesController < ApplicationController
|
|||
issue_params = issue_send_params(params).except(:issue_classify, :author_id, :project_id)
|
||||
Issues::UpdateForm.new({subject:issue_params[:subject]}).validate!
|
||||
if @issue.update_attributes(issue_params)
|
||||
if @issue&.pull_request.present?
|
||||
SendTemplateMessageJob.perform_later('PullRequestChanged', current_user.id, @issue&.pull_request&.id, @issue.previous_changes.slice(:assigned_to_id, :priority_id, :fixed_version_id, :issue_tags_value)) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('PullRequestAssigned', current_user.id, @issue&.pull_request&.id ) if @issue.previous_changes[:assigned_to_id].present? && Site.has_notice_menu?
|
||||
else
|
||||
previous_changes = @issue.previous_changes.slice(:status_id, :assigned_to_id, :tracker_id, :priority_id, :fixed_version_id, :done_ratio, :issue_tags_value, :branch_name)
|
||||
if @issue.previous_changes[:start_date].present?
|
||||
previous_changes.merge!(start_date: [@issue.previous_changes[:start_date][0].to_s, @issue.previous_changes[:start_date][1].to_s])
|
||||
end
|
||||
if @issue.previous_changes[:due_date].present?
|
||||
previous_changes.merge!(due_date: [@issue.previous_changes[:due_date][0].to_s, @issue.previous_changes[:due_date][1].to_s])
|
||||
end
|
||||
if @issue.previous_changes[:status_id].present? && @issue.previous_changes[:status_id][1] == 5
|
||||
@issue.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: ProjectTrend::CLOSE)
|
||||
end
|
||||
if @issue.previous_changes[:status_id].present? && @issue.previous_changes[:status_id][0] == 5
|
||||
@issue.project_trends.where(action_type: ProjectTrend::CLOSE).destroy_all
|
||||
end
|
||||
SendTemplateMessageJob.perform_later('IssueChanged', current_user.id, @issue&.id, previous_changes) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @issue&.id) if @issue.previous_changes[:assigned_to_id].present? && Site.has_notice_menu?
|
||||
end
|
||||
if params[:status_id].to_i == 5 #任务由非关闭状态到关闭状态时
|
||||
@issue.issue_times.update_all(end_time: Time.now)
|
||||
@issue.update_closed_issues_count_in_project!
|
||||
|
|
@ -219,7 +243,7 @@ class IssuesController < ApplicationController
|
|||
change_type = change_token > 0 ? "add" : "minus"
|
||||
post_to_chain(change_type, change_token.abs, current_user.try(:login))
|
||||
end
|
||||
@issue.create_journal_detail(change_files, issue_files, issue_file_ids, current_user&.id)
|
||||
@issue.create_journal_detail(change_files, issue_files, issue_file_ids, current_user&.id) if @issue.previous_changes.present?
|
||||
normal_status(0, "更新成功")
|
||||
else
|
||||
normal_status(-1, "更新失败")
|
||||
|
|
@ -252,6 +276,7 @@ class IssuesController < ApplicationController
|
|||
status_id = @issue.status_id
|
||||
token = @issue.token
|
||||
login = @issue.user.try(:login)
|
||||
SendTemplateMessageJob.perform_later('IssueDeleted', current_user.id, @issue&.subject, @issue.assigned_to_id, @issue.author_id) if Site.has_notice_menu?
|
||||
if @issue.destroy
|
||||
if issue_type == "2" && status_id != 5
|
||||
post_to_chain("add", token, login)
|
||||
|
|
@ -271,8 +296,12 @@ class IssuesController < ApplicationController
|
|||
def clean
|
||||
#批量删除,暂时只能删除未悬赏的
|
||||
issue_ids = params[:ids]
|
||||
if issue_ids.present?
|
||||
if Issue.where(id: issue_ids, issue_type: "1").destroy_all
|
||||
issues = Issue.where(id: issue_ids, issue_type: "1")
|
||||
if issues.present?
|
||||
issues.find_each do |i|
|
||||
SendTemplateMessageJob.perform_later('IssueDeleted', current_user.id, i&.subject, i.assigned_to_id, i.author_id) if Site.has_notice_menu?
|
||||
end
|
||||
if issues.destroy_all
|
||||
normal_status(0, "删除成功")
|
||||
else
|
||||
normal_status(-1, "删除失败")
|
||||
|
|
@ -302,9 +331,28 @@ class IssuesController < ApplicationController
|
|||
# update_hash = params[:issue]
|
||||
issue_ids = params[:ids]
|
||||
if issue_ids.present?
|
||||
issues = Issue.where(id: issue_ids)
|
||||
if update_hash.blank?
|
||||
normal_status(-1, "请选择批量更新内容")
|
||||
elsif Issue.where(id: issue_ids)&.update(update_hash)
|
||||
elsif issues&.update(update_hash)
|
||||
issues.each do |i|
|
||||
i.create_journal_detail(false, [], [], current_user&.id) if i.previous_changes.present?
|
||||
previous_changes = i.previous_changes.slice(:status_id, :assigned_to_id, :tracker_id, :priority_id, :fixed_version_id, :done_ratio, :issue_tags_value, :branch_name)
|
||||
if i.previous_changes[:start_date].present?
|
||||
previous_changes.merge!(start_date: [i.previous_changes[:start_date][0].to_s, i.previous_changes[:start_date][1].to_s])
|
||||
end
|
||||
if i.previous_changes[:due_date].present?
|
||||
previous_changes.merge!(due_date: [i.previous_changes[:due_date][0].to_s, i.previous_changes[:due_date][1].to_s])
|
||||
end
|
||||
if i.previous_changes[:status_id].present? && i.previous_changes[:status_id][1] == 5
|
||||
i.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: ProjectTrend::CLOSE)
|
||||
end
|
||||
if i.previous_changes[:status_id].present? && i.previous_changes[:status_id][0] == 5
|
||||
i.project_trends.where(action_type: ProjectTrend::CLOSE).destroy_all
|
||||
end
|
||||
SendTemplateMessageJob.perform_later('IssueChanged', current_user.id, i&.id, previous_changes) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, i&.id) if i.previous_changes[:assigned_to_id].present? && Site.has_notice_menu?
|
||||
end
|
||||
normal_status(0, "批量更新成功")
|
||||
else
|
||||
normal_status(-1, "批量更新失败")
|
||||
|
|
@ -318,6 +366,8 @@ class IssuesController < ApplicationController
|
|||
@new_issue = @issue.dup
|
||||
@new_issue.author_id = current_user.id
|
||||
if @new_issue.save
|
||||
SendTemplateMessageJob.perform_later('IssueAssigned', current_user.id, @new_issue&.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('ProjectIssue', current_user.id, @new_issue&.id) if Site.has_notice_menu?
|
||||
issue_tags = @issue.issue_tags.pluck(:id)
|
||||
if issue_tags.present?
|
||||
issue_tags.each do |tag|
|
||||
|
|
@ -395,27 +445,27 @@ class IssuesController < ApplicationController
|
|||
|
||||
def check_project_public
|
||||
unless @project.is_public || @project.member?(current_user) || current_user.admin? || (@project.user_id == current_user.id)
|
||||
normal_status(-1, "您没有权限")
|
||||
return render_forbidden
|
||||
end
|
||||
end
|
||||
|
||||
def set_issue
|
||||
@issue = Issue.find_by_id(params[:id])
|
||||
if @issue.blank?
|
||||
normal_status(-1, "标签不存在")
|
||||
elsif @issue.is_lock &&!(@project.member?(current_user) || current_user.admin?)
|
||||
normal_status(-1, "您没有权限")
|
||||
return render_not_found
|
||||
elsif !(@project.is_public || (current_user.present? && (@project.member?(current_user) || current_user&.admin? || (@project.user_id == current_user&.id))))
|
||||
return render_forbidden
|
||||
end
|
||||
end
|
||||
|
||||
def check_issue_permission
|
||||
unless @project.is_public || (current_user.present? && (@project.member?(current_user) || current_user&.admin? || (@project.user_id == current_user&.id)))
|
||||
normal_status(-1, "您没有权限")
|
||||
return render_forbidden
|
||||
end
|
||||
end
|
||||
|
||||
def operate_issue_permission
|
||||
return render_forbidden("您没有权限进行此操作.") unless current_user.admin? || @project.member?(current_user)
|
||||
return render_forbidden("您没有权限进行此操作.") unless current_user.present? && current_user.logged? && (current_user.admin? || @project.member?(current_user) || @project.is_public?)
|
||||
end
|
||||
|
||||
def export_issues(issues)
|
||||
|
|
@ -497,4 +547,8 @@ class IssuesController < ApplicationController
|
|||
return normal_status(-1, "您的token值不足") if JSON.parse(response.body)["balance"].to_i < params[:token].to_i
|
||||
end
|
||||
end
|
||||
|
||||
def check_menu_authorize
|
||||
return render_not_found unless @project.has_menu_permission("issues")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class JournalsController < ApplicationController
|
||||
before_action :require_login, except: [:index, :get_children_journals]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :set_issue
|
||||
before_action :check_issue_permission
|
||||
before_action :set_journal, only: [:destroy, :edit, :update]
|
||||
|
|
|
|||
|
|
@ -23,9 +23,9 @@ class MainController < ApplicationController
|
|||
|
||||
# TODO: 这块之后需要整合,者架构重新变化,统一跳转到index后再路由分发
|
||||
if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild"
|
||||
render file: 'public/h5educoderbuild/index.html', :layout => false
|
||||
render file: 'public/h5educoderbuild/index.html', :layout => false, :content_type=> 'text/html'
|
||||
else
|
||||
render file: 'public/react/build/index.html', :layout => false
|
||||
render file: 'public/react/build/index.html', :layout => false, :content_type=> 'text/html'
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,12 +2,15 @@ class MembersController < ApplicationController
|
|||
before_action :require_login
|
||||
before_action :load_project
|
||||
before_action :find_user_with_id, only: %i[create remove change_role]
|
||||
before_action :check_user_profile_completed, only: [:create]
|
||||
before_action :operate!, except: %i[index]
|
||||
before_action :check_member_exists!, only: %i[create]
|
||||
before_action :check_member_not_exists!, only: %i[remove change_role]
|
||||
|
||||
def create
|
||||
interactor = Projects::AddMemberInteractor.call(@project.owner, @project, @user)
|
||||
SendTemplateMessageJob.perform_later('ProjectJoined', current_user.id, @user.id, @project.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('ProjectMemberJoined', current_user.id, @user.id, @project.id) if Site.has_notice_menu?
|
||||
render_response(interactor)
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
|
|
@ -27,6 +30,8 @@ class MembersController < ApplicationController
|
|||
|
||||
def remove
|
||||
interactor = Projects::DeleteMemberInteractor.call(@project.owner, @project, @user)
|
||||
SendTemplateMessageJob.perform_later('ProjectLeft', current_user.id, @user.id, @project.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('ProjectMemberLeft', current_user.id, @user.id, @project.id) if Site.has_notice_menu?
|
||||
render_response(interactor)
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
|
|
@ -35,6 +40,7 @@ class MembersController < ApplicationController
|
|||
|
||||
def change_role
|
||||
interactor = Projects::ChangeMemberRoleInteractor.call(@project.owner, @project, @user, params[:role])
|
||||
SendTemplateMessageJob.perform_later('ProjectRole', current_user.id, @user.id, @project.id, message_role_name) if Site.has_notice_menu?
|
||||
render_response(interactor)
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
|
|
@ -47,7 +53,7 @@ class MembersController < ApplicationController
|
|||
end
|
||||
|
||||
def member_exists?
|
||||
@project.members.exists?(params[:user_id])
|
||||
@project.members.exists?(user_id: params[:user_id])
|
||||
end
|
||||
|
||||
def operate!
|
||||
|
|
@ -55,10 +61,24 @@ class MembersController < ApplicationController
|
|||
end
|
||||
|
||||
def check_member_exists!
|
||||
return render_result(1, "user_id为#{params[:user_id]}的用户已经是项目成员") if member_exists?
|
||||
return render_error("user_id为#{params[:user_id]}的用户已经是项目成员") if member_exists?
|
||||
end
|
||||
|
||||
def check_member_not_exists!
|
||||
return render_result(1, "user_id为#{params[:user_id]}的用户还不是项目成员") unless @project.member?(params[:user_id])
|
||||
return render_error("user_id为#{params[:user_id]}的用户还不是项目成员") unless member_exists?
|
||||
end
|
||||
|
||||
def check_user_profile_completed
|
||||
require_user_profile_completed(@user)
|
||||
end
|
||||
|
||||
def message_role_name
|
||||
case params[:role]
|
||||
when 'Manager' then '管理员'
|
||||
when 'Developer' then '开发者'
|
||||
when 'Reporter' then '报告者'
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class Organizations::OrganizationsController < Organizations::BaseController
|
||||
before_action :require_login, except: [:index, :show, :recommend]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :convert_image!, only: [:create, :update]
|
||||
before_action :load_organization, only: [:show, :update, :destroy]
|
||||
before_action :check_user_can_edit_org, only: [:update, :destroy]
|
||||
|
|
@ -25,6 +26,7 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
|||
|
||||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
tip_exception("无法使用以下关键词:#{organization_params[:name]},请重新命名") if ReversedKeyword.is_reversed(organization_params[:name]).present?
|
||||
Organizations::CreateForm.new(organization_params).validate!
|
||||
@organization = Organizations::CreateService.call(current_user, organization_params)
|
||||
Util.write_file(@image, avatar_path(@organization)) if params[:image].present?
|
||||
|
|
@ -41,7 +43,8 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
|||
@organization.login = organization_params[:name] if organization_params[:name].present?
|
||||
@organization.nickname = organization_params[:nickname] if organization_params[:nickname].present?
|
||||
@organization.save!
|
||||
@organization.organization_extension.update_attributes!(organization_params.except(:name, :nickname))
|
||||
sync_organization_extension!
|
||||
|
||||
Gitea::Organization::UpdateService.call(@organization.gitea_token, login, @organization.reload)
|
||||
Util.write_file(@image, avatar_path(@organization)) if params[:image].present?
|
||||
end
|
||||
|
|
@ -95,4 +98,18 @@ class Organizations::OrganizationsController < Organizations::BaseController
|
|||
%w(desc asc).include?(params[:sort_direction]) ? params[:sort_direction] : 'desc'
|
||||
end
|
||||
|
||||
def set_max_repo_creation
|
||||
organization_params[:max_repo_creation].blank? ? -1 : organization_params[:max_repo_creation]
|
||||
end
|
||||
|
||||
def organization_extension_params
|
||||
organization_params
|
||||
.except(:name, :nickname)
|
||||
.merge(max_repo_creation: set_max_repo_creation)
|
||||
end
|
||||
|
||||
def sync_organization_extension!
|
||||
@organization.organization_extension.update_attributes!(organization_extension_params)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
class Organizations::TeamUsersController < Organizations::BaseController
|
||||
before_action :load_organization, :load_team
|
||||
before_action :load_operate_user, only: [:create, :destroy]
|
||||
before_action :check_user_profile_completed, only: [:create]
|
||||
before_action :load_team_user, only: [:destroy]
|
||||
before_action :check_user_can_edit_org, only: [:create, :destroy]
|
||||
|
||||
|
|
@ -17,6 +18,7 @@ class Organizations::TeamUsersController < Organizations::BaseController
|
|||
ActiveRecord::Base.transaction do
|
||||
@team_user = TeamUser.build(@organization.id, @operate_user.id, @team.id)
|
||||
@organization_user = OrganizationUser.build(@organization.id, @operate_user.id)
|
||||
SendTemplateMessageJob.perform_later('OrganizationRole', @operate_user.id, @organization.id, @team.authorize_name) if Site.has_notice_menu?
|
||||
Gitea::Organization::TeamUser::CreateService.call(@organization.gitea_token, @team.gtid, @operate_user.login)
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
@ -29,6 +31,11 @@ class Organizations::TeamUsersController < Organizations::BaseController
|
|||
ActiveRecord::Base.transaction do
|
||||
@team_user.destroy!
|
||||
Gitea::Organization::TeamUser::DeleteService.call(@organization.gitea_token, @team.gtid, @operate_user.login)
|
||||
org_team_users = @organization.team_users.where(user_id: @operate_user.id)
|
||||
unless org_team_users.present?
|
||||
@organization.organization_users.find_by(user_id: @operate_user.id).destroy!
|
||||
Gitea::Organization::OrganizationUser::DeleteService.call(@organization.gitea_token, @organization.login, @operate_user.login)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
@ -43,6 +50,11 @@ class Organizations::TeamUsersController < Organizations::BaseController
|
|||
ActiveRecord::Base.transaction do
|
||||
@team_user.destroy!
|
||||
Gitea::Organization::TeamUser::DeleteService.call(@organization.gitea_token, @team.gtid, current_user.login)
|
||||
org_team_users = @organization.team_users.where(user_id: current_user.id)
|
||||
unless org_team_users.present?
|
||||
@organization.organization_users.find_by(user_id: current_user.id).destroy!
|
||||
Gitea::Organization::OrganizationUser::DeleteService.call(@organization.gitea_token, @organization.login, current_user.login)
|
||||
end
|
||||
render_ok
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
@ -73,4 +85,8 @@ class Organizations::TeamUsersController < Organizations::BaseController
|
|||
tip_exception("组织团队成员不存在") if @team_user.nil?
|
||||
end
|
||||
|
||||
def check_user_profile_completed
|
||||
require_user_profile_completed(@operate_user)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
class OwnersController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :require_login, only: [:index]
|
||||
|
||||
def index
|
||||
@owners = []
|
||||
|
|
@ -9,4 +9,53 @@ class OwnersController < ApplicationController
|
|||
teams: {can_create_org_project: true})
|
||||
.distinct
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@owner = Owner.find_by(login: params[:id]) || Owner.find_by(id: params[:id])
|
||||
return render_not_found unless @owner.present?
|
||||
# 组织
|
||||
if @owner.is_a?(Organization)
|
||||
return render_forbidden("没有查看组织的权限") if org_limited_condition || org_privacy_condition
|
||||
@can_create_project = @owner.can_create_project?(current_user.id)
|
||||
@is_admin = current_user.admin? || @owner.is_owner?(current_user.id)
|
||||
@is_member = @owner.is_member?(current_user.id)
|
||||
# 用户
|
||||
else
|
||||
#待办事项,现在未做
|
||||
if User.current.admin? || User.current.login == @owner.login
|
||||
@waiting_applied_messages = @owner.applied_messages.waiting
|
||||
@common_applied_transfer_projects = AppliedTransferProject.where(owner_id: @owner.id).common + AppliedTransferProject.where(owner_id: Organization.joins(team_users: :team).where(team_users: {user_id: @owner.id}, teams: {authorize: %w(admin owner)} )).common
|
||||
@common_applied_projects = AppliedProject.where(project_id: @owner.full_admin_projects).common
|
||||
@undo_events = @waiting_applied_messages.size + @common_applied_transfer_projects.size + @common_applied_projects.size
|
||||
else
|
||||
@waiting_applied_messages = AppliedMessage.none
|
||||
@common_applied_transfer_projects = AppliedTransferProject.none
|
||||
@common_applied_projects = AppliedProject.none
|
||||
@undo_events = 0
|
||||
end
|
||||
#用户的组织数量
|
||||
# @user_composes_count = @user.composes.size
|
||||
@user_composes_count = 0
|
||||
user_organizations = User.current.logged? ? @owner.organizations.with_visibility(%w(common limited)) + @owner.organizations.with_visibility("privacy").joins(:team_users).where(team_users: {user_id: current_user.id}) : @owner.organizations.with_visibility("common")
|
||||
@user_org_count = user_organizations.size
|
||||
normal_projects = Project.members_projects(@owner.id).to_sql
|
||||
org_projects = Project.joins(team_projects: [team: :team_users]).where(team_users: {user_id: @owner.id}).to_sql
|
||||
projects = Project.from("( #{ normal_projects} UNION #{ org_projects } ) AS projects").distinct
|
||||
user_projects = User.current.logged? && (User.current.admin? || User.current.login == @owner.login) ? projects : projects.visible
|
||||
@projects_common_count = user_projects.common.size
|
||||
@projects_mirrior_count = user_projects.mirror.size
|
||||
@projects_sync_mirrior_count = user_projects.sync_mirror.size
|
||||
puts @owner.as_json
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
def org_limited_condition
|
||||
@owner.organization_extension.limited? && !current_user.logged?
|
||||
end
|
||||
|
||||
def org_privacy_condition
|
||||
return false if current_user.admin?
|
||||
@owner.organization_extension.privacy? && @owner.organization_users.where(user_id: current_user.id).blank?
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class PraiseTreadController < ApplicationController
|
||||
before_action :require_login, except: %i[index]
|
||||
before_action :require_profile_completed, only: [:like]
|
||||
before_action :find_project_with_id
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ class ProjectTrendsController < ApplicationController
|
|||
before_action :check_project_public
|
||||
|
||||
def index
|
||||
project_trends = @project.project_trends.includes(:user, trend: :user)
|
||||
project_trends = @project.project_trends.preload(:user, trend: :user)
|
||||
|
||||
check_time = params[:time] #时间的筛选
|
||||
check_type = params[:type] #动态类型的筛选,目前已知的有 Issue, PullRequest, Version
|
||||
|
|
@ -14,20 +14,25 @@ class ProjectTrendsController < ApplicationController
|
|||
project_trends = project_trends.where("created_at between ? and ?",(Time.now.beginning_of_day - check_time.days), Time.now.end_of_day)
|
||||
end
|
||||
|
||||
@project_open_issues_count = project_trends.where(trend_type: "Issue", action_type: "create").size
|
||||
@project_close_issues_count = project_trends.where(trend_type: "Issue", action_type: "close").size
|
||||
@project_issues_count = @project_open_issues_count + @project_close_issues_count
|
||||
|
||||
@project_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "close").size
|
||||
@project_new_pr_count = project_trends.where(trend_type: "PullRequest", action_type: "create").size
|
||||
@project_pr_all_count = @project_pr_count + @project_new_pr_count
|
||||
@project_issues_count = project_trends.where(trend_type: "Issue", action_type: "create").size
|
||||
@project_open_issues_count = @project_issues_count - @project_close_issues_count
|
||||
|
||||
@project_pr_count = project_trends.where(trend_type: "PullRequest", action_type: ["close", "merge"]).size
|
||||
@project_pr_all_count = project_trends.where(trend_type: "PullRequest", action_type: "create").size
|
||||
@project_new_pr_count = @project_pr_all_count - @project_pr_count
|
||||
if check_type.present?
|
||||
project_trends = project_trends.where(trend_type: check_type.to_s.strip)
|
||||
end
|
||||
|
||||
if check_status.present?
|
||||
project_trends = project_trends.where(action_type: check_status.to_s.strip)
|
||||
if check_status == "delay" || check_status == "close"
|
||||
project_trends = project_trends.where(action_type: ["close", "merge"])
|
||||
else
|
||||
project_trends = project_trends.where(action_type: ["create"]).where.not(trend_id: project_trends.where(action_type: ["close", "merge"]).pluck(:trend_id))
|
||||
end
|
||||
else
|
||||
project_trends = project_trends.where(action_type: "create")
|
||||
end
|
||||
project_trends = project_trends.order("created_at desc")
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class Projects::AppliedTransferProjectsController < Projects::BaseController
|
||||
before_action :check_auth
|
||||
before_action :check_user_profile_completed, only: [:create]
|
||||
|
||||
def organizations
|
||||
@organizations = Organization.includes(:organization_extension).joins(team_users: :team).where(team_users: {user_id: current_user.id}, teams: {authorize: %w(admin owner)})
|
||||
|
|
@ -23,4 +24,10 @@ class Projects::AppliedTransferProjectsController < Projects::BaseController
|
|||
def check_auth
|
||||
return render_forbidden unless current_user.admin? ||@project.owner?(current_user)
|
||||
end
|
||||
|
||||
def check_user_profile_completed
|
||||
@owner = Owner.find_by(login: params[:owner_name])
|
||||
return if @owner.is_a?(Organization)
|
||||
require_user_profile_completed(@owner)
|
||||
end
|
||||
end
|
||||
|
|
@ -4,4 +4,7 @@ class Projects::BaseController < ApplicationController
|
|||
before_action :load_project
|
||||
before_action :load_repository
|
||||
|
||||
def require_manager!
|
||||
return render_forbidden('你没有权限操作') unless current_user.admin? || @project.manager?(current_user)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
class Projects::ProjectAppliesController < Projects::BaseController
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
def create
|
||||
project = Projects::ApplyJoinService.call(current_user, create_params)
|
||||
render_ok(project_id: project.id)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ class Projects::ProjectUnitsController < Projects::BaseController
|
|||
def create
|
||||
if current_user.admin? || @project.manager?(current_user)
|
||||
ActiveRecord::Base.transaction do
|
||||
ProjectUnit.update_by_unit_types!(@project, unit_types)
|
||||
before_units, after_units = ProjectUnit.update_by_unit_types!(@project, unit_types)
|
||||
SendTemplateMessageJob.perform_later('ProjectSettingChanged', current_user.id, @project&.id, {navbar: true}) unless before_units.eql?(after_units) if Site.has_notice_menu?
|
||||
render_ok
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ class Projects::TeamsController < Projects::BaseController
|
|||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
@team_project = TeamProject.build(@owner.id, @operate_team.id, @project.id)
|
||||
Gitea::Organization::TeamProject::CreateService.call(@owner.gitea_token, @operate_team.gtid, @owner.login, @project.identifier)
|
||||
Gitea::Organization::TeamProject::CreateService.call(current_user.gitea_token, @operate_team.gtid, @owner.login, @project.identifier)
|
||||
render_ok
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
@ -25,7 +25,7 @@ class Projects::TeamsController < Projects::BaseController
|
|||
def destroy
|
||||
ActiveRecord::Base.transaction do
|
||||
@team_project.destroy!
|
||||
Gitea::Organization::TeamProject::DeleteService.call(@owner.gitea_token, @operate_team.gtid, @owner.login, @project.identifier)
|
||||
Gitea::Organization::TeamProject::DeleteService.call(current_user.gitea_token, @operate_team.gtid, @owner.login, @project.identifier)
|
||||
render_ok
|
||||
end
|
||||
rescue Exception => e
|
||||
|
|
|
|||
|
|
@ -0,0 +1,116 @@
|
|||
class Projects::WebhooksController < Projects::BaseController
|
||||
before_action :require_manager!
|
||||
before_action :find_webhook, only:[:edit, :update, :destroy, :tasks, :test]
|
||||
|
||||
def index
|
||||
@webhooks = @project.webhooks
|
||||
@webhooks = kaminari_paginate(@webhooks)
|
||||
end
|
||||
|
||||
def create
|
||||
ActiveRecord::Base.transaction do
|
||||
return render_error("webhooks数量已到上限!请删除暂不使用的webhooks以进行添加操作") if @project.webhooks.size > 19
|
||||
return render_error("参数错误.") unless webhook_params.present?
|
||||
form = Projects::Webhooks::CreateForm.new(webhook_params)
|
||||
return render json: {status: -1, message: form.errors} unless form.validate!
|
||||
response = Gitea::Repository::Webhooks::CreateService.new(operating_token, @project&.owner&.login, @project&.identifier, gitea_webhooks_params).call
|
||||
if response[0] == 201
|
||||
@webhook = response[2]
|
||||
else
|
||||
render_error("创建失败.")
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
||||
end
|
||||
|
||||
def update
|
||||
return render_error("参数错误.") unless webhook_params.present?
|
||||
form = Projects::Webhooks::CreateForm.new(webhook_params)
|
||||
return render json: {status: -1, message: form.errors} unless form.validate!
|
||||
response = Gitea::Repository::Webhooks::UpdateService.call(operating_token, @project&.owner&.login, @project&.identifier, @webhook.id, gitea_webhooks_params)
|
||||
if response[0] == 200
|
||||
@webhook = response[2]
|
||||
render_ok
|
||||
else
|
||||
render_error("更新失败.")
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
response = Gitea::Repository::Webhooks::DeleteService.call(operating_token, @project&.owner&.login, @project&.identifier, @webhook.id)
|
||||
if response[0] == 204
|
||||
@webhook = response[2]
|
||||
render_ok
|
||||
else
|
||||
render_error("删除失败.")
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def tasks
|
||||
@tasks = @webhook.tasks.where(is_delivered: true).order("delivered desc")
|
||||
@tasks = kaminari_paginate(@tasks)
|
||||
end
|
||||
|
||||
def test
|
||||
ActiveRecord::Base.transaction do
|
||||
response = Gitea::Repository::Webhooks::TestService.call(operating_token, @project&.owner&.login, @project&.identifier, @webhook.id)
|
||||
if response[0] == 204
|
||||
render_ok
|
||||
else
|
||||
render_error("测试推送失败.")
|
||||
end
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
def find_webhook
|
||||
@webhook = @project.webhooks.find_by_id(params[:id])
|
||||
return render_not_found if @webhook.nil?
|
||||
end
|
||||
|
||||
def webhook_params
|
||||
params.require(:webhook).permit(:url, :type, :http_method, :content_type, :secret, :active, :branch_filter, events: [])
|
||||
end
|
||||
|
||||
def webhook_type
|
||||
webhook_params.fetch(:type, "gitea")
|
||||
end
|
||||
|
||||
def webhook_branch_filter
|
||||
webhook_params.fetch(:branch_filter, "*")
|
||||
end
|
||||
|
||||
def gitea_webhooks_params
|
||||
{
|
||||
active: webhook_params[:active],
|
||||
branch_filter: webhook_branch_filter,
|
||||
config: {
|
||||
content_type: webhook_params[:content_type],
|
||||
url: webhook_params[:url],
|
||||
http_method: webhook_params[:http_method],
|
||||
secret: webhook_params[:secret]
|
||||
},
|
||||
events: webhook_params[:events],
|
||||
type: webhook_type,
|
||||
}
|
||||
end
|
||||
|
||||
def operating_token
|
||||
@project.member?(current_user) ? current_user.gitea_token : @project&.owner&.gitea_token
|
||||
end
|
||||
end
|
||||
|
|
@ -4,7 +4,8 @@ class ProjectsController < ApplicationController
|
|||
include ProjectsHelper
|
||||
include Acceleratorable
|
||||
|
||||
before_action :require_login, except: %i[index branches group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
|
||||
before_action :require_login, except: %i[index branches branches_slice group_type_list simple show fork_users praise_users watch_users recommend about menu_list]
|
||||
before_action :require_profile_completed, only: [:create, :migrate]
|
||||
before_action :load_repository, except: %i[index group_type_list migrate create recommend]
|
||||
before_action :authorizate_user_can_edit_project!, only: %i[update]
|
||||
before_action :project_public?, only: %i[fork_users praise_users watch_users]
|
||||
|
|
@ -16,17 +17,18 @@ class ProjectsController < ApplicationController
|
|||
menu.append(menu_hash_by_name("code")) if @project.has_menu_permission("code")
|
||||
menu.append(menu_hash_by_name("issues")) if @project.has_menu_permission("issues")
|
||||
menu.append(menu_hash_by_name("pulls")) if @project.has_menu_permission("pulls")
|
||||
menu.append(menu_hash_by_name("wiki")) if @project.has_menu_permission("wiki")
|
||||
menu.append(menu_hash_by_name("devops")) if @project.has_menu_permission("devops")
|
||||
menu.append(menu_hash_by_name("versions")) if @project.has_menu_permission("versions")
|
||||
menu.append(menu_hash_by_name("resources")) if @project.has_menu_permission("resources")
|
||||
menu.append(menu_hash_by_name("activity"))
|
||||
menu.append(menu_hash_by_name("setting")) if current_user.admin? || @project.manager?(current_user)
|
||||
menu.append(menu_hash_by_name("settings")) if current_user.admin? || @project.manager?(current_user)
|
||||
|
||||
render json: menu
|
||||
end
|
||||
|
||||
def index
|
||||
scope = Projects::ListQuery.call(params)
|
||||
scope = current_user.logged? ? Projects::ListQuery.call(params, current_user.id) : Projects::ListQuery.call(params)
|
||||
|
||||
# @projects = kaminari_paginate(scope)
|
||||
@projects = paginate scope.includes(:project_category, :project_language, :repository, :project_educoder, :owner, :project_units)
|
||||
|
|
@ -84,6 +86,13 @@ class ProjectsController < ApplicationController
|
|||
@branches = result.is_a?(Hash) && result.key?(:status) ? [] : result
|
||||
end
|
||||
|
||||
def branches_slice
|
||||
return @branches = [] unless @project.forge?
|
||||
|
||||
slice_result = Gitea::Repository::Branches::ListSliceService.call(@owner, @project.identifier)
|
||||
@branches_slice = slice_result.is_a?(Hash) && slice_result.key?(:status) ? [] : slice_result
|
||||
end
|
||||
|
||||
def group_type_list
|
||||
project_statics = ProjectStatistic.first
|
||||
|
||||
|
|
@ -108,13 +117,19 @@ class ProjectsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
# TODO:
|
||||
# 临时特殊处理修改website、lesson_url操作方法
|
||||
if project_params.has_key?("website")
|
||||
if project_params.has_key?("website")
|
||||
@project.update(project_params)
|
||||
elsif project_params.has_key?("default_branch")
|
||||
@project.update(project_params)
|
||||
gitea_params = {
|
||||
default_branch: @project.default_branch
|
||||
}
|
||||
Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params)
|
||||
else
|
||||
validate_params = project_params.slice(:name, :description,
|
||||
:project_category_id, :project_language_id, :private)
|
||||
:project_category_id, :project_language_id, :private, :identifier)
|
||||
|
||||
Projects::UpdateForm.new(validate_params).validate!
|
||||
Projects::UpdateForm.new(validate_params.merge(user_id: @project.user_id, project_identifier: @project.identifier)).validate!
|
||||
|
||||
private = @project.forked_from_project.present? ? !@project.forked_from_project.is_public : params[:private] || false
|
||||
|
||||
|
|
@ -124,13 +139,13 @@ class ProjectsController < ApplicationController
|
|||
gitea_params = {
|
||||
private: private,
|
||||
default_branch: @project.default_branch,
|
||||
website: @project.website
|
||||
website: @project.website,
|
||||
name: @project.identifier
|
||||
}
|
||||
if [true, false].include? private
|
||||
Gitea::Repository::UpdateService.call(@owner, @project.identifier, gitea_params)
|
||||
@project.repository.update_column(:hidden, private)
|
||||
end
|
||||
gitea_repo = Gitea::Repository::UpdateService.call(@owner, @project&.repository&.identifier, gitea_params)
|
||||
@project.repository.update_attributes({hidden: gitea_repo["private"], identifier: gitea_repo["name"]})
|
||||
end
|
||||
SendTemplateMessageJob.perform_later('ProjectSettingChanged', current_user.id, @project&.id, @project.previous_changes.slice(:name, :description, :project_category_id, :project_language_id, :is_public, :identifier)) if Site.has_notice_menu?
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
|
|
@ -213,7 +228,7 @@ class ProjectsController < ApplicationController
|
|||
|
||||
private
|
||||
def project_params
|
||||
params.permit(:user_id, :name, :description, :repository_name, :website, :lesson_url,
|
||||
params.permit(:user_id, :name, :description, :repository_name, :website, :lesson_url, :default_branch, :identifier,
|
||||
:project_category_id, :project_language_id, :license_id, :ignore_id, :private)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
class PublicKeysController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_public_key, only: [:destroy]
|
||||
|
||||
def index
|
||||
@public_keys = current_user.public_keys
|
||||
@public_keys = kaminari_paginate(@public_keys)
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def create
|
||||
return render_error("参数错误") if public_key_params.blank?
|
||||
return render_ok({status: 10002, message: "请输入密钥"}) if public_key_params[:key].blank?
|
||||
return render_ok({status: 10001, message: "请输入标题"}) if public_key_params[:title].blank?
|
||||
@gitea_response = Gitea::User::Keys::CreateService.call(current_user.gitea_token, public_key_params)
|
||||
if @gitea_response[0] == 201
|
||||
@public_key = @gitea_response[2]
|
||||
else
|
||||
return render_error("创建ssh key失败") if @gitea_response[2].blank?
|
||||
return render_ok({status: 10002, message: "密钥格式不正确"}) if @gitea_response[2]["message"].starts_with?("Invalid key content")
|
||||
exist_public_key = Gitea::PublicKey.find_by(content: public_key_params[:key])
|
||||
return render_ok({status: 10002, message: "密钥已被占用"}) if @gitea_response[2]["message"].starts_with?("Key content has been used as non-deploy key") && exist_public_key.present? && exist_public_key&.owner_id != current_user.gitea_uid
|
||||
return render_ok({status: 10002, message: "密钥已存在,请勿重复添加"}) if @gitea_response[2]["message"].starts_with?("Key content has been used as non-deploy key")
|
||||
@public_key = nil
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def destroy
|
||||
return render_not_found unless @public_key.present?
|
||||
result = Gitea::User::Keys::DeleteService.call(current_user.gitea_token, @public_key.id)
|
||||
if result[0] == 204
|
||||
render_ok
|
||||
else
|
||||
render_error
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def page
|
||||
params[:page].to_i.zero? ? 1 : params[:page].to_i
|
||||
end
|
||||
|
||||
def limit
|
||||
limit = params[:limit] || params[:per_page]
|
||||
limit = (limit.to_i.zero? || limit.to_i > 15) ? 15 : limit.to_i
|
||||
end
|
||||
|
||||
def public_key_params
|
||||
params.require(:public_key).permit(:key, :title)
|
||||
end
|
||||
|
||||
def find_public_key
|
||||
@public_key = current_user.public_keys.find_by_id(params[:id])
|
||||
end
|
||||
end
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
class PullRequestsController < ApplicationController
|
||||
before_action :require_login, except: [:index, :show, :files, :commits]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_repository
|
||||
before_action :check_menu_authorize
|
||||
before_action :find_pull_request, except: [:index, :new, :create, :check_can_merge,:get_branches,:create_merge_infos, :files, :commits]
|
||||
before_action :load_pull_request, only: [:files, :commits]
|
||||
include TagChosenHelper
|
||||
|
|
@ -8,7 +10,6 @@ class PullRequestsController < ApplicationController
|
|||
|
||||
|
||||
def index
|
||||
return render_not_found unless @project.has_menu_permission("pulls")
|
||||
# @issues = Gitea::PullRequest::ListService.new(@user,@repository.try(:identifier)).call #通过gitea获取
|
||||
issues = @project.issues.issue_pull_request.issue_index_includes.includes(pull_request: :user)
|
||||
issues = issues.where(is_private: false) unless current_user.present? && (current_user.admin? || @project.member?(current_user))
|
||||
|
|
@ -19,6 +20,7 @@ class PullRequestsController < ApplicationController
|
|||
@close_issues = @filter_issues.joins(:pull_request).where(pull_requests: {status: PullRequest::CLOSED})
|
||||
@merged_issues = @filter_issues.joins(:pull_request).where(pull_requests: {status: PullRequest::MERGED})
|
||||
@user_admin_or_member = current_user.present? && (current_user.admin || @project.member?(current_user))
|
||||
@user_admin_or_developer = current_user.present? && (current_user.admin || @project.all_developers.include?(current_user))
|
||||
|
||||
scopes = Issues::ListQueryService.call(issues,params.delete_if{|k,v| v.blank?}, "PullRequest")
|
||||
@issues_size = scopes.size
|
||||
|
|
@ -57,7 +59,8 @@ class PullRequestsController < ApplicationController
|
|||
@pull_request, @gitea_pull_request = PullRequests::CreateService.call(current_user, @owner, @project, params)
|
||||
if @gitea_pull_request[:status] == :success
|
||||
@pull_request.bind_gitea_pull_request!(@gitea_pull_request[:body]["number"], @gitea_pull_request[:body]["id"])
|
||||
render_ok
|
||||
SendTemplateMessageJob.perform_later('PullRequestAssigned', current_user.id, @pull_request&.id) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('ProjectPullRequest', current_user.id, @pull_request&.id) if Site.has_notice_menu?
|
||||
else
|
||||
render_error("create pull request error: #{@gitea_pull_request[:status]}")
|
||||
raise ActiveRecord::Rollback
|
||||
|
|
@ -66,21 +69,22 @@ class PullRequestsController < ApplicationController
|
|||
end
|
||||
|
||||
def edit
|
||||
@fork_project_user_name = @project&.fork_project&.owner.try(:show_real_name)
|
||||
@fork_project_user = @project&.fork_project&.owner.try(:login)
|
||||
@fork_project_identifier = @project&.fork_project&.repository.try(:identifier)
|
||||
@fork_project_user_name = @pull_request&.fork_project&.owner.try(:show_real_name)
|
||||
@fork_project_user = @pull_request&.fork_project&.owner.try(:login)
|
||||
@fork_project_identifier = @pull_request&.fork_project&.repository.try(:identifier)
|
||||
end
|
||||
|
||||
def update
|
||||
if params[:title].nil?
|
||||
normal_status(-1, "名称不能为空")
|
||||
elsif params[:issue_tag_ids].nil?
|
||||
normal_status(-1, "标签不能为空")
|
||||
normal_status(-1, "标记不能为空")
|
||||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
merge_params
|
||||
|
||||
@issue&.issue_tags_relates&.destroy_all if params[:issue_tag_ids].blank?
|
||||
if params[:issue_tag_ids].present? && !@issue&.issue_tags_relates.where(issue_tag_id: params[:issue_tag_ids]).exists?
|
||||
@issue&.issue_tags_relates&.destroy_all
|
||||
params[:issue_tag_ids].each do |tag|
|
||||
|
|
@ -114,6 +118,8 @@ class PullRequestsController < ApplicationController
|
|||
normal_status(-1, e.message)
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
SendTemplateMessageJob.perform_later('PullRequestChanged', current_user.id, @pull_request&.id, @issue.previous_changes.slice(:assigned_to_id, :priority_id, :fixed_version_id, :issue_tags_value)) if Site.has_notice_menu?
|
||||
SendTemplateMessageJob.perform_later('PullRequestAssigned', current_user.id, @pull_request&.id ) if @issue.previous_changes[:assigned_to_id].present? && Site.has_notice_menu?
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -123,7 +129,13 @@ class PullRequestsController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
colsed = PullRequests::CloseService.call(@owner, @repository, @pull_request, current_user)
|
||||
colsed === true ? normal_status(1, "已拒绝") : normal_status(-1, '合并失败')
|
||||
if colsed === true
|
||||
@pull_request.project_trends.create!(user: current_user, project: @project,action_type: ProjectTrend::CLOSE)
|
||||
SendTemplateMessageJob.perform_later('PullRequestClosed', current_user.id, @pull_request.id) if Site.has_notice_menu?
|
||||
normal_status(1, "已拒绝")
|
||||
else
|
||||
normal_status(-1, '合并失败')
|
||||
end
|
||||
rescue => e
|
||||
normal_status(-1, e.message)
|
||||
raise ActiveRecord::Rollback
|
||||
|
|
@ -150,11 +162,20 @@ class PullRequestsController < ApplicationController
|
|||
else
|
||||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
result = PullRequests::MergeService.call(@owner, @repository, @pull_request, current_user, params)
|
||||
@gitea_pull = Gitea::PullRequest::GetService.call(@owner.login, @repository.identifier, @pull_request.gitea_number, current_user&.gitea_token)
|
||||
|
||||
if result.status == 200 && @pull_request.merge!
|
||||
@pull_request.project_trend_status!
|
||||
if @gitea_pull["merged_by"].present?
|
||||
success_condition = true
|
||||
else
|
||||
result = PullRequests::MergeService.call(@owner, @repository, @pull_request, current_user, params)
|
||||
success_condition = result.status == 200
|
||||
end
|
||||
|
||||
if success_condition && @pull_request.merge!
|
||||
# @pull_request.project_trend_status!
|
||||
@pull_request.project_trends.create!(user: current_user, project: @project,action_type: ProjectTrend::MERGE)
|
||||
@issue&.custom_journal_detail("merge", "", "该合并请求已被合并", current_user&.id)
|
||||
SendTemplateMessageJob.perform_later('PullRequestMerged', current_user.id, @pull_request.id) if Site.has_notice_menu?
|
||||
normal_status(1, "合并成功")
|
||||
else
|
||||
normal_status(-1, result.message)
|
||||
|
|
@ -181,7 +202,7 @@ class PullRequestsController < ApplicationController
|
|||
if can_merge.present?
|
||||
render json: {
|
||||
status: -2,
|
||||
message: "在这些分支之间的合并请求已存在:<a href='/projects/#{@owner.login}/#{@project.identifier}/pulls/#{can_merge.first.id}/Messagecount''>#{can_merge.first.try(:title)}</a>",
|
||||
message: "在这些分支之间的合并请求已存在:<a href='/#{@owner.login}/#{@project.identifier}/pulls/#{can_merge.first.id}''>#{can_merge.first.try(:title)}</a>",
|
||||
}
|
||||
else
|
||||
normal_status(0, "可以合并")
|
||||
|
|
@ -252,4 +273,8 @@ class PullRequestsController < ApplicationController
|
|||
status_id: 1,
|
||||
}
|
||||
end
|
||||
|
||||
def check_menu_authorize
|
||||
return render_not_found unless @project.has_menu_permission("pulls")
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
class RepositoriesController < ApplicationController
|
||||
include RepositoriesHelper
|
||||
include ApplicationHelper
|
||||
include OperateProjectAbilityAble
|
||||
include Repository::LanguagesPercentagable
|
||||
|
||||
before_action :require_login, only: %i[edit update create_file update_file delete_file sync_mirror]
|
||||
before_action :require_profile_completed, only: [:create_file]
|
||||
before_action :load_repository
|
||||
before_action :authorizate!, except: [:sync_mirror, :tags, :commit, :archive]
|
||||
before_action :authorizate_user_can_edit_repo!, only: %i[sync_mirror]
|
||||
|
|
@ -53,16 +55,6 @@ class RepositoriesController < ApplicationController
|
|||
@entries = Gitea::Repository::Entries::ListService.new(@owner, @project.identifier, ref: @ref).call
|
||||
@entries = @entries.present? ? @entries.sort_by{ |hash| hash['type'] } : []
|
||||
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||
|
||||
# TODO
|
||||
# 临时处理readme文件问题
|
||||
result = Gitea::Repository::Readme::GetService.call(@owner.login, @project.identifier, @ref, @owner&.gitea_token)
|
||||
@readme =
|
||||
if result[:status] == :success
|
||||
result[:body]
|
||||
else
|
||||
{}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -72,6 +64,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def sub_entries
|
||||
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
|
||||
@path = Gitea.gitea_config[:domain]+"/#{@project.owner.login}/#{@project.identifier}/raw/branch/#{@ref}/"
|
||||
|
||||
if @project.educoder?
|
||||
if params[:type] === 'file'
|
||||
|
|
@ -102,10 +95,21 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def commits
|
||||
@hash_commit = Gitea::Repository::Commits::ListService.new(@owner.login, @project.identifier,
|
||||
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
|
||||
if params[:filepath].present?
|
||||
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
|
||||
@hash_commit = Gitea::Repository::Commits::FileListService.new(@owner.login, @project.identifier, file_path_uri,
|
||||
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
|
||||
else
|
||||
@hash_commit = Gitea::Repository::Commits::ListService.new(@owner.login, @project.identifier,
|
||||
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token).call
|
||||
end
|
||||
end
|
||||
|
||||
def commits_slice
|
||||
@hash_commit = Gitea::Repository::Commits::ListSliceService.call(@owner.login, @project.identifier,
|
||||
sha: params[:sha], page: params[:page], limit: params[:limit], token: current_user&.gitea_token)
|
||||
end
|
||||
|
||||
def commit
|
||||
@sha = params[:sha]
|
||||
@commit = Gitea::Repository::Commits::GetService.call(@owner.login, @repository.identifier, @sha, current_user&.gitea_token)
|
||||
|
|
@ -119,7 +123,11 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def contributors
|
||||
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
|
||||
if params[:filepath].present?
|
||||
@contributors = []
|
||||
else
|
||||
@contributors = Gitea::Repository::Contributors::GetService.call(@owner, @repository.identifier)
|
||||
end
|
||||
end
|
||||
|
||||
def edit
|
||||
|
|
@ -182,10 +190,16 @@ class RepositoriesController < ApplicationController
|
|||
end
|
||||
|
||||
def readme
|
||||
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repository.identifier, params[:ref], current_user&.gitea_token)
|
||||
|
||||
if params[:filepath].present?
|
||||
result = Gitea::Repository::Readme::DirService.call(@owner.login, @repository.identifier, params[:filepath], params[:ref], current_user&.gitea_token)
|
||||
else
|
||||
result = Gitea::Repository::Readme::GetService.call(@owner.login, @repository.identifier, params[:ref], current_user&.gitea_token)
|
||||
end
|
||||
@readme = result[:status] === :success ? result[:body] : nil
|
||||
render json: @readme
|
||||
@readme['content'] = decode64_content(@readme, @owner, @repository, params[:ref])
|
||||
render json: @readme.slice("type", "encoding", "size", "name", "path", "content", "sha")
|
||||
rescue
|
||||
render json: nil
|
||||
end
|
||||
|
||||
def languages
|
||||
|
|
@ -204,6 +218,17 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
redirect_to file_path
|
||||
end
|
||||
|
||||
def raw
|
||||
domain = Gitea.gitea_config[:domain]
|
||||
api_url = Gitea.gitea_config[:base_url]
|
||||
|
||||
url = "/repos/#{@owner.login}/#{@repository.identifier}/raw/#{params[:filepath]}?ref=#{params[:ref]}"
|
||||
file_path = [domain, api_url, url].join
|
||||
file_path = [file_path, "access_token=#{current_user&.gitea_token}"].join("&") if @repository.hidden?
|
||||
|
||||
redirect_to URI.escape(file_path)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
|
|
@ -225,8 +250,14 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
# TODO 获取最新commit信息
|
||||
def project_commits
|
||||
Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
|
||||
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
|
||||
if params[:filepath].present?
|
||||
file_path_uri = URI.parse(URI.encode(params[:filepath].to_s.strip))
|
||||
Gitea::Repository::Commits::FileListService.new(@project.owner.login, @project.identifier, file_path_uri,
|
||||
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
|
||||
else
|
||||
Gitea::Repository::Commits::ListService.new(@project.owner.login, @project.identifier,
|
||||
sha: get_ref, page: 1, limit: 1, token: current_user&.gitea_token).call
|
||||
end
|
||||
end
|
||||
|
||||
def get_statistics
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ class SettingsController < ApplicationController
|
|||
get_common_menu
|
||||
get_personal_menu
|
||||
get_third_party
|
||||
get_top_system_notification
|
||||
end
|
||||
|
||||
private
|
||||
|
|
@ -47,6 +48,10 @@ class SettingsController < ApplicationController
|
|||
url: EducoderOauth.oauth_url
|
||||
}
|
||||
end
|
||||
|
||||
def get_top_system_notification
|
||||
@top_system_notification = SystemNotification.is_top.first
|
||||
end
|
||||
|
||||
def get_site_url(key, value)
|
||||
key.to_s === "url" ? append_http(reset_site_url(value)) : reset_site_url(value)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
class TemplateMessageSettingsController < ApplicationController
|
||||
before_action :require_login
|
||||
|
||||
def index
|
||||
@group_settings = TemplateMessageSetting.group(:type).count
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -5,7 +5,7 @@ class Users::BaseController < ApplicationController
|
|||
helper_method :observed_logged_user?, :observed_user
|
||||
|
||||
def observed_user
|
||||
@_observed_user ||= (User.find_by_id(params[:user_id]) || User.find_by_login(params[:user_id]))
|
||||
@_observed_user ||= (User.find_by_login(params[:user_id]) || User.find_by_id(params[:user_id]))
|
||||
end
|
||||
|
||||
def observed_logged_user?
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class Users::HeadmapsController < Users::BaseController
|
||||
def index
|
||||
result = Gitea::User::HeadmapService.call(observed_user.login, start_stamp, end_stamp)
|
||||
@headmaps = result[2]
|
||||
@headmaps = result[2].blank? ? [] : result[2]
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
class Users::MessagesController < Users::BaseController
|
||||
before_action :private_user_resources!
|
||||
before_action :find_receivers, only: [:create]
|
||||
|
||||
def index
|
||||
limit = params[:limit] || params[:per_page]
|
||||
limit = (limit.to_i.zero? || limit.to_i > 15) ? 15 : limit.to_i
|
||||
page = params[:page].to_i.zero? ? 1 : params[:page].to_i
|
||||
result = Notice::Read::ListService.call(observed_user.id, message_type, message_status, page, limit)
|
||||
return render_error if result.nil?
|
||||
@data = result[2]
|
||||
end
|
||||
|
||||
def create
|
||||
return render_forbidden unless %w(atme).include?(params[:type])
|
||||
case params[:type]
|
||||
when 'atme'
|
||||
Notice::Write::CreateAtmeForm.new(atme_params).validate!
|
||||
case atme_params[:atmeable_type]
|
||||
when 'Issue'
|
||||
SendTemplateMessageJob.perform_now('IssueAtme', @receivers, current_user.id, atme_params[:atmeable_id]) if Site.has_notice_menu?
|
||||
when 'PullRequest'
|
||||
SendTemplateMessageJob.perform_now('PullRequestAtme', @receivers, current_user.id, atme_params[:atmeable_id]) if Site.has_notice_menu?
|
||||
when 'Journal'
|
||||
journal = Journal.find_by_id(atme_params[:atmeable_id])
|
||||
if journal.present?
|
||||
if journal&.issue&.pull_request.present?
|
||||
SendTemplateMessageJob.perform_now('PullRequestAtme', @receivers, current_user.id, atme_params[:atmeable_id]) if Site.has_notice_menu?
|
||||
else
|
||||
SendTemplateMessageJob.perform_now('IssueAtme', @receivers, current_user.id, atme_params[:atmeable_id]) if Site.has_notice_menu?
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
render_ok
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def delete
|
||||
return render_forbidden unless %w(atme).include?(params[:type])
|
||||
result = Notice::Write::DeleteService.call(params[:ids], observed_user.id, message_type)
|
||||
return render_error if result.nil?
|
||||
|
||||
render_ok
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
def read
|
||||
return render_forbidden unless %w(notification atme).include?(params[:type])
|
||||
result = Notice::Write::ChangeStatusService.call(params[:ids], observed_user.id, message_type)
|
||||
if result.nil?
|
||||
render_error
|
||||
else
|
||||
render_ok
|
||||
end
|
||||
rescue Exception => e
|
||||
uid_logger_error(e.message)
|
||||
tip_exception(e.message)
|
||||
end
|
||||
|
||||
private
|
||||
def message_type
|
||||
@message_type = begin
|
||||
case params[:type]
|
||||
when "notification" then 1
|
||||
when "atme" then 2
|
||||
else
|
||||
-1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def message_status
|
||||
@message_status = begin
|
||||
case params[:status]
|
||||
when "1" then 1
|
||||
when "2" then 2
|
||||
else
|
||||
-1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def atme_params
|
||||
params.permit(:atmeable_type, :atmeable_id, receivers_login: [])
|
||||
end
|
||||
|
||||
def find_receivers
|
||||
@receivers = User.where(login: params[:receivers_login])
|
||||
return render_not_found if @receivers.size == 0
|
||||
end
|
||||
end
|
||||
|
|
@ -14,7 +14,7 @@ class Users::StatisticsController < Users::BaseController
|
|||
@date_data << date.strftime("%Y.%m.%d")
|
||||
@issue_data << observed_user.issues.where("DATE(created_on) = ?", date).size
|
||||
@pull_request_data << observed_user.pull_requests.where("DATE(created_at) = ?", date).size
|
||||
date_commit_data = commit_data.select{|item| item["timestamp"] == date.to_time.to_i}
|
||||
date_commit_data = commit_data.blank? ? nil : commit_data.select{|item| item["timestamp"] == date.to_time.to_i}
|
||||
@commit_data << (date_commit_data.blank? ? 0 : date_commit_data[0]["contributions"].to_i)
|
||||
end
|
||||
render :json => {dates: @date_data, issues_count: @issue_data, pull_requests_count: @pull_request_data, commits_count: @commit_data}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,36 @@
|
|||
class Users::TemplateMessageSettingsController < Users::BaseController
|
||||
before_action :check_auth
|
||||
before_action :get_current_setting
|
||||
|
||||
def current_setting
|
||||
|
||||
end
|
||||
|
||||
def update_setting
|
||||
Rails.logger.info setting_params[:notification_body]
|
||||
Rails.logger.info setting_params[:email_body]
|
||||
|
||||
@current_setting.notification_body = setting_params[:notification_body].to_hash
|
||||
@current_setting.email_body = setting_params[:email_body].to_hash
|
||||
return render_error("保存失败") unless @current_setting.save!
|
||||
end
|
||||
|
||||
private
|
||||
def check_auth
|
||||
return render_forbidden unless current_user.admin? || observed_logged_user?
|
||||
end
|
||||
|
||||
def get_current_setting
|
||||
@current_setting = @_observed_user.user_template_message_setting
|
||||
@current_setting = UserTemplateMessageSetting.build(@_observed_user.id) if @current_setting.nil?
|
||||
end
|
||||
|
||||
def setting_params
|
||||
params.require(:setting).permit(notification_body: {}, email_body: {})
|
||||
end
|
||||
|
||||
def valid_setting_params
|
||||
setting_params[:notification_body].keys.equal?(UserTemplateMessageSetting.init_notification_body.keys) && setting_params[:email_body].keys.equal?(UserTemplateMessageSetting.init_email_body)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
@ -74,7 +74,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def update
|
||||
return render_not_found unless @user = User.find_by_id(params[:id]) || User.find_by(login: params[:id])
|
||||
return render_not_found unless @user = User.find_by(login: params[:id]) || User.find_by_id(params[:id])
|
||||
return render_forbidden unless User.current.logged? && (current_user&.admin? || current_user.id == @user.id)
|
||||
Util.write_file(@image, avatar_path(@user)) if user_params[:image].present?
|
||||
@user.attributes = user_params.except(:image)
|
||||
|
|
@ -91,6 +91,12 @@ class UsersController < ApplicationController
|
|||
def get_user_info
|
||||
begin
|
||||
@user = current_user
|
||||
begin
|
||||
result = Notice::Read::CountService.call(current_user.id)
|
||||
@message_unread_total = result.nil? ? 0 : result[2]["unread_notification"]
|
||||
rescue
|
||||
@message_unread_total = 0
|
||||
end
|
||||
# TODO 等消息上线再打开注释
|
||||
#@tidding_count = unviewed_tiddings(current_user) if current_user.present?
|
||||
rescue Exception => e
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
class VersionReleasesController < ApplicationController
|
||||
before_action :load_repository
|
||||
before_action :set_user
|
||||
before_action :require_login, except: [:index]
|
||||
before_action :find_version , only: [:edit, :update, :destroy]
|
||||
before_action :require_login, except: [:index, :show]
|
||||
before_action :check_release_authorize, except: [:index, :show]
|
||||
before_action :find_version , only: [:show, :edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
version_releases = Gitea::Versions::ListService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier)).call
|
||||
@version_releases = version_releases
|
||||
@user_permission = current_user.present? && (current_user == @user || current_user.admin?)
|
||||
@forge_releases = @repository.version_releases.select(:id,:version_gid, :created_at).includes(:attachments)
|
||||
@version_releases = kaminari_paginate(@repository.version_releases.order(created_at: :desc))
|
||||
@user_permission = current_user.present? && (@repository.project.all_developers.include?(current_user) || current_user.admin?)
|
||||
@user_admin_permission = current_user.present? && (@repository.project.all_managers.include?(current_user) || current_user.admin?)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
@ -22,6 +22,10 @@ class VersionReleasesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def show
|
||||
# @release = Gitea::Versions::GetService.call(current_user.gitea_token, @user&.login, @repository&.identifier, @version&.version_gid)
|
||||
end
|
||||
|
||||
def create
|
||||
if params[:name].nil?
|
||||
normal_status(-1, "名称不能为空")
|
||||
|
|
@ -37,13 +41,14 @@ class VersionReleasesController < ApplicationController
|
|||
version_params = releases_params
|
||||
version_release = VersionRelease.new(version_params.merge(user_id: current_user.id, repository_id: @repository.id))
|
||||
if version_release.save!
|
||||
git_version_release = Gitea::Versions::CreateService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params).call
|
||||
git_version_release = Gitea::Versions::CreateService.new(current_user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params).call
|
||||
if git_version_release
|
||||
update_params = {
|
||||
tarball_url: git_version_release["tarball_url"],
|
||||
zipball_url: git_version_release["zipball_url"],
|
||||
url: git_version_release["url"],
|
||||
version_gid: git_version_release["id"],
|
||||
sha: git_version_release["sha"]
|
||||
}
|
||||
version_release.update_attributes!(update_params)
|
||||
version_release.project_trends.create(user_id: current_user.id, project_id: @project.id, action_type: "create")
|
||||
|
|
@ -81,7 +86,7 @@ class VersionReleasesController < ApplicationController
|
|||
|
||||
if @version.update_attributes!(version_params)
|
||||
create_attachments(params[:attachment_ids], @version) if params[:attachment_ids].present?
|
||||
git_version_release = Gitea::Versions::UpdateService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params, @version.try(:version_gid)).call
|
||||
git_version_release = Gitea::Versions::UpdateService.new(current_user.gitea_token, @user.try(:login), @repository.try(:identifier), version_params, @version.try(:version_gid)).call
|
||||
unless git_version_release
|
||||
raise Error, "更新失败"
|
||||
end
|
||||
|
|
@ -102,7 +107,7 @@ class VersionReleasesController < ApplicationController
|
|||
ActiveRecord::Base.transaction do
|
||||
begin
|
||||
if @version.destroy
|
||||
git_version_release = Gitea::Versions::DeleteService.new(@user.gitea_token, @user.try(:login), @repository.try(:identifier), @version.try(:version_gid)).call
|
||||
git_version_release = Gitea::Versions::DeleteService.new(current_user.gitea_token, @user.try(:login), @repository.try(:identifier), @version.try(:version_gid)).call
|
||||
|
||||
if git_version_release.status == 204
|
||||
normal_status(0, "删除成功")
|
||||
|
|
@ -157,4 +162,8 @@ class VersionReleasesController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def check_release_authorize
|
||||
return render_forbidden("您没有权限进行此操作.") unless current_user.admin? || @project.manager?(current_user)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,11 +1,12 @@
|
|||
class VersionsController < ApplicationController
|
||||
before_action :require_login, except: [:index, :show]
|
||||
before_action :require_profile_completed, only: [:create]
|
||||
before_action :load_repository
|
||||
before_action :check_menu_authorize
|
||||
before_action :check_issue_permission, except: [:show, :index]
|
||||
before_action :set_version, only: [:edit, :update, :destroy, :show,:update_status]
|
||||
|
||||
def index
|
||||
return render_not_found unless @project.has_menu_permission("versions")
|
||||
@user_admin_or_member = current_user.present? && (current_user.admin || @project.member?(current_user))
|
||||
status = params[:status]
|
||||
versions = @project.versions.version_includes
|
||||
|
|
@ -182,4 +183,8 @@ class VersionsController < ApplicationController
|
|||
%w(desc asc).include?(params[:order_type]) ? params[:order_type] : 'desc'
|
||||
end
|
||||
|
||||
def check_menu_authorize
|
||||
return render_not_found unless @project.has_menu_permission("versions")
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class WatchersController < ApplicationController
|
||||
before_action :require_login, except: %i[index]
|
||||
before_action :require_profile_completed, only: [:follow]
|
||||
# before_action :find_project_with_id
|
||||
before_action :get_target
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
build/
|
||||
.github/
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# EditorConfig is awesome: https://EditorConfig.org
|
||||
|
||||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Unix-style newlines with a newline ending every file
|
||||
[*]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.rb]
|
||||
charset = utf-8
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
|
|
@ -1 +0,0 @@
|
|||
source/javascripts/lib/* linguist-vendored
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
---
|
||||
name: Report a Bug
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Bug Description**
|
||||
A clear and concise description of what the bug is and how to reproduce it.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Browser (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Last upstream Slate commit (run `git log --author="Robert Lord" | head -n 1`):**
|
||||
Put the commit hash here
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: Questions, Ideas, Discussions
|
||||
url: https://github.com/slatedocs/slate/discussions
|
||||
about: Ask and answer questions, and propose new features.
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
<!--
|
||||
⚠️ 🚨 ⚠️ STOP AND READ THIS ⚠️ 🚨 ⚠️
|
||||
|
||||
👆👆 see that 'base fork' dropdown above? You should change it! The default value of "slatedocs/slate" submits your change to ALL USERS OF SLATE, not just your company. This is PROBABLY NOT WHAT YOU WANT.
|
||||
-->
|
||||
|
|
@ -1,42 +0,0 @@
|
|||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ '*' ]
|
||||
pull_request:
|
||||
branches: [ '*' ]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ matrix.ruby-version }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: gems-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
gems-${{ runner.os }}-${{ matrix.ruby-version }}-
|
||||
gems-${{ runner.os }}-
|
||||
|
||||
# necessary to get ruby 2.3 to work nicely with bundler vendor/bundle cache
|
||||
# can remove once ruby 2.3 is no longer supported
|
||||
- run: gem update --system
|
||||
|
||||
- run: bundle config set deployment 'true'
|
||||
- name: bundle install
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- run: bundle exec middleman build
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
name: Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'main' ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ruby-version: 2.5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.ruby-version }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: gems-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
gems-${{ runner.os }}-${{ matrix.ruby-version }}-
|
||||
gems-${{ runner.os }}-
|
||||
|
||||
- run: bundle config set deployment 'true'
|
||||
- name: bundle install
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- run: bundle exec middleman build
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./build
|
||||
keep_files: true
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
name: Dev Deploy
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ 'dev' ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ruby-version: 2.5
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: ${{ env.ruby-version }}
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: vendor/bundle
|
||||
key: gems-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
|
||||
restore-keys: |
|
||||
gems-${{ runner.os }}-${{ matrix.ruby-version }}-
|
||||
gems-${{ runner.os }}-
|
||||
|
||||
- run: bundle config set deployment 'true'
|
||||
- name: bundle install
|
||||
run: |
|
||||
bundle config path vendor/bundle
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- run: bundle exec middleman build
|
||||
|
||||
- name: Push to Docker Hub
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_KEY }}
|
||||
repository: slatedocs/slate
|
||||
tag_with_ref: true
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v3.7.0-8
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
destination_dir: dev
|
||||
publish_dir: ./build
|
||||
keep_files: true
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
name: Publish Docker image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to Docker Hub
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Push to Docker Hub
|
||||
uses: docker/build-push-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_ACCESS_KEY }}
|
||||
repository: slatedocs/slate
|
||||
tag_with_ref: true
|
||||
tags: latest
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
*.gem
|
||||
*.rbc
|
||||
.bundle
|
||||
.config
|
||||
coverage
|
||||
InstalledFiles
|
||||
lib/bundler/man
|
||||
pkg
|
||||
rdoc
|
||||
spec/reports
|
||||
test/tmp
|
||||
test/version_tmp
|
||||
tmp
|
||||
*.DS_STORE
|
||||
build/
|
||||
.cache
|
||||
.vagrant
|
||||
.sass-cache
|
||||
|
||||
# YARD artifacts
|
||||
.yardoc
|
||||
_yardoc
|
||||
doc/
|
||||
.idea/
|
||||
|
||||
# Vagrant artifacts
|
||||
ubuntu-*-console.log
|
||||
|
|
@ -1,254 +0,0 @@
|
|||
# Changelog
|
||||
|
||||
## Version 2.8.0
|
||||
|
||||
*October 27, 2020*
|
||||
|
||||
* Remove last trailing newline when using the copy code button
|
||||
* Rework docker image and make available at slatedocs/slate
|
||||
* Improve Dockerfile layout to improve caching (thanks @micvbang)
|
||||
* Bump rouge from 3.20 to 3.24
|
||||
* Bump nokogiri from 1.10.9 to 1.10.10
|
||||
* Bump middleman from 4.3.8 to 4.3.11
|
||||
* Bump lunr.js from 2.3.8 to 2.3.9
|
||||
|
||||
## Version 2.7.1
|
||||
|
||||
*August 13, 2020*
|
||||
|
||||
* __[security]__ Bumped middleman from 4.3.7 to 4.3.8
|
||||
|
||||
_Note_: Slate uses redcarpet, not kramdown, for rendering markdown to HTML, and so was unaffected by the security vulnerability in middleman.
|
||||
If you have changed slate to use kramdown, and with GFM, you may need to install the `kramdown-parser-gfm` gem.
|
||||
|
||||
## Version 2.7.0
|
||||
|
||||
*June 21, 2020*
|
||||
|
||||
* __[security]__ Bumped rack in Gemfile.lock from 2.2.2 to 2.2.3
|
||||
* Bumped bundled jQuery from 3.2.1 to 3.5.1
|
||||
* Bumped bundled lunr from 0.5.7 to 2.3.8
|
||||
* Bumped imagesloaded from 3.1.8 to 4.1.4
|
||||
* Bumped rouge from 3.17.0 to 3.20.0
|
||||
* Bumped redcarpet from 3.4.0 to 3.5.0
|
||||
* Fix color of highlighted code being unreadable when printing page
|
||||
* Add clipboard icon for "Copy to Clipboard" functionality to code boxes (see note below)
|
||||
* Fix handling of ToC selectors that contain punctutation (thanks @gruis)
|
||||
* Fix language bar truncating languages that overflow screen width
|
||||
* Strip HTML tags from ToC title before displaying it in title bar in JS (backup to stripping done in Ruby code) (thanks @atic)
|
||||
|
||||
To enable the new clipboard icon, you need to add `code_clipboard: true` to the frontmatter of source/index.html.md.
|
||||
See [this line](https://github.com/slatedocs/slate/blame/main/source/index.html.md#L19) for an example of usage.
|
||||
|
||||
## Version 2.6.1
|
||||
|
||||
*May 30, 2020*
|
||||
|
||||
* __[security]__ update child dependency activesupport in Gemfile.lock to 5.4.2.3
|
||||
* Update Middleman in Gemfile.lock to 4.3.7
|
||||
* Replace Travis-CI with GitHub actions for continuous integration
|
||||
* Replace Spectrum with GitHub discussions
|
||||
|
||||
## Version 2.6.0
|
||||
|
||||
*May 18, 2020*
|
||||
|
||||
__Note__: 2.5.0 was "pulled" due to a breaking bug discovered after release. It is recommended to skip it, and move straight to 2.6.0.
|
||||
|
||||
* Fix large whitespace gap in middle column for sections with codeblocks
|
||||
* Fix highlighted code elements having a different background than rest of code block
|
||||
* Change JSON keys to have a different font color than their values
|
||||
* Disable asset hashing for woff and woff2 elements due to middleman bug breaking woff2 asset hashing in general
|
||||
* Move Dockerfile to Debian from Alpine
|
||||
* Converted repo to a [GitHub template](https://help.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-template-repository)
|
||||
* Update sassc to 2.3.0 in Gemfile.lock
|
||||
|
||||
## Version 2.5.0
|
||||
|
||||
*May 8, 2020*
|
||||
|
||||
* __[security]__ update nokogiri to ~> 1.10.8
|
||||
* Update links in example docs to https://github.com/slatedocs/slate from https://github.com/lord/slate
|
||||
* Update LICENSE to include full Apache 2.0 text
|
||||
* Test slate against Ruby 2.5 and 2.6 on Travis-CI
|
||||
* Update Vagrantfile to use Ubuntu 18.04 (thanks @bradthurber)
|
||||
* Parse arguments and flags for deploy.sh on script start, instead of potentially after building source files
|
||||
* Install nodejs inside Vagrantfile (thanks @fernandoaguilar)
|
||||
* Add Dockerfile for running slate (thanks @redhatxl)
|
||||
* update middleman-syntax and rouge to ~>3.2
|
||||
* update middleman to 4.3.6
|
||||
|
||||
## Version 2.4.0
|
||||
|
||||
*October 19, 2019*
|
||||
|
||||
- Move repository from lord/slate to slatedocs/slate
|
||||
- Fix documentation to point at new repo link, thanks to [Arun](https://github.com/slash-arun), [Gustavo Gawryszewski](https://github.com/gawry), and [Daniel Korbit](https://github.com/danielkorbit)
|
||||
- Update `nokogiri` to 1.10.4
|
||||
- Update `ffi` in `Gemfile.lock` to fix security warnings, thanks to [Grey Baker](https://github.com/greysteil) and [jakemack](https://github.com/jakemack)
|
||||
- Update `rack` to 2.0.7 in `Gemfile.lock` to fix security warnings, thanks to [Grey Baker](https://github.com/greysteil) and [jakemack](https://github.com/jakemack)
|
||||
- Update middleman to `4.3` and relax constraints on middleman related gems, thanks to [jakemack](https://github.com/jakemack)
|
||||
- Add sass gem, thanks to [jakemack](https://github.com/jakemack)
|
||||
- Activate `asset_cache` in middleman to improve cacheability of static files, thanks to [Sam Gilman](https://github.com/thenengah)
|
||||
- Update to using bundler 2 for `Gemfile.lock`, thanks to [jakemack](https://github.com/jakemack)
|
||||
|
||||
## Version 2.3.1
|
||||
|
||||
*July 5, 2018*
|
||||
|
||||
- Update `sprockets` in `Gemfile.lock` to fix security warnings
|
||||
|
||||
## Version 2.3
|
||||
|
||||
*July 5, 2018*
|
||||
|
||||
- Allows strikethrough in markdown by default.
|
||||
- Upgrades jQuery to 3.2.1, thanks to [Tomi Takussaari](https://github.com/TomiTakussaari)
|
||||
- Fixes invalid HTML in `layout.erb`, thanks to [Eric Scouten](https://github.com/scouten) for pointing out
|
||||
- Hopefully fixes Vagrant memory issues, thanks to [Petter Blomberg](https://github.com/p-blomberg) for the suggestion
|
||||
- Cleans HTML in headers before setting `document.title`, thanks to [Dan Levy](https://github.com/justsml)
|
||||
- Allows trailing whitespace in markdown files, thanks to [Samuel Cousin](https://github.com/kuzyn)
|
||||
- Fixes pushState/replaceState problems with scrolling not changing the document hash, thanks to [Andrey Fedorov](https://github.com/anfedorov)
|
||||
- Removes some outdated examples, thanks [@al-tr](https://github.com/al-tr), [Jerome Dahdah](https://github.com/jdahdah), and [Ricardo Castro](https://github.com/mccricardo)
|
||||
- Fixes `nav-padding` bug, thanks [Jerome Dahdah](https://github.com/jdahdah)
|
||||
- Code style fixes thanks to [Sebastian Zaremba](https://github.com/vassyz)
|
||||
- Nokogiri version bump thanks to [Grey Baker](https://github.com/greysteil)
|
||||
- Fix to default `index.md` text thanks to [Nick Busey](https://github.com/NickBusey)
|
||||
|
||||
Thanks to everyone who contributed to this release!
|
||||
|
||||
## Version 2.2
|
||||
|
||||
*January 19, 2018*
|
||||
|
||||
- Fixes bugs with some non-roman languages not generating unique headers
|
||||
- Adds editorconfig, thanks to [Jay Thomas](https://github.com/jaythomas)
|
||||
- Adds optional `NestingUniqueHeadCounter`, thanks to [Vladimir Morozov](https://github.com/greenhost87)
|
||||
- Small fixes to typos and language, thx [Emir Ribić](https://github.com/ribice), [Gregor Martynus](https://github.com/gr2m), and [Martius](https://github.com/martiuslim)!
|
||||
- Adds links to Spectrum chat for questions in README and ISSUE_TEMPLATE
|
||||
|
||||
## Version 2.1
|
||||
|
||||
*October 30, 2017*
|
||||
|
||||
- Right-to-left text stylesheet option, thanks to [Mohammad Hossein Rabiee](https://github.com/mhrabiee)
|
||||
- Fix for HTML5 history state bug, thanks to [Zach Toolson](https://github.com/ztoolson)
|
||||
- Small styling changes, typo fixes, small bug fixes from [Marian Friedmann](https://github.com/rnarian), [Ben Wilhelm](https://github.com/benwilhelm), [Fouad Matin](https://github.com/fouad), [Nicolas Bonduel](https://github.com/NicolasBonduel), [Christian Oliff](https://github.com/coliff)
|
||||
|
||||
Thanks to everyone who submitted PRs for this version!
|
||||
|
||||
## Version 2.0
|
||||
|
||||
*July 17, 2017*
|
||||
|
||||
- All-new statically generated table of contents
|
||||
- Should be much faster loading and scrolling for large pages
|
||||
- Smaller Javascript file sizes
|
||||
- Avoids the problem with the last link in the ToC not ever highlighting if the section was shorter than the page
|
||||
- Fixes control-click not opening in a new page
|
||||
- Automatically updates the HTML title as you scroll
|
||||
- Updated design
|
||||
- New default colors!
|
||||
- New spacings and sizes!
|
||||
- System-default typefaces, just like GitHub
|
||||
- Added search input delay on large corpuses to reduce lag
|
||||
- We even bumped the major version cause hey, why not?
|
||||
- Various small bug fixes
|
||||
|
||||
Thanks to everyone who helped debug or wrote code for this version! It was a serious community effort, and I couldn't have done it alone.
|
||||
|
||||
## Version 1.5
|
||||
|
||||
*February 23, 2017*
|
||||
|
||||
- Add [multiple tabs per programming language](https://github.com/lord/slate/wiki/Multiple-language-tabs-per-programming-language) feature
|
||||
- Upgrade Middleman to add Ruby 1.4.0 compatibility
|
||||
- Switch default code highlighting color scheme to better highlight JSON
|
||||
- Various small typo and bug fixes
|
||||
|
||||
## Version 1.4
|
||||
|
||||
*November 24, 2016*
|
||||
|
||||
- Upgrade Middleman and Rouge gems, should hopefully solve a number of bugs
|
||||
- Update some links in README
|
||||
- Fix broken Vagrant startup script
|
||||
- Fix some problems with deploy.sh help message
|
||||
- Fix bug with language tabs not hiding properly if no error
|
||||
- Add `!default` to SASS variables
|
||||
- Fix bug with logo margin
|
||||
- Bump tested Ruby versions in .travis.yml
|
||||
|
||||
## Version 1.3.3
|
||||
|
||||
*June 11, 2016*
|
||||
|
||||
Documentation and example changes.
|
||||
|
||||
## Version 1.3.2
|
||||
|
||||
*February 3, 2016*
|
||||
|
||||
A small bugfix for slightly incorrect background colors on code samples in some cases.
|
||||
|
||||
## Version 1.3.1
|
||||
|
||||
*January 31, 2016*
|
||||
|
||||
A small bugfix for incorrect whitespace in code blocks.
|
||||
|
||||
## Version 1.3
|
||||
|
||||
*January 27, 2016*
|
||||
|
||||
We've upgraded Middleman and a number of other dependencies, which should fix quite a few bugs.
|
||||
|
||||
Instead of `rake build` and `rake deploy`, you should now run `bundle exec middleman build --clean` to build your server, and `./deploy.sh` to deploy it to Github Pages.
|
||||
|
||||
## Version 1.2
|
||||
|
||||
*June 20, 2015*
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Remove crash on invalid languages
|
||||
- Update Tocify to scroll to the highlighted header in the Table of Contents
|
||||
- Fix variable leak and update search algorithms
|
||||
- Update Python examples to be valid Python
|
||||
- Update gems
|
||||
- More misc. bugfixes of Javascript errors
|
||||
- Add Dockerfile
|
||||
- Remove unused gems
|
||||
- Optimize images, fonts, and generated asset files
|
||||
- Add chinese font support
|
||||
- Remove RedCarpet header ID patch
|
||||
- Update language tabs to not disturb existing query strings
|
||||
|
||||
## Version 1.1
|
||||
|
||||
*July 27, 2014*
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Finally, a fix for the redcarpet upgrade bug
|
||||
|
||||
## Version 1.0
|
||||
|
||||
*July 2, 2014*
|
||||
|
||||
[View Issues](https://github.com/tripit/slate/issues?milestone=1&state=closed)
|
||||
|
||||
**Features:**
|
||||
|
||||
- Responsive designs for phones and tablets
|
||||
- Started tagging versions
|
||||
|
||||
**Fixes:**
|
||||
|
||||
- Fixed 'unrecognized expression' error
|
||||
- Fixed #undefined hash bug
|
||||
- Fixed bug where the current language tab would be unselected
|
||||
- Fixed bug where tocify wouldn't highlight the current section while searching
|
||||
- Fixed bug where ids of header tags would have special characters that caused problems
|
||||
- Updated layout so that pages with disabled search wouldn't load search.js
|
||||
- Cleaned up Javascript
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at hello@lord.io. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
ruby '>=2.3.1'
|
||||
source 'https://gems.ruby-china.com'
|
||||
|
||||
# Middleman
|
||||
gem 'middleman', '~>4.3'
|
||||
gem 'middleman-syntax', '~> 3.2'
|
||||
gem 'middleman-autoprefixer', '~> 2.7'
|
||||
gem 'middleman-sprockets', '~> 4.1'
|
||||
gem 'rouge', '~> 3.21'
|
||||
gem 'redcarpet', '~> 3.5.0'
|
||||
gem 'nokogiri', '~> 1.10.8'
|
||||
gem 'sass'
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
GEM
|
||||
remote: https://gems.ruby-china.com/
|
||||
specs:
|
||||
activesupport (5.2.4.4)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
autoprefixer-rails (9.5.1.1)
|
||||
execjs
|
||||
backports (3.18.2)
|
||||
coffee-script (2.4.1)
|
||||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
concurrent-ruby (1.1.7)
|
||||
contracts (0.13.0)
|
||||
dotenv (2.7.6)
|
||||
erubis (2.7.0)
|
||||
execjs (2.7.0)
|
||||
fast_blank (1.0.0)
|
||||
fastimage (2.2.0)
|
||||
ffi (1.13.1)
|
||||
haml (5.1.2)
|
||||
temple (>= 0.8.0)
|
||||
tilt
|
||||
hamster (3.0.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
hashie (3.6.0)
|
||||
i18n (0.9.5)
|
||||
concurrent-ruby (~> 1.0)
|
||||
kramdown (2.3.0)
|
||||
rexml
|
||||
listen (3.0.8)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
memoist (0.16.2)
|
||||
middleman (4.3.11)
|
||||
coffee-script (~> 2.2)
|
||||
haml (>= 4.0.5)
|
||||
kramdown (>= 2.3.0)
|
||||
middleman-cli (= 4.3.11)
|
||||
middleman-core (= 4.3.11)
|
||||
middleman-autoprefixer (2.10.1)
|
||||
autoprefixer-rails (~> 9.1)
|
||||
middleman-core (>= 3.3.3)
|
||||
middleman-cli (4.3.11)
|
||||
thor (>= 0.17.0, < 2.0)
|
||||
middleman-core (4.3.11)
|
||||
activesupport (>= 4.2, < 6.0)
|
||||
addressable (~> 2.3)
|
||||
backports (~> 3.6)
|
||||
bundler
|
||||
contracts (~> 0.13.0)
|
||||
dotenv
|
||||
erubis
|
||||
execjs (~> 2.0)
|
||||
fast_blank
|
||||
fastimage (~> 2.0)
|
||||
hamster (~> 3.0)
|
||||
hashie (~> 3.4)
|
||||
i18n (~> 0.9.0)
|
||||
listen (~> 3.0.0)
|
||||
memoist (~> 0.14)
|
||||
padrino-helpers (~> 0.13.0)
|
||||
parallel
|
||||
rack (>= 1.4.5, < 3)
|
||||
sassc (~> 2.0)
|
||||
servolux
|
||||
tilt (~> 2.0.9)
|
||||
uglifier (~> 3.0)
|
||||
middleman-sprockets (4.1.1)
|
||||
middleman-core (~> 4.0)
|
||||
sprockets (>= 3.0)
|
||||
middleman-syntax (3.2.0)
|
||||
middleman-core (>= 3.2)
|
||||
rouge (~> 3.2)
|
||||
mini_portile2 (2.4.0)
|
||||
minitest (5.14.2)
|
||||
nokogiri (1.10.10)
|
||||
mini_portile2 (~> 2.4.0)
|
||||
padrino-helpers (0.13.3.4)
|
||||
i18n (~> 0.6, >= 0.6.7)
|
||||
padrino-support (= 0.13.3.4)
|
||||
tilt (>= 1.4.1, < 3)
|
||||
padrino-support (0.13.3.4)
|
||||
activesupport (>= 3.1)
|
||||
parallel (1.19.2)
|
||||
public_suffix (4.0.6)
|
||||
rack (2.2.3)
|
||||
rb-fsevent (0.10.4)
|
||||
rb-inotify (0.10.1)
|
||||
ffi (~> 1.0)
|
||||
redcarpet (3.5.0)
|
||||
rexml (3.2.4)
|
||||
rouge (3.24.0)
|
||||
sass (3.7.4)
|
||||
sass-listen (~> 4.0.0)
|
||||
sass-listen (4.0.0)
|
||||
rb-fsevent (~> 0.9, >= 0.9.4)
|
||||
rb-inotify (~> 0.9, >= 0.9.7)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
servolux (0.13.0)
|
||||
sprockets (3.7.2)
|
||||
concurrent-ruby (~> 1.0)
|
||||
rack (> 1, < 3)
|
||||
temple (0.8.2)
|
||||
thor (1.0.1)
|
||||
thread_safe (0.3.6)
|
||||
tilt (2.0.10)
|
||||
tzinfo (1.2.7)
|
||||
thread_safe (~> 0.1)
|
||||
uglifier (3.2.0)
|
||||
execjs (>= 0.3.0, < 3)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
middleman (~> 4.3)
|
||||
middleman-autoprefixer (~> 2.7)
|
||||
middleman-sprockets (~> 4.1)
|
||||
middleman-syntax (~> 3.2)
|
||||
nokogiri (~> 1.10.8)
|
||||
redcarpet (~> 3.5.0)
|
||||
rouge (~> 3.21)
|
||||
sass
|
||||
|
||||
RUBY VERSION
|
||||
ruby 2.3.3p222
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
|
|
@ -1,201 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
|
@ -1,81 +0,0 @@
|
|||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/slatedocs/img/main/logo-slate.png" alt="Slate: API Documentation Generator" width="226">
|
||||
<br>
|
||||
<a href="https://github.com/slatedocs/slate/actions?query=workflow%3ABuild+branch%3Amain"><img src="https://github.com/slatedocs/slate/workflows/Build/badge.svg?branch=main" alt="Build Status"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">Slate helps you create beautiful, intelligent, responsive API documentation.</p>
|
||||
|
||||
<p align="center"><img src="https://raw.githubusercontent.com/slatedocs/img/main/screenshot-slate.png" width=700 alt="Screenshot of Example Documentation created with Slate"></p>
|
||||
|
||||
<p align="center"><em>The example above was created with Slate. Check it out at <a href="https://slatedocs.github.io/slate">slatedocs.github.io/slate</a>.</em></p>
|
||||
|
||||
Features
|
||||
------------
|
||||
|
||||
* **Clean, intuitive design** — With Slate, the description of your API is on the left side of your documentation, and all the code examples are on the right side. Inspired by [Stripe's](https://stripe.com/docs/api) and [PayPal's](https://developer.paypal.com/webapps/developer/docs/api/) API docs. Slate is responsive, so it looks great on tablets, phones, and even in print.
|
||||
|
||||
* **Everything on a single page** — Gone are the days when your users had to search through a million pages to find what they wanted. Slate puts the entire documentation on a single page. We haven't sacrificed linkability, though. As you scroll, your browser's hash will update to the nearest header, so linking to a particular point in the documentation is still natural and easy.
|
||||
|
||||
* **Slate is just Markdown** — When you write docs with Slate, you're just writing Markdown, which makes it simple to edit and understand. Everything is written in Markdown — even the code samples are just Markdown code blocks.
|
||||
|
||||
* **Write code samples in multiple languages** — If your API has bindings in multiple programming languages, you can easily put in tabs to switch between them. In your document, you'll distinguish different languages by specifying the language name at the top of each code block, just like with GitHub Flavored Markdown.
|
||||
|
||||
* **Out-of-the-box syntax highlighting** for [over 100 languages](https://github.com/jneen/rouge/wiki/List-of-supported-languages-and-lexers), no configuration required.
|
||||
|
||||
* **Automatic, smoothly scrolling table of contents** on the far left of the page. As you scroll, it displays your current position in the document. It's fast, too. We're using Slate at TripIt to build documentation for our new API, where our table of contents has over 180 entries. We've made sure that the performance remains excellent, even for larger documents.
|
||||
|
||||
* **Let your users update your documentation for you** — By default, your Slate-generated documentation is hosted in a public GitHub repository. Not only does this mean you get free hosting for your docs with GitHub Pages, but it also makes it simple for other developers to make pull requests to your docs if they find typos or other problems. Of course, if you don't want to use GitHub, you're also welcome to host your docs elsewhere.
|
||||
|
||||
* **RTL Support** Full right-to-left layout for RTL languages such as Arabic, Persian (Farsi), Hebrew etc.
|
||||
|
||||
Getting started with Slate is super easy! Simply press the green "use this template" button above and follow the instructions below. Or, if you'd like to check out what Slate is capable of, take a look at the [sample docs](https://slatedocs.github.io/slate/).
|
||||
|
||||
Getting Started with Slate
|
||||
------------------------------
|
||||
|
||||
To get started with Slate, please check out the [Getting Started](https://github.com/slatedocs/slate/wiki#getting-started)
|
||||
section in our [wiki](https://github.com/slatedocs/slate/wiki).
|
||||
|
||||
We support running Slate in three different ways:
|
||||
* [Natively](https://github.com/slatedocs/slate/wiki/Using-Slate-Natively)
|
||||
* [Using Vagrant](https://github.com/slatedocs/slate/wiki/Using-Slate-in-Vagrant)
|
||||
* [Using Docker](https://github.com/slatedocs/slate/wiki/Using-Slate-in-Docker)
|
||||
|
||||
Companies Using Slate
|
||||
---------------------------------
|
||||
|
||||
* [NASA](https://api.nasa.gov)
|
||||
* [Sony](http://developers.cimediacloud.com)
|
||||
* [Best Buy](https://bestbuyapis.github.io/api-documentation/)
|
||||
* [Travis-CI](https://docs.travis-ci.com/api/)
|
||||
* [Greenhouse](https://developers.greenhouse.io/harvest.html)
|
||||
* [WooCommerce](http://woocommerce.github.io/woocommerce-rest-api-docs/)
|
||||
* [Dwolla](https://docs.dwolla.com/)
|
||||
* [Clearbit](https://clearbit.com/docs)
|
||||
* [Coinbase](https://developers.coinbase.com/api)
|
||||
* [Parrot Drones](http://developer.parrot.com/docs/bebop/)
|
||||
* [Scale](https://docs.scaleapi.com/)
|
||||
|
||||
You can view more in [the list on the wiki](https://github.com/slatedocs/slate/wiki/Slate-in-the-Wild).
|
||||
|
||||
Questions? Need Help? Found a bug?
|
||||
--------------------
|
||||
|
||||
If you've got questions about setup, deploying, special feature implementation in your fork, or just want to chat with the developer, please feel free to [start a thread in our Discussions tab](https://github.com/slatedocs/slate/discussions)!
|
||||
|
||||
Found a bug with upstream Slate? Go ahead and [submit an issue](https://github.com/slatedocs/slate/issues). And, of course, feel free to submit pull requests with bug fixes or changes to the `dev` branch.
|
||||
|
||||
Contributors
|
||||
--------------------
|
||||
|
||||
Slate was built by [Robert Lord](https://lord.io) while at [TripIt](https://www.tripit.com/). The project is now maintained by [Matthew Peveler](https://github.com/MasterOdin) and [Mike Ralphson](https://github.com/MikeRalphson).
|
||||
|
||||
Thanks to the following people who have submitted major pull requests:
|
||||
|
||||
- [@chrissrogers](https://github.com/chrissrogers)
|
||||
- [@bootstraponline](https://github.com/bootstraponline)
|
||||
- [@realityking](https://github.com/realityking)
|
||||
- [@cvkef](https://github.com/cvkef)
|
||||
|
||||
Also, thanks to [Sauce Labs](http://saucelabs.com) for sponsoring the development of the responsive styles.
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
Vagrant.configure(2) do |config|
|
||||
config.vm.box = "ubuntu/bionic64"
|
||||
config.vm.network :forwarded_port, guest: 4567, host: 4567
|
||||
config.vm.provider "virtualbox" do |vb|
|
||||
vb.memory = "2048"
|
||||
end
|
||||
|
||||
config.vm.provision "bootstrap",
|
||||
type: "shell",
|
||||
inline: <<-SHELL
|
||||
# add nodejs v12 repository
|
||||
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -yq ruby ruby-dev
|
||||
sudo apt-get install -yq pkg-config build-essential nodejs git libxml2-dev libxslt-dev
|
||||
sudo apt-get autoremove -yq
|
||||
gem install --no-ri --no-rdoc bundler
|
||||
SHELL
|
||||
|
||||
# add the local user git config to the vm
|
||||
config.vm.provision "file", source: "~/.gitconfig", destination: ".gitconfig"
|
||||
|
||||
config.vm.provision "install",
|
||||
type: "shell",
|
||||
privileged: false,
|
||||
inline: <<-SHELL
|
||||
echo "=============================================="
|
||||
echo "Installing app dependencies"
|
||||
cd /vagrant
|
||||
bundle config build.nokogiri --use-system-libraries
|
||||
bundle install
|
||||
SHELL
|
||||
|
||||
config.vm.provision "run",
|
||||
type: "shell",
|
||||
privileged: false,
|
||||
run: "always",
|
||||
inline: <<-SHELL
|
||||
echo "=============================================="
|
||||
echo "Starting up middleman at http://localhost:4567"
|
||||
echo "If it does not come up, check the ~/middleman.log file for any error messages"
|
||||
cd /vagrant
|
||||
bundle exec middleman server --watcher-force-polling --watcher-latency=1 &> ~/middleman.log &
|
||||
SHELL
|
||||
end
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
set :build_dir, '../../../public/docs/'
|
||||
|
||||
# Unique header generation
|
||||
require './lib/unique_head.rb'
|
||||
|
||||
# Markdown
|
||||
set :markdown_engine, :redcarpet
|
||||
set :markdown,
|
||||
fenced_code_blocks: true,
|
||||
smartypants: true,
|
||||
disable_indented_code_blocks: true,
|
||||
prettify: true,
|
||||
strikethrough: true,
|
||||
tables: true,
|
||||
with_toc_data: true,
|
||||
no_intra_emphasis: true,
|
||||
renderer: UniqueHeadCounter
|
||||
|
||||
# Assets
|
||||
set :css_dir, 'stylesheets'
|
||||
set :js_dir, 'javascripts'
|
||||
set :images_dir, 'images'
|
||||
set :fonts_dir, 'fonts'
|
||||
|
||||
# Activate the syntax highlighter
|
||||
activate :syntax
|
||||
ready do
|
||||
require './lib/monokai_sublime_slate.rb'
|
||||
require './lib/multilang.rb'
|
||||
end
|
||||
|
||||
activate :sprockets
|
||||
|
||||
activate :autoprefixer do |config|
|
||||
config.browsers = ['last 2 version', 'Firefox ESR']
|
||||
config.cascade = false
|
||||
config.inline = true
|
||||
end
|
||||
|
||||
# Github pages require relative links
|
||||
activate :relative_assets
|
||||
set :relative_links, true
|
||||
|
||||
# Build Configuration
|
||||
configure :build do
|
||||
# We do want to hash woff and woff2 as there's a bug where woff2 will use
|
||||
# woff asset hash which breaks things. Trying to use a combination of ignore and
|
||||
# rewrite_ignore does not work as it conflicts weirdly with relative_assets. Disabling
|
||||
# the .woff2 extension only does not work as .woff will still activate it so have to
|
||||
# have both. See https://github.com/slatedocs/slate/issues/1171 for more details.
|
||||
activate :asset_hash, :exts => app.config[:asset_extensions] - %w[.woff .woff2]
|
||||
# If you're having trouble with Middleman hanging, commenting
|
||||
# out the following two lines has been known to help
|
||||
activate :minify_css
|
||||
activate :minify_javascript
|
||||
# activate :gzip
|
||||
end
|
||||
|
||||
# Deploy Configuration
|
||||
# If you want Middleman to listen on a different port, you can set that below
|
||||
set :port, 4567
|
||||
|
||||
helpers do
|
||||
require './lib/toc_data.rb'
|
||||
end
|
||||
|
|
@ -1,226 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o errexit #abort if any command fails
|
||||
me=$(basename "$0")
|
||||
|
||||
help_message="\
|
||||
Usage: $me [-c FILE] [<options>]
|
||||
Deploy generated files to a git branch.
|
||||
|
||||
Options:
|
||||
|
||||
-h, --help Show this help information.
|
||||
-v, --verbose Increase verbosity. Useful for debugging.
|
||||
-e, --allow-empty Allow deployment of an empty directory.
|
||||
-m, --message MESSAGE Specify the message used when committing on the
|
||||
deploy branch.
|
||||
-n, --no-hash Don't append the source commit's hash to the deploy
|
||||
commit's message.
|
||||
--source-only Only build but not push
|
||||
--push-only Only push but not build
|
||||
"
|
||||
|
||||
|
||||
run_build() {
|
||||
bundle exec middleman build --clean
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
# Set args from a local environment file.
|
||||
if [ -e ".env" ]; then
|
||||
source .env
|
||||
fi
|
||||
|
||||
# Parse arg flags
|
||||
# If something is exposed as an environment variable, set/overwrite it
|
||||
# here. Otherwise, set/overwrite the internal variable instead.
|
||||
while : ; do
|
||||
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
||||
echo "$help_message"
|
||||
exit 0
|
||||
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
||||
verbose=true
|
||||
shift
|
||||
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
|
||||
allow_empty=true
|
||||
shift
|
||||
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
|
||||
commit_message=$2
|
||||
shift 2
|
||||
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
||||
GIT_DEPLOY_APPEND_HASH=false
|
||||
shift
|
||||
elif [[ $1 = "--source-only" ]]; then
|
||||
source_only=true
|
||||
shift
|
||||
elif [[ $1 = "--push-only" ]]; then
|
||||
push_only=true
|
||||
shift
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ${source_only} ] && [ ${push_only} ]; then
|
||||
>&2 echo "You can only specify one of --source-only or --push-only"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set internal option vars from the environment and arg flags. All internal
|
||||
# vars should be declared here, with sane defaults if applicable.
|
||||
|
||||
# Source directory & target branch.
|
||||
deploy_directory=build
|
||||
deploy_branch=gh-pages
|
||||
|
||||
#if no user identity is already set in the current git environment, use this:
|
||||
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
|
||||
default_email=${GIT_DEPLOY_EMAIL:-}
|
||||
|
||||
#repository to deploy to. must be readable and writable.
|
||||
repo=origin
|
||||
|
||||
#append commit hash to the end of message by default
|
||||
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
|
||||
}
|
||||
|
||||
main() {
|
||||
enable_expanded_output
|
||||
|
||||
if ! git diff --exit-code --quiet --cached; then
|
||||
echo Aborting due to uncommitted changes in the index >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
commit_title=`git log -n 1 --format="%s" HEAD`
|
||||
commit_hash=` git log -n 1 --format="%H" HEAD`
|
||||
|
||||
#default commit message uses last title if a custom one is not supplied
|
||||
if [[ -z $commit_message ]]; then
|
||||
commit_message="publish: $commit_title"
|
||||
fi
|
||||
|
||||
#append hash to commit message unless no hash flag was found
|
||||
if [ $append_hash = true ]; then
|
||||
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
|
||||
fi
|
||||
|
||||
previous_branch=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
if [ ! -d "$deploy_directory" ]; then
|
||||
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# must use short form of flag in ls for compatibility with macOS and BSD
|
||||
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
|
||||
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
|
||||
# deploy_branch exists in $repo; make sure we have the latest version
|
||||
|
||||
disable_expanded_output
|
||||
git fetch --force $repo $deploy_branch:$deploy_branch
|
||||
enable_expanded_output
|
||||
fi
|
||||
|
||||
# check if deploy_branch exists locally
|
||||
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
|
||||
then incremental_deploy
|
||||
else initial_deploy
|
||||
fi
|
||||
|
||||
restore_head
|
||||
}
|
||||
|
||||
initial_deploy() {
|
||||
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
|
||||
git --work-tree "$deploy_directory" add --all
|
||||
commit+push
|
||||
}
|
||||
|
||||
incremental_deploy() {
|
||||
#make deploy_branch the current branch
|
||||
git symbolic-ref HEAD refs/heads/$deploy_branch
|
||||
#put the previously committed contents of deploy_branch into the index
|
||||
git --work-tree "$deploy_directory" reset --mixed --quiet
|
||||
git --work-tree "$deploy_directory" add --all
|
||||
|
||||
set +o errexit
|
||||
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
|
||||
set -o errexit
|
||||
case $diff in
|
||||
0) echo No changes to files in $deploy_directory. Skipping commit.;;
|
||||
1) commit+push;;
|
||||
*)
|
||||
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to main, use: git symbolic-ref HEAD refs/heads/main && git reset --mixed >&2
|
||||
return $diff
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
commit+push() {
|
||||
set_user_id
|
||||
git --work-tree "$deploy_directory" commit -m "$commit_message"
|
||||
|
||||
disable_expanded_output
|
||||
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
|
||||
git push --quiet $repo $deploy_branch
|
||||
enable_expanded_output
|
||||
}
|
||||
|
||||
#echo expanded commands as they are executed (for debugging)
|
||||
enable_expanded_output() {
|
||||
if [ $verbose ]; then
|
||||
set -o xtrace
|
||||
set +o verbose
|
||||
fi
|
||||
}
|
||||
|
||||
#this is used to avoid outputting the repo URL, which may contain a secret token
|
||||
disable_expanded_output() {
|
||||
if [ $verbose ]; then
|
||||
set +o xtrace
|
||||
set -o verbose
|
||||
fi
|
||||
}
|
||||
|
||||
set_user_id() {
|
||||
if [[ -z `git config user.name` ]]; then
|
||||
git config user.name "$default_username"
|
||||
fi
|
||||
if [[ -z `git config user.email` ]]; then
|
||||
git config user.email "$default_email"
|
||||
fi
|
||||
}
|
||||
|
||||
restore_head() {
|
||||
if [[ $previous_branch = "HEAD" ]]; then
|
||||
#we weren't on any branch before, so just set HEAD back to the commit it was on
|
||||
git update-ref --no-deref HEAD $commit_hash $deploy_branch
|
||||
else
|
||||
git symbolic-ref HEAD refs/heads/$previous_branch
|
||||
fi
|
||||
|
||||
git reset --mixed
|
||||
}
|
||||
|
||||
filter() {
|
||||
sed -e "s|$repo|\$repo|g"
|
||||
}
|
||||
|
||||
sanitize() {
|
||||
"$@" 2> >(filter 1>&2) | filter
|
||||
}
|
||||
|
||||
parse_args "$@"
|
||||
|
||||
if [[ ${source_only} ]]; then
|
||||
run_build
|
||||
elif [[ ${push_only} ]]; then
|
||||
main "$@"
|
||||
else
|
||||
run_build
|
||||
main "$@"
|
||||
fi
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
{
|
||||
"IcoMoonType": "selection",
|
||||
"icons": [
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M438.857 73.143q119.429 0 220.286 58.857t159.714 159.714 58.857 220.286-58.857 220.286-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857zM512 785.714v-108.571q0-8-5.143-13.429t-12.571-5.429h-109.714q-7.429 0-13.143 5.714t-5.714 13.143v108.571q0 7.429 5.714 13.143t13.143 5.714h109.714q7.429 0 12.571-5.429t5.143-13.429zM510.857 589.143l10.286-354.857q0-6.857-5.714-10.286-5.714-4.571-13.714-4.571h-125.714q-8 0-13.714 4.571-5.714 3.429-5.714 10.286l9.714 354.857q0 5.714 5.714 10t13.714 4.286h105.714q8 0 13.429-4.286t6-10z"
|
||||
],
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"tags": [
|
||||
"exclamation-circle"
|
||||
],
|
||||
"defaultCode": 61546,
|
||||
"grid": 14
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"id": 100,
|
||||
"order": 4,
|
||||
"prevSize": 28,
|
||||
"code": 58880,
|
||||
"name": "exclamation-sign",
|
||||
"ligatures": ""
|
||||
},
|
||||
"setIdx": 0,
|
||||
"iconIdx": 0
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M585.143 786.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-54.857v-292.571q0-8-5.143-13.143t-13.143-5.143h-182.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h54.857v182.857h-54.857q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h256q8 0 13.143-5.143t5.143-13.143zM512 274.286v-91.429q0-8-5.143-13.143t-13.143-5.143h-109.714q-8 0-13.143 5.143t-5.143 13.143v91.429q0 8 5.143 13.143t13.143 5.143h109.714q8 0 13.143-5.143t5.143-13.143zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
|
||||
],
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"tags": [
|
||||
"info-circle"
|
||||
],
|
||||
"defaultCode": 61530,
|
||||
"grid": 14
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"id": 85,
|
||||
"order": 3,
|
||||
"name": "info-sign",
|
||||
"prevSize": 28,
|
||||
"code": 58882
|
||||
},
|
||||
"setIdx": 0,
|
||||
"iconIdx": 2
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M733.714 419.429q0-16-10.286-26.286l-52-51.429q-10.857-10.857-25.714-10.857t-25.714 10.857l-233.143 232.571-129.143-129.143q-10.857-10.857-25.714-10.857t-25.714 10.857l-52 51.429q-10.286 10.286-10.286 26.286 0 15.429 10.286 25.714l206.857 206.857q10.857 10.857 25.714 10.857 15.429 0 26.286-10.857l310.286-310.286q10.286-10.286 10.286-25.714zM877.714 512q0 119.429-58.857 220.286t-159.714 159.714-220.286 58.857-220.286-58.857-159.714-159.714-58.857-220.286 58.857-220.286 159.714-159.714 220.286-58.857 220.286 58.857 159.714 159.714 58.857 220.286z"
|
||||
],
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"tags": [
|
||||
"check-circle"
|
||||
],
|
||||
"defaultCode": 61528,
|
||||
"grid": 14
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"id": 83,
|
||||
"order": 9,
|
||||
"prevSize": 28,
|
||||
"code": 58886,
|
||||
"name": "ok-sign"
|
||||
},
|
||||
"setIdx": 0,
|
||||
"iconIdx": 6
|
||||
},
|
||||
{
|
||||
"icon": {
|
||||
"paths": [
|
||||
"M658.286 475.429q0-105.714-75.143-180.857t-180.857-75.143-180.857 75.143-75.143 180.857 75.143 180.857 180.857 75.143 180.857-75.143 75.143-180.857zM950.857 950.857q0 29.714-21.714 51.429t-51.429 21.714q-30.857 0-51.429-21.714l-196-195.429q-102.286 70.857-228 70.857-81.714 0-156.286-31.714t-128.571-85.714-85.714-128.571-31.714-156.286 31.714-156.286 85.714-128.571 128.571-85.714 156.286-31.714 156.286 31.714 128.571 85.714 85.714 128.571 31.714 156.286q0 125.714-70.857 228l196 196q21.143 21.143 21.143 51.429z"
|
||||
],
|
||||
"width": 951,
|
||||
"attrs": [],
|
||||
"isMulticolor": false,
|
||||
"tags": [
|
||||
"search"
|
||||
],
|
||||
"defaultCode": 61442,
|
||||
"grid": 14
|
||||
},
|
||||
"attrs": [],
|
||||
"properties": {
|
||||
"id": 2,
|
||||
"order": 1,
|
||||
"prevSize": 28,
|
||||
"code": 58887,
|
||||
"name": "icon-search"
|
||||
},
|
||||
"setIdx": 0,
|
||||
"iconIdx": 7
|
||||
}
|
||||
],
|
||||
"height": 1024,
|
||||
"metadata": {
|
||||
"name": "slate",
|
||||
"license": "SIL OFL 1.1"
|
||||
},
|
||||
"preferences": {
|
||||
"showGlyphs": true,
|
||||
"showQuickUse": true,
|
||||
"showQuickUse2": true,
|
||||
"showSVGs": true,
|
||||
"fontPref": {
|
||||
"prefix": "icon-",
|
||||
"metadata": {
|
||||
"fontFamily": "slate",
|
||||
"majorVersion": 1,
|
||||
"minorVersion": 0,
|
||||
"description": "Based on FontAwesome",
|
||||
"license": "SIL OFL 1.1"
|
||||
},
|
||||
"metrics": {
|
||||
"emSize": 1024,
|
||||
"baseline": 6.25,
|
||||
"whitespace": 50
|
||||
},
|
||||
"resetPoint": 58880,
|
||||
"showSelector": false,
|
||||
"selector": "class",
|
||||
"classSelector": ".icon",
|
||||
"showMetrics": false,
|
||||
"showMetadata": true,
|
||||
"showVersion": true,
|
||||
"ie7": false
|
||||
},
|
||||
"imagePref": {
|
||||
"prefix": "icon-",
|
||||
"png": true,
|
||||
"useClassSelector": true,
|
||||
"color": 4473924,
|
||||
"bgColor": 16777215
|
||||
},
|
||||
"historySize": 100,
|
||||
"showCodes": true,
|
||||
"gridSize": 16,
|
||||
"showLiga": false
|
||||
}
|
||||
}
|
||||
|
|
@ -1,95 +0,0 @@
|
|||
# -*- coding: utf-8 -*- #
|
||||
# frozen_string_literal: true
|
||||
|
||||
# this is based on https://github.com/rouge-ruby/rouge/blob/master/lib/rouge/themes/monokai_sublime.rb
|
||||
# but without the added background, and changed styling for JSON keys to be soft_yellow instead of white
|
||||
|
||||
module Rouge
|
||||
module Themes
|
||||
class MonokaiSublimeSlate < CSSTheme
|
||||
name 'monokai.sublime.slate'
|
||||
|
||||
palette :black => '#000000'
|
||||
palette :bright_green => '#a6e22e'
|
||||
palette :bright_pink => '#f92672'
|
||||
palette :carmine => '#960050'
|
||||
palette :dark => '#49483e'
|
||||
palette :dark_grey => '#888888'
|
||||
palette :dark_red => '#aa0000'
|
||||
palette :dimgrey => '#75715e'
|
||||
palette :emperor => '#555555'
|
||||
palette :grey => '#999999'
|
||||
palette :light_grey => '#aaaaaa'
|
||||
palette :light_violet => '#ae81ff'
|
||||
palette :soft_cyan => '#66d9ef'
|
||||
palette :soft_yellow => '#e6db74'
|
||||
palette :very_dark => '#1e0010'
|
||||
palette :whitish => '#f8f8f2'
|
||||
palette :orange => '#f6aa11'
|
||||
palette :white => '#ffffff'
|
||||
|
||||
style Generic::Heading, :fg => :grey
|
||||
style Literal::String::Regex, :fg => :orange
|
||||
style Generic::Output, :fg => :dark_grey
|
||||
style Generic::Prompt, :fg => :emperor
|
||||
style Generic::Strong, :bold => false
|
||||
style Generic::Subheading, :fg => :light_grey
|
||||
style Name::Builtin, :fg => :orange
|
||||
style Comment::Multiline,
|
||||
Comment::Preproc,
|
||||
Comment::Single,
|
||||
Comment::Special,
|
||||
Comment, :fg => :dimgrey
|
||||
style Error,
|
||||
Generic::Error,
|
||||
Generic::Traceback, :fg => :carmine
|
||||
style Generic::Deleted,
|
||||
Generic::Inserted,
|
||||
Generic::Emph, :fg => :dark
|
||||
style Keyword::Constant,
|
||||
Keyword::Declaration,
|
||||
Keyword::Reserved,
|
||||
Name::Constant,
|
||||
Keyword::Type, :fg => :soft_cyan
|
||||
style Literal::Number::Float,
|
||||
Literal::Number::Hex,
|
||||
Literal::Number::Integer::Long,
|
||||
Literal::Number::Integer,
|
||||
Literal::Number::Oct,
|
||||
Literal::Number,
|
||||
Literal::String::Char,
|
||||
Literal::String::Escape,
|
||||
Literal::String::Symbol, :fg => :light_violet
|
||||
style Literal::String::Doc,
|
||||
Literal::String::Double,
|
||||
Literal::String::Backtick,
|
||||
Literal::String::Heredoc,
|
||||
Literal::String::Interpol,
|
||||
Literal::String::Other,
|
||||
Literal::String::Single,
|
||||
Literal::String, :fg => :soft_yellow
|
||||
style Name::Attribute,
|
||||
Name::Class,
|
||||
Name::Decorator,
|
||||
Name::Exception,
|
||||
Name::Function, :fg => :bright_green
|
||||
style Name::Variable::Class,
|
||||
Name::Namespace,
|
||||
Name::Entity,
|
||||
Name::Builtin::Pseudo,
|
||||
Name::Variable::Global,
|
||||
Name::Variable::Instance,
|
||||
Name::Variable,
|
||||
Text::Whitespace,
|
||||
Text,
|
||||
Name, :fg => :white
|
||||
style Name::Label, :fg => :bright_pink
|
||||
style Operator::Word,
|
||||
Name::Tag,
|
||||
Keyword,
|
||||
Keyword::Namespace,
|
||||
Keyword::Pseudo,
|
||||
Operator, :fg => :bright_pink
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
module Multilang
|
||||
def block_code(code, full_lang_name)
|
||||
if full_lang_name
|
||||
parts = full_lang_name.split('--')
|
||||
rouge_lang_name = (parts) ? parts[0] : "" # just parts[0] here causes null ref exception when no language specified
|
||||
super(code, rouge_lang_name).sub("highlight #{rouge_lang_name}") do |match|
|
||||
match + " tab-" + full_lang_name
|
||||
end
|
||||
else
|
||||
super(code, full_lang_name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
require 'middleman-core/renderers/redcarpet'
|
||||
Middleman::Renderers::MiddlemanRedcarpetHTML.send :include, Multilang
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# Nested unique header generation
|
||||
require 'middleman-core/renderers/redcarpet'
|
||||
|
||||
class NestingUniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
|
||||
def initialize
|
||||
super
|
||||
@@headers_history = {} if !defined?(@@headers_history)
|
||||
end
|
||||
|
||||
def header(text, header_level)
|
||||
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
|
||||
@@headers_history[header_level] = text.parameterize
|
||||
|
||||
if header_level > 1
|
||||
for i in (header_level - 1).downto(1)
|
||||
friendly_text.prepend("#{@@headers_history[i]}-") if @@headers_history.key?(i)
|
||||
end
|
||||
end
|
||||
|
||||
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
|
||||
end
|
||||
end
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
require 'nokogiri'
|
||||
|
||||
def toc_data(page_content)
|
||||
html_doc = Nokogiri::HTML::DocumentFragment.parse(page_content)
|
||||
|
||||
# get a flat list of headers
|
||||
headers = []
|
||||
html_doc.css('h1, h2, h3').each do |header|
|
||||
headers.push({
|
||||
id: header.attribute('id').to_s,
|
||||
content: header.children,
|
||||
title: header.children.to_s.gsub(/<[^>]*>/, ''),
|
||||
level: header.name[1].to_i,
|
||||
children: []
|
||||
})
|
||||
end
|
||||
|
||||
[3,2].each do |header_level|
|
||||
header_to_nest = nil
|
||||
headers = headers.reject do |header|
|
||||
if header[:level] == header_level
|
||||
header_to_nest[:children].push header if header_to_nest
|
||||
true
|
||||
else
|
||||
header_to_nest = header if header[:level] < header_level
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
headers
|
||||
end
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
# Unique header generation
|
||||
require 'middleman-core/renderers/redcarpet'
|
||||
require 'digest'
|
||||
class UniqueHeadCounter < Middleman::Renderers::MiddlemanRedcarpetHTML
|
||||
def initialize
|
||||
super
|
||||
@head_count = {}
|
||||
end
|
||||
def header(text, header_level)
|
||||
friendly_text = text.gsub(/<[^>]*>/,"").parameterize
|
||||
if friendly_text.strip.length == 0
|
||||
# Looks like parameterize removed the whole thing! It removes many unicode
|
||||
# characters like Chinese and Russian. To get a unique URL, let's just
|
||||
# URI escape the whole header
|
||||
friendly_text = Digest::SHA1.hexdigest(text)[0,10]
|
||||
end
|
||||
@head_count[friendly_text] ||= 0
|
||||
@head_count[friendly_text] += 1
|
||||
if @head_count[friendly_text] > 1
|
||||
friendly_text += "-#{@head_count[friendly_text]}"
|
||||
end
|
||||
return "<h#{header_level} id='#{friendly_text}'>#{text}</h#{header_level}>"
|
||||
end
|
||||
end
|
||||
|
|
@ -1,248 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -o errexit #abort if any command fails
|
||||
|
||||
me=$(basename "$0")
|
||||
|
||||
help_message="\
|
||||
Usage: $me [<options>] <command> [<command-options>]
|
||||
Run commands related to the slate process.
|
||||
|
||||
Commands:
|
||||
|
||||
serve Run the middleman server process, useful for
|
||||
development.
|
||||
build Run the build process.
|
||||
deploy Will build and deploy files to branch. Use
|
||||
--no-build to only deploy.
|
||||
|
||||
Global Options:
|
||||
|
||||
-h, --help Show this help information.
|
||||
-v, --verbose Increase verbosity. Useful for debugging.
|
||||
|
||||
Deploy options:
|
||||
-e, --allow-empty Allow deployment of an empty directory.
|
||||
-m, --message MESSAGE Specify the message used when committing on the
|
||||
deploy branch.
|
||||
-n, --no-hash Don't append the source commit's hash to the deploy
|
||||
commit's message.
|
||||
--no-build Do not build the source files.
|
||||
"
|
||||
|
||||
|
||||
run_serve() {
|
||||
exec bundle exec middleman serve --watcher-force-polling
|
||||
}
|
||||
|
||||
run_build() {
|
||||
bundle exec middleman build --clean
|
||||
}
|
||||
|
||||
parse_args() {
|
||||
# Set args from a local environment file.
|
||||
if [ -e ".env" ]; then
|
||||
source .env
|
||||
fi
|
||||
|
||||
command=
|
||||
|
||||
# Parse arg flags
|
||||
# If something is exposed as an environment variable, set/overwrite it
|
||||
# here. Otherwise, set/overwrite the internal variable instead.
|
||||
while : ; do
|
||||
if [[ $1 = "-h" || $1 = "--help" ]]; then
|
||||
echo "$help_message"
|
||||
exit 0
|
||||
elif [[ $1 = "-v" || $1 = "--verbose" ]]; then
|
||||
verbose=true
|
||||
shift
|
||||
elif [[ $1 = "-e" || $1 = "--allow-empty" ]]; then
|
||||
allow_empty=true
|
||||
shift
|
||||
elif [[ ( $1 = "-m" || $1 = "--message" ) && -n $2 ]]; then
|
||||
commit_message=$2
|
||||
shift 2
|
||||
elif [[ $1 = "-n" || $1 = "--no-hash" ]]; then
|
||||
GIT_DEPLOY_APPEND_HASH=false
|
||||
shift
|
||||
elif [[ $1 = "--no-build" ]]; then
|
||||
no_build=true
|
||||
shift
|
||||
elif [[ $1 = "serve" || $1 = "build" || $1 = "deploy" ]]; then
|
||||
if [ ! -z "${command}" ]; then
|
||||
>&2 echo "You can only specify one command."
|
||||
exit 1
|
||||
fi
|
||||
command=$1
|
||||
shift
|
||||
elif [ -z $1 ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "${command}" ]; then
|
||||
>&2 echo "Command not specified."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set internal option vars from the environment and arg flags. All internal
|
||||
# vars should be declared here, with sane defaults if applicable.
|
||||
|
||||
# Source directory & target branch.
|
||||
deploy_directory=build
|
||||
deploy_branch=gh-pages
|
||||
|
||||
#if no user identity is already set in the current git environment, use this:
|
||||
default_username=${GIT_DEPLOY_USERNAME:-deploy.sh}
|
||||
default_email=${GIT_DEPLOY_EMAIL:-}
|
||||
|
||||
#repository to deploy to. must be readable and writable.
|
||||
repo=origin
|
||||
|
||||
#append commit hash to the end of message by default
|
||||
append_hash=${GIT_DEPLOY_APPEND_HASH:-true}
|
||||
}
|
||||
|
||||
main() {
|
||||
enable_expanded_output
|
||||
|
||||
if ! git diff --exit-code --quiet --cached; then
|
||||
echo Aborting due to uncommitted changes in the index >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
commit_title=`git log -n 1 --format="%s" HEAD`
|
||||
commit_hash=` git log -n 1 --format="%H" HEAD`
|
||||
|
||||
#default commit message uses last title if a custom one is not supplied
|
||||
if [[ -z $commit_message ]]; then
|
||||
commit_message="publish: $commit_title"
|
||||
fi
|
||||
|
||||
#append hash to commit message unless no hash flag was found
|
||||
if [ $append_hash = true ]; then
|
||||
commit_message="$commit_message"$'\n\n'"generated from commit $commit_hash"
|
||||
fi
|
||||
|
||||
previous_branch=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
if [ ! -d "$deploy_directory" ]; then
|
||||
echo "Deploy directory '$deploy_directory' does not exist. Aborting." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
# must use short form of flag in ls for compatibility with macOS and BSD
|
||||
if [[ -z `ls -A "$deploy_directory" 2> /dev/null` && -z $allow_empty ]]; then
|
||||
echo "Deploy directory '$deploy_directory' is empty. Aborting. If you're sure you want to deploy an empty tree, use the --allow-empty / -e flag." >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
if git ls-remote --exit-code $repo "refs/heads/$deploy_branch" ; then
|
||||
# deploy_branch exists in $repo; make sure we have the latest version
|
||||
|
||||
disable_expanded_output
|
||||
git fetch --force $repo $deploy_branch:$deploy_branch
|
||||
enable_expanded_output
|
||||
fi
|
||||
|
||||
# check if deploy_branch exists locally
|
||||
if git show-ref --verify --quiet "refs/heads/$deploy_branch"
|
||||
then incremental_deploy
|
||||
else initial_deploy
|
||||
fi
|
||||
|
||||
restore_head
|
||||
}
|
||||
|
||||
initial_deploy() {
|
||||
git --work-tree "$deploy_directory" checkout --orphan $deploy_branch
|
||||
git --work-tree "$deploy_directory" add --all
|
||||
commit+push
|
||||
}
|
||||
|
||||
incremental_deploy() {
|
||||
#make deploy_branch the current branch
|
||||
git symbolic-ref HEAD refs/heads/$deploy_branch
|
||||
#put the previously committed contents of deploy_branch into the index
|
||||
git --work-tree "$deploy_directory" reset --mixed --quiet
|
||||
git --work-tree "$deploy_directory" add --all
|
||||
|
||||
set +o errexit
|
||||
diff=$(git --work-tree "$deploy_directory" diff --exit-code --quiet HEAD --)$?
|
||||
set -o errexit
|
||||
case $diff in
|
||||
0) echo No changes to files in $deploy_directory. Skipping commit.;;
|
||||
1) commit+push;;
|
||||
*)
|
||||
echo git diff exited with code $diff. Aborting. Staying on branch $deploy_branch so you can debug. To switch back to main, use: git symbolic-ref HEAD refs/heads/main && git reset --mixed >&2
|
||||
return $diff
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
commit+push() {
|
||||
set_user_id
|
||||
git --work-tree "$deploy_directory" commit -m "$commit_message"
|
||||
|
||||
disable_expanded_output
|
||||
#--quiet is important here to avoid outputting the repo URL, which may contain a secret token
|
||||
git push --quiet $repo $deploy_branch
|
||||
enable_expanded_output
|
||||
}
|
||||
|
||||
#echo expanded commands as they are executed (for debugging)
|
||||
enable_expanded_output() {
|
||||
if [ $verbose ]; then
|
||||
set -o xtrace
|
||||
set +o verbose
|
||||
fi
|
||||
}
|
||||
|
||||
#this is used to avoid outputting the repo URL, which may contain a secret token
|
||||
disable_expanded_output() {
|
||||
if [ $verbose ]; then
|
||||
set +o xtrace
|
||||
set -o verbose
|
||||
fi
|
||||
}
|
||||
|
||||
set_user_id() {
|
||||
if [[ -z `git config user.name` ]]; then
|
||||
git config user.name "$default_username"
|
||||
fi
|
||||
if [[ -z `git config user.email` ]]; then
|
||||
git config user.email "$default_email"
|
||||
fi
|
||||
}
|
||||
|
||||
restore_head() {
|
||||
if [[ $previous_branch = "HEAD" ]]; then
|
||||
#we weren't on any branch before, so just set HEAD back to the commit it was on
|
||||
git update-ref --no-deref HEAD $commit_hash $deploy_branch
|
||||
else
|
||||
git symbolic-ref HEAD refs/heads/$previous_branch
|
||||
fi
|
||||
|
||||
git reset --mixed
|
||||
}
|
||||
|
||||
filter() {
|
||||
sed -e "s|$repo|\$repo|g"
|
||||
}
|
||||
|
||||
sanitize() {
|
||||
"$@" 2> >(filter 1>&2) | filter
|
||||
}
|
||||
|
||||
parse_args "$@"
|
||||
|
||||
if [ "${command}" = "serve" ]; then
|
||||
run_serve
|
||||
elif [[ "${command}" = "build" ]]; then
|
||||
run_build
|
||||
elif [[ ${command} = "deploy" ]]; then
|
||||
if [[ ${no_build} != true ]]; then
|
||||
run_build
|
||||
fi
|
||||
main "$@"
|
||||
fi
|
||||
|
|
@ -12,6 +12,7 @@ toc_footers:
|
|||
includes:
|
||||
- licenses
|
||||
- gitignores
|
||||
- public_keys
|
||||
- users
|
||||
- projects
|
||||
- repositories
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
|
||||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<metadata>Generated by IcoMoon</metadata>
|
||||
<defs>
|
||||
<font id="slate" horiz-adv-x="1024">
|
||||
<font-face units-per-em="1024" ascent="960" descent="-64" />
|
||||
<missing-glyph horiz-adv-x="1024" />
|
||||
<glyph unicode=" " d="" horiz-adv-x="512" />
|
||||
<glyph unicode="" d="M438.857 877.714q119.429 0 220.286-58.857t159.714-159.714 58.857-220.286-58.857-220.286-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857zM512 165.143v108.571q0 8-5.143 13.429t-12.571 5.429h-109.714q-7.429 0-13.143-5.714t-5.714-13.143v-108.571q0-7.429 5.714-13.143t13.143-5.714h109.714q7.429 0 12.571 5.429t5.143 13.429zM510.857 361.714l10.286 354.857q0 6.857-5.714 10.286-5.714 4.571-13.714 4.571h-125.714q-8 0-13.714-4.571-5.714-3.429-5.714-10.286l9.714-354.857q0-5.714 5.714-10t13.714-4.286h105.714q8 0 13.429 4.286t6 10z" />
|
||||
<glyph unicode="" d="M585.143 164.571v91.429q0 8-5.143 13.143t-13.143 5.143h-54.857v292.571q0 8-5.143 13.143t-13.143 5.143h-182.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h54.857v-182.857h-54.857q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h256q8 0 13.143 5.143t5.143 13.143zM512 676.571v91.429q0 8-5.143 13.143t-13.143 5.143h-109.714q-8 0-13.143-5.143t-5.143-13.143v-91.429q0-8 5.143-13.143t13.143-5.143h109.714q8 0 13.143 5.143t5.143 13.143zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
|
||||
<glyph unicode="" d="M733.714 531.428q0 16-10.286 26.286l-52 51.429q-10.857 10.857-25.714 10.857t-25.714-10.857l-233.143-232.571-129.143 129.143q-10.857 10.857-25.714 10.857t-25.714-10.857l-52-51.429q-10.286-10.286-10.286-26.286 0-15.429 10.286-25.714l206.857-206.857q10.857-10.857 25.714-10.857 15.429 0 26.286 10.857l310.286 310.286q10.286 10.286 10.286 25.714zM877.714 438.857q0-119.429-58.857-220.286t-159.714-159.714-220.286-58.857-220.286 58.857-159.714 159.714-58.857 220.286 58.857 220.286 159.714 159.714 220.286 58.857 220.286-58.857 159.714-159.714 58.857-220.286z" />
|
||||
<glyph unicode="" d="M658.286 475.428q0 105.714-75.143 180.857t-180.857 75.143-180.857-75.143-75.143-180.857 75.143-180.857 180.857-75.143 180.857 75.143 75.143 180.857zM950.857 0q0-29.714-21.714-51.429t-51.429-21.714q-30.857 0-51.429 21.714l-196 195.429q-102.286-70.857-228-70.857-81.714 0-156.286 31.714t-128.571 85.714-85.714 128.571-31.714 156.286 31.714 156.286 85.714 128.571 128.571 85.714 156.286 31.714 156.286-31.714 128.571-85.714 85.714-128.571 31.714-156.286q0-125.714-70.857-228l196-196q21.143-21.143 21.143-51.429z" horiz-adv-x="951" />
|
||||
</font></defs></svg>
|
||||
|
Before Width: | Height: | Size: 2.9 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 96 B |
|
|
@ -1,39 +0,0 @@
|
|||
# Authentication
|
||||
|
||||
> To authorize, use this code:
|
||||
|
||||
```ruby
|
||||
require 'kittn'
|
||||
|
||||
api = Kittn::APIClient.authorize!('meowmeowmeow')
|
||||
```
|
||||
|
||||
```python
|
||||
import kittn
|
||||
|
||||
api = kittn.authorize('meowmeowmeow')
|
||||
```
|
||||
|
||||
```shell
|
||||
# With shell, you can just pass the correct header with each request
|
||||
curl "api_endpoint_here" \
|
||||
-H "Authorization: meowmeowmeow"
|
||||
```
|
||||
|
||||
```javascript
|
||||
const kittn = require('kittn');
|
||||
|
||||
let api = kittn.authorize('meowmeowmeow');
|
||||
```
|
||||
|
||||
> Make sure to replace `meowmeowmeow` with your API key.
|
||||
|
||||
Kittn uses API keys to allow access to the API. You can register a new Kittn API key at our [developer portal](http://example.com/developers).
|
||||
|
||||
Kittn expects for the API key to be included in all API requests to the server in a header that looks like the following:
|
||||
|
||||
`Authorization: meowmeowmeow`
|
||||
|
||||
<aside class="notice">
|
||||
You must replace <code>meowmeowmeow</code> with your personal API key.
|
||||
</aside>
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
# Errors
|
||||
|
||||
<aside class="notice">
|
||||
This error section is stored in a separate file in <code>includes/_errors.md</code>. Slate allows you to optionally separate out your docs into many files...just save them to the <code>includes</code> folder and add them to the top of your <code>index.md</code>'s frontmatter. Files are included in the order listed.
|
||||
</aside>
|
||||
|
||||
The Kittn API uses the following error codes:
|
||||
|
||||
|
||||
Error Code | Meaning
|
||||
---------- | -------
|
||||
400 | Bad Request -- Your request is invalid.
|
||||
401 | Unauthorized -- Your API key is wrong.
|
||||
403 | Forbidden -- The kitten requested is hidden for administrators only.
|
||||
404 | Not Found -- The specified kitten could not be found.
|
||||
405 | Method Not Allowed -- You tried to access a kitten with an invalid method.
|
||||
406 | Not Acceptable -- You requested a format that isn't json.
|
||||
410 | Gone -- The kitten requested has been removed from our servers.
|
||||
418 | I'm a teapot.
|
||||
429 | Too Many Requests -- You're requesting too many kittens! Slow down!
|
||||
500 | Internal Server Error -- We had a problem with our server. Try again later.
|
||||
503 | Service Unavailable -- We're temporarily offline for maintenance. Please try again later.
|
||||
|
|
@ -1,47 +0,0 @@
|
|||
# Gitignores
|
||||
|
||||
## gitignore模板列表
|
||||
获取gitignore模板列表, 支持名称搜索过滤
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "name=Ada" \
|
||||
http://localhost:3000/api/ignores.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/ignores.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/ignores.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
name |否| 否 ||string |gitignore名称
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
id |int |id |
|
||||
name |string|gitignore名称|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"ignores": [
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Ada"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
|
@ -1 +0,0 @@
|
|||
# Issues
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
# Licenses
|
||||
|
||||
|
||||
## Get All Licenses
|
||||
The Licenses API returns metadata about popular open source licenses and information about a particular project's license file.
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "name=AFL" \
|
||||
http://localhost:3000/api/licenses
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/licenses')
|
||||
```
|
||||
|
||||
### HTTP Request
|
||||
|
||||
`GET https://forgeplus.trustie.net/api/licenses.json`
|
||||
|
||||
### 请求参数
|
||||
|
||||
Name | Required | Type | Description
|
||||
----- | ---- | ----- | -----
|
||||
name |false|string |name of the license
|
||||
|
||||
|
||||
> 返回字段说明:
|
||||
|
||||
```json
|
||||
{
|
||||
"licenses": [
|
||||
{
|
||||
"id": 57,
|
||||
"name": "AFL-1.2"
|
||||
},
|
||||
{
|
||||
"id": 76,
|
||||
"name": "AFL-3.0"
|
||||
},
|
||||
{
|
||||
"id": 214,
|
||||
"name": "AFL-1.1"
|
||||
},
|
||||
{
|
||||
"id": 326,
|
||||
"name": "AFL-2.1"
|
||||
},
|
||||
{
|
||||
"id": 350,
|
||||
"name": "AFL-2.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -1 +0,0 @@
|
|||
# Organizations
|
||||
|
|
@ -1,852 +0,0 @@
|
|||
# Projects
|
||||
|
||||
## 申请加入项目
|
||||
申请加入项目
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/applied_projects.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/appliedr_projects.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/applied_projects.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|applied_project.code |是| |string |邀请码 |
|
||||
|applied_project.role |否| |string |项目权限,reporter: 报告者, developer: 开发者,manager:管理员 |
|
||||
|
||||
> 请求的JSON示例
|
||||
|
||||
```json
|
||||
{
|
||||
"applied_project": {
|
||||
"code": "1una34",
|
||||
"role": "developer"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |申请id |
|
||||
|status |string |申请状态,canceled:取消,common:正在申请, accept:已接受,refuse:已拒绝|
|
||||
|time_ago |string |项目申请创建的时间 |
|
||||
|project.id |int |申请项目的id |
|
||||
|project.identifier |string |申请项目的标识 |
|
||||
|project.name |string |申请项目的名称 |
|
||||
|project.description |string |申请项目的描述 |
|
||||
|project.is_public |bool |申请项目是否公开 |
|
||||
|project.owner.id |bool |申请项目拥有者id |
|
||||
|project.owner.type |string |申请项目拥有者类型 |
|
||||
|project.owner.name |string |申请项目拥有者昵称 |
|
||||
|project.owner.login |string |申请项目拥有者标识 |
|
||||
|project.owner.image_url |string |申请项目拥有者头像 |
|
||||
|user.id |int |申请创建者的id |
|
||||
|user.type |string |申请创建者的类型 |
|
||||
|user.name |string |申请创建者的名称 |
|
||||
|user.login |string |申请创建者的标识 |
|
||||
|user.image_url |string |申请创建者头像 |
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"project": {
|
||||
"id": 74,
|
||||
"identifier": "hehuisssjssjjsjs",
|
||||
"name": "hehuisssjssjjsjs",
|
||||
"description": "wwww",
|
||||
"is_public": false,
|
||||
"owner": {
|
||||
"id": 10,
|
||||
"type": "User",
|
||||
"name": "testforge1",
|
||||
"login": "testforge1",
|
||||
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"id": 6,
|
||||
"type": "User",
|
||||
"name": "何慧",
|
||||
"login": "yystopf",
|
||||
"image_url": "images/avatars/User/6?t=1622513134"
|
||||
},
|
||||
"id": 7,
|
||||
"status": "common",
|
||||
"created_at": "2021-06-09 16:41",
|
||||
"time_ago": "1分钟前"
|
||||
}
|
||||
```
|
||||
|
||||
## 获取项目列表
|
||||
获取项目列表,也可以更加相关条件过滤搜素
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "page=1" \
|
||||
-d "limit=5" \
|
||||
http://localhost:3000/api/projects | jq
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/projects')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/projects`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
page | false | 1 | string | 页数,第几页
|
||||
limit | false | 15 | string | 每页多少条数据,默认15条
|
||||
sort_by | false | | string | 排序类型, 取值:updated_on、created_on、forked_count、praises_count; updated_on: 更新时间排序,created_on: 创建时间排序,forked_count: fork数据排序,praises_count: 点赞数量排序,默认为updated_on更新时间排序
|
||||
sort_direction| false | | string | 排序方式,取值为: desc、asc; desc: 降序排序, asc: 升序排序, 默认为:desc
|
||||
search | false | | string | 按照项目名称搜索
|
||||
category_id | false | | int | 项目类别id
|
||||
language_id | false | | int | 项目语言id
|
||||
project_type | false | | string | 项目类型, 取值为:common、mirror; common:开源托管项目, mirror:开源镜像项目
|
||||
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
total_count | int | 项目总条数
|
||||
id | string | 项目id
|
||||
name | string | 项目名称
|
||||
description | string | 项目简介
|
||||
visits | int | 流量数
|
||||
forked_count | int | 被fork的数量
|
||||
praises_count | int | star数量
|
||||
is_public | boolean | 是否公开, true:公开,false:未公开
|
||||
mirror_url | string | 镜像url
|
||||
last_update_time| int | 最后更新时间,为UNIX格式的时间戳
|
||||
author | object | 项目创建者
|
||||
-- name | string | 用户名,也是用户标识
|
||||
category | object | 项目类别
|
||||
-- id | int | 项目类型id
|
||||
-- name | string | 项目类型名称
|
||||
language | object | 项目语言
|
||||
-- id | int | 项目语言id
|
||||
-- name | string | 项目语言名称
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 3096,
|
||||
"projects": [
|
||||
{
|
||||
"id": 1400794,
|
||||
"repo_id": 1402452,
|
||||
"identifier": "cscw_2021_sponsor",
|
||||
"name": "Sponsor机制下的开源贡献",
|
||||
"description": "CSCW 2021 sponsor机制研究",
|
||||
"visits": 5,
|
||||
"praises_count": 0,
|
||||
"forked_count": 0,
|
||||
"is_public": true,
|
||||
"mirror_url": null,
|
||||
"type": 0,
|
||||
"last_update_time": 1611971671,
|
||||
"time_ago": "2天前",
|
||||
"forked_from_project_id": null,
|
||||
"open_devops": false,
|
||||
"platform": "forge",
|
||||
"author": {
|
||||
"name": "张迅晖",
|
||||
"login": "Nigel",
|
||||
"image_url": "images/avatars/User/3675?t=1611832880"
|
||||
},
|
||||
"category": {
|
||||
"id": 13,
|
||||
"name": "云计算和大数据"
|
||||
},
|
||||
"language": {
|
||||
"id": 34,
|
||||
"name": "Python3.6"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Remember — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
||||
|
||||
## 推荐项目
|
||||
获取推荐项目列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/projects/recommend | jq
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/projects/recommend.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/projects/recommend`
|
||||
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
total_count |int |项目总条数
|
||||
id |string |项目id
|
||||
name |string|项目名称
|
||||
description |string|项目简介
|
||||
visits |int|流量数
|
||||
forked_count |int|被fork的数量
|
||||
praises_count |int|star数量
|
||||
is_public |boolean|是否公开, true:公开,false:未公开
|
||||
mirror_url |string|镜像url
|
||||
last_update_time|int|最后更新时间,为UNIX格式的时间戳
|
||||
author |object|项目创建者
|
||||
-- name |string|用户名,也是用户标识
|
||||
category |object|项目类别
|
||||
-- id |int|项目类型id
|
||||
-- name |string|项目类型名称
|
||||
language |object|项目语言
|
||||
-- id |int|项目语言id
|
||||
-- name |string|项目语言名称
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": 20,
|
||||
"repo_id": 2,
|
||||
"identifier": "PNAekinmH",
|
||||
"name": "FNILL",
|
||||
"visits": 13567,
|
||||
"author": {
|
||||
"name": "王一达",
|
||||
"login": "wangyida",
|
||||
"image_url": "avatars/User/b"
|
||||
},
|
||||
"category": {
|
||||
"id": 8,
|
||||
"name": "其他"
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
<aside class="success">
|
||||
Remember — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
||||
|
||||
## 项目导航
|
||||
获取项目导航信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/menu_list | jq
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/menu_list')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/:owner/:repo/menu_list`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
owner |是| |string |用户登录名
|
||||
repo |是| |string |项目标识identifier
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
menu_name |string|导航名称, home:主页,code:代码库,issues:易修,pulls:合并请求,devops:工作流,versions:里程碑,activity:动态,setting:仓库设置
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"menu_name": "home"
|
||||
},
|
||||
{
|
||||
"menu_name": "code"
|
||||
},
|
||||
{
|
||||
"menu_name": "pulls"
|
||||
},
|
||||
{
|
||||
"menu_name": "activity"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
## 项目主页
|
||||
获取项目主页信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/jasder/forgeplus/about | jq
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/jasder/forgeplus/about')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/:owner/:repo/about`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
owner |是| |string |用户登录名
|
||||
repo |是| |string |项目标识identifier
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
identifier |string|project's identifier
|
||||
content |string|主页内容
|
||||
attachments |array|附件
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"content": "",
|
||||
"identifier": "forgeplus",
|
||||
attachments: []
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Remember — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
||||
## 项目模块信息
|
||||
项目模块信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/project_units.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/project_units')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/yystopf/ceshi/project_units`
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type |string|模块名称 |
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"type": "code"
|
||||
},
|
||||
{
|
||||
"type": "pulls"
|
||||
},
|
||||
{
|
||||
"type": "issues"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## 更改项目模块展示
|
||||
更改项目模块展示
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST \
|
||||
-H "accept: application/json" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{ \"unit_typs\": [\"code\", \"pulls\"]}" \
|
||||
http://localhost:3000/api/yystopf/ceshi/project_units.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/yystopf/ceshi/project_units')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/yystopf/ceshi/project_units`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|unit_types |是| |array | 项目模块内容, 支持以下参数:code:代码库,issues:易修,pulls:合并请求,devops:工作流,versions:里程碑 |
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|status |int|返回状态, 0: 表示操作成功 |
|
||||
|message |string|返回信息说明|
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
## 创建项目
|
||||
创建项目
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST \
|
||||
-d "user_id=36401" \
|
||||
-d "name=hnfl_demo" \
|
||||
-d "description=my first project" \
|
||||
-d "repository_name=hnfl_demo" \
|
||||
-d "project_category_id=1" \
|
||||
-d "project_language_id=2" \
|
||||
-d "ignore_id=2" \
|
||||
-d "license_id=1" \
|
||||
http://localhost:3000/api/projects.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/projects.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/projects`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|user_id |是| |int |用户id或者组织id |
|
||||
|name |是| |string |项目名称 |
|
||||
|description |是| |string |项目描述 |
|
||||
|repository_name |是| |string |仓库名称, 只含有数字、字母、下划线不能以下划线开头和结尾,且唯一 |
|
||||
|project_category_id|是| |int |项目类别id |
|
||||
|project_language_id|是| |int |项目语言id |
|
||||
|ignore_id |否| |int |gitignore相关id |
|
||||
|license_id |否| |int |开源许可证id |
|
||||
|private |否| |boolean|项目是否私有, true:为私有,false: 公开,默认为公开 |
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |id |
|
||||
|name |string|项目名称|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3240,
|
||||
"name": "好项目"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 创建镜像项目
|
||||
创建镜像项目
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST \
|
||||
-d "user_id=36408" \
|
||||
-d "clone_addr=https://gitea.com/mx8090alex/golden.git" \
|
||||
-d "name=golden_mirror1" \
|
||||
-d "description=golden_mirror" \
|
||||
-d "project_category_id=1" \
|
||||
-d "project_language_id=2" \
|
||||
http://localhost:3000/api/projects/migrate.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/projects/migrate.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/projects/migrate.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|user_id |是| |int |用户id或者组织id |
|
||||
|name |是| |string |项目名称 |
|
||||
|clone_addr |是| |string |镜像项目clone地址 |
|
||||
|description |否| |string |项目描述 |
|
||||
|repository_name |是| |string |仓库名称, 只含有数字、字母、下划线不能以下划线开头和结尾,且唯一 |
|
||||
|project_category_id|是| |int |项目类别id |
|
||||
|project_language_id|是| |int |项目语言id |
|
||||
|is_mirror |否| |boolean|是否设置为镜像, true:是, false:否,默认为否 |
|
||||
|auth_username |否| |string|镜像源仓库的登录用户名 |
|
||||
|auth_password |否| |string|镜像源仓库的登录秘密 |
|
||||
|private |否| |boolean|项目是否私有, true:为私有,false: 非私有,默认为公开 |
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |id |
|
||||
|name |string|项目名称|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3241,
|
||||
"name": "这是一个镜像项目"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 同步镜像
|
||||
手动同步镜像
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/repositories/1244/sync_mirror.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/repositories/1244/sync_mirror.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/repositories/:id/sync_mirror.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|id |是| |int |仓库id |
|
||||
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|status |int |状态码, 0:标识请求成功 |
|
||||
|message |string|服务端返回的信息说明|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Fork项目
|
||||
fork项目
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/jasder/forgeplus/forks.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/jaser/jasder_test/forks.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/:owner/:repo/forks.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |项目id |
|
||||
|identifier |string|项目标识|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3290,
|
||||
"identifier": "newadm"
|
||||
}
|
||||
```
|
||||
|
||||
## 用户管理的组织列表
|
||||
用户管理的组织列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/organizations.json | jq
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/:owner/:repo/applied_transfer_projects/organizations')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/:owner/:repo/applied_transfer_projects/organizations`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
owner |是| |string |用户登录名
|
||||
repo |是| |string |项目标识identifier
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
name |string|组织标识
|
||||
nickname |string|组织名称
|
||||
description|string|组织描述
|
||||
avatar_url|string|组织头像
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 3,
|
||||
"organizations": [
|
||||
{
|
||||
"id": 9,
|
||||
"name": "ceshi_org",
|
||||
"nickname": "测试组织",
|
||||
"description": "测试组织",
|
||||
"avatar_url": "images/avatars/Organization/9?t=1612706073"
|
||||
},
|
||||
{
|
||||
"id": 51,
|
||||
"name": "ceshi",
|
||||
"nickname": "测试组织哈哈哈",
|
||||
"description": "23212312",
|
||||
"avatar_url": "images/avatars/Organization/51?t=1618800723"
|
||||
},
|
||||
{
|
||||
"id": 52,
|
||||
"name": "ceshi1",
|
||||
"nickname": "身份卡手动阀",
|
||||
"description": "1231手动阀是的",
|
||||
"avatar_url": "images/avatars/Organization/52?t=1618805056"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## 迁移项目
|
||||
迁移项目,edit接口is_transfering为true表示正在迁移
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/:owner/:repo/applied_transfer_projects.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/:owner/:repo/applied_transfer_projects.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|owner_name|是| |string |迁移对象标识 |
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |项目id |
|
||||
|status |string |项目迁移状态,canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝|
|
||||
|time_ago |string |项目迁移创建的时间 |
|
||||
|project.id |int |迁移项目的id |
|
||||
|project.identifier |string |迁移项目的标识 |
|
||||
|project.name |string |迁移项目的名称 |
|
||||
|project.description |string |迁移项目的描述 |
|
||||
|project.is_public |bool |迁移项目是否公开 |
|
||||
|project.owner.id |bool |迁移项目拥有者id |
|
||||
|project.owner.type |string |迁移项目拥有者类型 |
|
||||
|project.owner.name |string |迁移项目拥有者昵称 |
|
||||
|project.owner.login |string |迁移项目拥有者标识 |
|
||||
|project.owner.image_url |string |迁移项目拥有者头像 |
|
||||
|user.id |int |迁移创建者的id |
|
||||
|user.type |string |迁移创建者的类型 |
|
||||
|user.name |string |迁移创建者的名称 |
|
||||
|user.login |string |迁移创建者的标识 |
|
||||
|user.image_url |string |迁移创建者头像 |
|
||||
|owner.id |int |迁移接受者的id |
|
||||
|owner.type |string |迁移接受者的类型 |
|
||||
|owner.name |string |迁移接受者的名称 |
|
||||
|owner.login |string |迁移接受者的标识 |
|
||||
|owner.image_url |string |迁移接受者头像 |
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"project": {
|
||||
"id": 86,
|
||||
"identifier": "ceshi_repo1",
|
||||
"name": "测试项目啊1",
|
||||
"description": "二十多",
|
||||
"is_public": true,
|
||||
"owner": {
|
||||
"id": 52,
|
||||
"type": "Organization",
|
||||
"name": "身份卡手动阀",
|
||||
"login": "ceshi1",
|
||||
"image_url": "images/avatars/Organization/52?t=1618805056"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"id": 6,
|
||||
"type": "User",
|
||||
"name": "yystopf",
|
||||
"login": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
|
||||
},
|
||||
"owner": {
|
||||
"id": 9,
|
||||
"type": "Organization",
|
||||
"name": "测试组织",
|
||||
"login": "ceshi_org",
|
||||
"image_url": "images/avatars/Organization/9?t=1612706073"
|
||||
},
|
||||
"id": 4,
|
||||
"status": "common",
|
||||
"created_at": "2021-04-26 09:54",
|
||||
"time_ago": "1分钟前"
|
||||
}
|
||||
```
|
||||
|
||||
## 取消迁移项目
|
||||
迁移项目,edit接口is_transfering为true表示正在迁移
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/ceshi1/ceshi_repo1/applied_transfer_projects/cancel.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/:owner/:repo/applied_transfer_projects/cancel.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/:owner/:repo/applied_transfer_projects/cancel.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |迁移id |
|
||||
|status |string |迁移状态,canceled:取消,common:正在迁移, accept:已接受,refuse:已拒绝|
|
||||
|time_ago |string |迁移创建的时间 |
|
||||
|project.id |int |迁移项目的id |
|
||||
|project.identifier |string |迁移项目的标识 |
|
||||
|project.name |string |迁移项目的名称 |
|
||||
|project.description |string |迁移项目的描述 |
|
||||
|project.is_public |bool |迁移项目是否公开 |
|
||||
|project.owner.id |bool |迁移项目拥有者id |
|
||||
|project.owner.type |string |迁移项目拥有者类型 |
|
||||
|project.owner.name |string |迁移项目拥有者昵称 |
|
||||
|project.owner.login |string |迁移项目拥有者标识 |
|
||||
|project.owner.image_url |string |迁移项目拥有者头像 |
|
||||
|user.id |int |迁移创建者的id |
|
||||
|user.type |string |迁移创建者的类型 |
|
||||
|user.name |string |迁移创建者的名称 |
|
||||
|user.login |string |迁移创建者的标识 |
|
||||
|user.image_url |string |迁移创建者头像 |
|
||||
|owner.id |int |迁移接受者的id |
|
||||
|owner.type |string |迁移接受者的类型 |
|
||||
|owner.name |string |迁移接受者的名称 |
|
||||
|owner.login |string |迁移接受者的标识 |
|
||||
|owner.image_url |string |迁移接受者头像 |
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"project": {
|
||||
"id": 86,
|
||||
"identifier": "ceshi_repo1",
|
||||
"name": "测试项目啊1",
|
||||
"description": "二十多",
|
||||
"is_public": true,
|
||||
"owner": {
|
||||
"id": 52,
|
||||
"type": "Organization",
|
||||
"name": "身份卡手动阀",
|
||||
"login": "ceshi1",
|
||||
"image_url": "images/avatars/Organization/52?t=1618805056"
|
||||
}
|
||||
},
|
||||
"user": {
|
||||
"id": 6,
|
||||
"type": "User",
|
||||
"name": "yystopf",
|
||||
"login": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
|
||||
},
|
||||
"owner": {
|
||||
"id": 9,
|
||||
"type": "Organization",
|
||||
"name": "测试组织",
|
||||
"login": "ceshi_org",
|
||||
"image_url": "images/avatars/Organization/9?t=1612706073"
|
||||
},
|
||||
"id": 4,
|
||||
"status": "common",
|
||||
"created_at": "2021-04-26 09:54",
|
||||
"time_ago": "1分钟前"
|
||||
}
|
||||
```
|
||||
|
|
@ -0,0 +1,158 @@
|
|||
<!--
|
||||
* @Date: 2021-07-14 15:10:29
|
||||
* @LastEditors: viletyy
|
||||
* @LastEditTime: 2021-07-14 15:37:23
|
||||
* @FilePath: /forgeplus/app/docs/slate/source/includes/_public_keys.md
|
||||
-->
|
||||
# PublicKeys
|
||||
|
||||
## public_keys列表
|
||||
获取public_keys列表,支持分页
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/public_keys.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/public_keys.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/public_keys.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
page |否| 1 | int | 页码 |
|
||||
limit |否| 15 | int | 每页数量 |
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
total_count |int |总数 |
|
||||
public_keys.id |int |ID|
|
||||
public_keys.name |string|密钥标题|
|
||||
public_keys.content |string|密钥内容|
|
||||
public_keys.fingerprint |string|密钥标识|
|
||||
public_keys.created_time |string|密钥创建时间|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 1,
|
||||
"public_keys": [
|
||||
{
|
||||
"id": 16,
|
||||
"name": "xxx",
|
||||
"content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDe5ETOTB5PcmcYJkIhfF7+mxmJQDCLg7/LnMoKHpKoo/jYUnFU9OjfsxVo3FTNUvh2475WXMAur5KsFoNKjK9+JHxvoXyJKmyVPWgXU/NRxQyaWPnPLPK8qPRF5ksJE6feBOqtsdxsvBiHs2r1NX/U26Ecnpr6avudD0cmyrEfbYMWbupLrhsd39dswPT73f3W5jc7B9Y47Ioiv8UOju3ABt1+kpuAjaaVC6VtUQoEFiZb1y33yBnyePya7dvFyApyD4ILyyIG2rtZWK7l53YFnwZDuFsTWjEEEQD0U4FBSFdH5wtwx0WQLMSNyTtaFBSG0kJ+uiQQIrxlvikcm63df7zbC3/rWLPsKgW122Zt966dcpFqiCiJNDKZPPw3qpg8TBL6X+qIZ+FxVEk/16/zScpyEfoxQp0GvgxI7hPLErmfkC5tMsib8MAXYBNyvJXna0vg/wOaNNIaI4SAH9Ksh3f/TtalYVjp6WxIwVBfnbq51WnmlnEXePtX6XjAGL+GbF2VQ1nv/IzrY09tNbTV6wQsrSIP3VDzYQxdJ1rdsVNMoJB0H2Pu0NdcSz53Wx45N+myD0QnE05ss+zDp5StY90OYsx2aCo6qAA8Qn2jUjdta7MQWwkPfKrta4tTQ0XbWMjx4/E1+l3J5liwZkl2XOGOwhfXdRsBjaEziZ18kQ== yystopf@163.com",
|
||||
"fingerprint": "SHA256:cU8AK/+roqUUyiaYXIdS2Nj4+Rb2p6rqWSeRDc+aqKM",
|
||||
"created_unix": 1626246596,
|
||||
"created_time": "2021/07/14 15:09"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
||||
## 创建public_key
|
||||
创建public_key
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST \
|
||||
http://localhost:3000/api/public_keys.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/public_keys.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/public_keys.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
key |是 | 否 | string | 密钥 |
|
||||
title |是 | 否 | string | 密钥标题 |
|
||||
|
||||
> 请求的JSON示例:
|
||||
```json
|
||||
{
|
||||
"public_key": {
|
||||
"key": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDe5ETOTB5PcmcYJkIhfF7+mxmJQDCLg7/LnMoKHpKoo/jYUnFU9OjfsxVo3FTNUvh2475WXMAur5KsFoNKjK9+JHxvoXyJKmyVPWgXU/NRxQyaWPnPLPK8qPRF5ksJE6feBOqtsdxsvBiHs2r1NX/U26Ecnpr6avudD0cmyrEfbYMWbupLrhsd39dswPT73f3W5jc7B9Y47Ioiv8UOju3ABt1+kpuAjaaVC6VtUQoEFiZb1y33yBnyePya7dvFyApyD4ILyyIG2rtZWK7l53YFnwZDuFsTWjEEEQD0U4FBSFdH5wtwx0WQLMSNyTtaFBSG0kJ+uiQQIrxlvikcm63df7zbC3/rWLPsKgW122Zt966dcpFqiCiJNDKZPPw3qpg8TBL6X+qIZ+FxVEk/16/zScpyEfoxQp0GvgxI7hPLErmfkC5tMsib8MAXYBNyvJXna0vg/wOaNNIaI4SAH9Ksh3f/TtalYVjp6WxIwVBfnbq51WnmlnEXePtX6XjAGL+GbF2VQ1nv/IzrY09tNbTV6wQsrSIP3VDzYQxdJ1rdsVNMoJB0H2Pu0NdcSz53Wx45N+myD0QnE05ss+zDp5StY90OYsx2aCo6qAA8Qn2jUjdta7MQWwkPfKrta4tTQ0XbWMjx4/E1+l3J5liwZkl2XOGOwhfXdRsBjaEziZ18kQ== yystopf@163.com",
|
||||
"title": "xxx"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 返回字段说明
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
total_count |int |总数 |
|
||||
id |int |ID|
|
||||
name |string|密钥标题|
|
||||
content |string|密钥内容|
|
||||
fingerprint |string|密钥标识|
|
||||
created_time |string|密钥创建时间|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 17,
|
||||
"name": "xxx",
|
||||
"content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDe5ETOTB5PcmcYJkIhfF7+mxmJQDCLg7/LnMoKHpKoo/jYUnFU9OjfsxVo3FTNUvh2475WXMAur5KsFoNKjK9+JHxvoXyJKmyVPWgXU/NRxQyaWPnPLPK8qPRF5ksJE6feBOqtsdxsvBiHs2r1NX/U26Ecnpr6avudD0cmyrEfbYMWbupLrhsd39dswPT73f3W5jc7B9Y47Ioiv8UOju3ABt1+kpuAjaaVC6VtUQoEFiZb1y33yBnyePya7dvFyApyD4ILyyIG2rtZWK7l53YFnwZDuFsTWjEEEQD0U4FBSFdH5wtwx0WQLMSNyTtaFBSG0kJ+uiQQIrxlvikcm63df7zbC3/rWLPsKgW122Zt966dcpFqiCiJNDKZPPw3qpg8TBL6X+qIZ+FxVEk/16/zScpyEfoxQp0GvgxI7hPLErmfkC5tMsib8MAXYBNyvJXna0vg/wOaNNIaI4SAH9Ksh3f/TtalYVjp6WxIwVBfnbq51WnmlnEXePtX6XjAGL+GbF2VQ1nv/IzrY09tNbTV6wQsrSIP3VDzYQxdJ1rdsVNMoJB0H2Pu0NdcSz53Wx45N+myD0QnE05ss+zDp5StY90OYsx2aCo6qAA8Qn2jUjdta7MQWwkPfKrta4tTQ0XbWMjx4/E1+l3J5liwZkl2XOGOwhfXdRsBjaEziZ18kQ== yystopf@163.com",
|
||||
"fingerprint": "SHA256:cU8AK/+roqUUyiaYXIdS2Nj4+Rb2p6rqWSeRDc+aqKM",
|
||||
"created_time": "2021/07/14 15:26"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
||||
|
||||
## 删除public_key
|
||||
删除public_key
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X DELETE \
|
||||
http://localhost:3000/api/public_keys/:id.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('DELETE /api/public_keys/:id.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`DELETE api/public_keys/:id.json`
|
||||
|
||||
### 请求参数
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
id |是 | 否 | int | 密钥ID |
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success — a happy kitten is an authenticated kitten!
|
||||
</aside>
|
||||
|
||||
|
|
@ -1 +1,502 @@
|
|||
# Pulls
|
||||
|
||||
|
||||
## Get a pull request
|
||||
获取合并请求详情接口
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/Jasder/gitlink/pulls/88.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/Jasder/gitlink/pulls/88.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/pulls/:id.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|id |是| | integer | pull id值 |
|
||||
|
||||
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "响应成功",
|
||||
"project_name": "Gitlink",
|
||||
"identifier": "forgeplus",
|
||||
"project_identifier": "forgeplus",
|
||||
"pr_time": "52分钟前",
|
||||
"commits_count": 229,
|
||||
"files_count": 328,
|
||||
"comments_count": 0,
|
||||
"comments_total_count": 0,
|
||||
"pull_request": {
|
||||
"id": 1189,
|
||||
"base": "master",
|
||||
"head": "develop",
|
||||
"status": 0,
|
||||
"fork_project_id": null,
|
||||
"is_original": false,
|
||||
"pull_request_staus": "open",
|
||||
"fork_project_user": null,
|
||||
"create_user": "jasder",
|
||||
"mergeable": true,
|
||||
"state": "open"
|
||||
},
|
||||
"issue": {
|
||||
"id": 51888,
|
||||
"subject": "FIx release v3.2.0",
|
||||
"description": null,
|
||||
"is_private": false,
|
||||
"branch_name": null,
|
||||
"project_author_name": "Gitlink",
|
||||
"closed_on": "",
|
||||
"created_at": "2021-10-12 15:51",
|
||||
"assign_user_name": "victor",
|
||||
"assign_user_login": "moshenglv",
|
||||
"author_name": "段甲生",
|
||||
"author_login": "jasder",
|
||||
"author_picture": "images/avatars/User/36480?t=1615520120",
|
||||
"issue_status": "新增",
|
||||
"priority": "正常",
|
||||
"version": null,
|
||||
"issue_tags": null
|
||||
},
|
||||
"conflict_files": []
|
||||
}
|
||||
```
|
||||
|
||||
## 获取pull request文件列表
|
||||
获取pull request文件列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/Jason/gitlink/pulls/1/files.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/jasder/gitlink/pulls/1/files.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/pulls/:id/files.json`
|
||||
|
||||
### 请求参数:
|
||||
|参数名|必选|类型|说明|
|
||||
|-|-|-|-|
|
||||
|owner |是|string |用户登录名 |
|
||||
|repo |是|string |project's identifier |
|
||||
|id |是|int |pull request's id |
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|-|-|-|
|
||||
|files_count |int|文件更改的总数量|
|
||||
|total_addition |int|添加代码总行数|
|
||||
|total_deletion |int|删除代码总行数|
|
||||
|files |array||
|
||||
|-- sha |string|commit's sha value|
|
||||
|-- name |string|当前文件名|
|
||||
|-- old_name |string| 修改之前的文件名称,与name相同的话,说明文件名未更改|
|
||||
|-- addition |int|文件添加的行数|
|
||||
|-- deletion |int|文件删除的行数|
|
||||
|-- type |int|文件类型, 1: 表示该文件只添加了内容,2: 表示该文件内容有修改, 3: 表示文件被删除或者改文件只删除了内容|
|
||||
|-- isCreated |boolean|当前文件是否为新增文件, true: 是, false: 否|
|
||||
|-- isDeleted |boolean|当前文件是否被删除, true: 是,false: 否|
|
||||
|-- isBin |boolean|当前文件是否为二进制文件,true: 是,false: 否|
|
||||
|-- isLFSFile |boolean|当前文件是否为LFS文件,true: 是,false: 否|
|
||||
|-- isRenamed |boolean|当前文件是否被重命名,true: 是,false: 否|
|
||||
|-- sections |array||
|
||||
|---- fileName |string|文件名称|
|
||||
|---- lines |array||
|
||||
|------ leftIdx |string|文件变动之前所在行数|
|
||||
|------ rightIdx |string|文件更改后所在行数|
|
||||
|------ type |string|文件变更类型,1: 新增,2: 修改, 3: 删除, 4: diff统计信息|
|
||||
|------ content |string|文件变更的内容|
|
||||
|------ sectionInfo |object||
|
||||
|-------- path |string|文件相对仓库的路径|
|
||||
|-------- lastLeftIdx |int||
|
||||
|-------- lastRightIdx |int||
|
||||
|-------- leftHunkSize |int|文件变更之前的行数|
|
||||
|-------- rightHunkSize |int|文件变更之后的行数(及当前页面编辑器显示的总行数)|
|
||||
|-------- leftIdx |int|文件变更之前所在行数|
|
||||
|-------- rightIdx |int|文件变更之后所在行数(即:页面编辑器开始显示的行数)|
|
||||
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"files_count": 6,
|
||||
"total_addition": 447,
|
||||
"total_deletion": 0,
|
||||
"files": [
|
||||
{
|
||||
"sha": "xefenisnii",
|
||||
"name": "文件.txt",
|
||||
"old_name": "文件.txt",
|
||||
"index": 6,
|
||||
"addition": 2,
|
||||
"deletion": 0,
|
||||
"type": 1,
|
||||
"isCreated": true,
|
||||
"isDeleted": false,
|
||||
"isBin": false,
|
||||
"isLFSFile": false,
|
||||
"isRenamed": false,
|
||||
"isSubmodule": false,
|
||||
"sections": [
|
||||
{
|
||||
"fileName": "文件.txt",
|
||||
"name": "",
|
||||
"lines": [
|
||||
{
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 0,
|
||||
"type": 4,
|
||||
"content": "@@ -0,0 +1,2 @@",
|
||||
"sectionInfo": {
|
||||
"path": null,
|
||||
"lastLeftIdx": null,
|
||||
"lastRightIdx": null,
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 0,
|
||||
"leftHunkSize": null,
|
||||
"rightHunkSize": null
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 1,
|
||||
"type": 2,
|
||||
"content": "+用例图一致性更新",
|
||||
"sectionInfo": null
|
||||
},
|
||||
{
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 2,
|
||||
"type": 2,
|
||||
"content": "+工程文件直接上传会有文件缺失,现在压缩后上传",
|
||||
"sectionInfo": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## 获取pull request的commits列表
|
||||
获取pull request的commits列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/jasder/jasder_test/pulls/1/commits.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/jasder/jasder_test/pulls/1/commits.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/pulls/:id/commits.json`
|
||||
|
||||
### 请求参数:
|
||||
|参数名|必选|类型|说明|
|
||||
|-|-|-|-|
|
||||
|owner |是|string |用户登录名 |
|
||||
|repo |是|string |project's identifier |
|
||||
|id |是|int |pull request's id |
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|commits_count |int|commits总数量|
|
||||
|commits |array||
|
||||
|-- author |object|项目作者|
|
||||
|---- login |string|用户login|
|
||||
|---- name |string|用户姓名|
|
||||
|---- image_url |string|用户头像|
|
||||
|-- committer |object|commit提交用户|
|
||||
|---- login |string|用户login|
|
||||
|---- name |string|用户姓名|
|
||||
|---- image_url |string|用户头像|
|
||||
|-- timestamp |int|commit的unix时间戳|
|
||||
|-- time_from_now|string|commit’s 提交时间距当前时间的时间值|
|
||||
|-- message |string|commit说明信息|
|
||||
|-- sha |string|commit’s sha值|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"commits_count": 1,
|
||||
"commits": [
|
||||
{
|
||||
"author": {
|
||||
"id": 36480,
|
||||
"login": "jasder",
|
||||
"name": "段甲生",
|
||||
"image_url": "avatars/User/b"
|
||||
},
|
||||
"committer": {
|
||||
"id": 36480,
|
||||
"login": "jasder",
|
||||
"name": "段甲生",
|
||||
"image_url": "avatars/User/b"
|
||||
},
|
||||
"timestamp": 1604382982,
|
||||
"time_from_now": "3小时前",
|
||||
"message": "add some file\n* Add the tag list page to the release page\n* Apply suggestions from code review\n* Add the tags list view\n* Add the delete tag way on ui\n* Not delete tag and clear message when delete a release\n",
|
||||
"sha": "8f5faee0d3b3be1b8063e84da0c79dd75327b968"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Compare two commits
|
||||
Compare two commits
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/Jason/test-txt/compare/master...develop
|
||||
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/Jason/test-txt/compare/master...Jason/test-txt:develop
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/Jason/test-txt/compare/master...Jason/test-txt:develop')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/compare/{base}...{head}.json`
|
||||
|
||||
### 请求参数:
|
||||
|参数名|必选|类型|说明|
|
||||
|-|-|-|-|
|
||||
|owner |是|string |用户登录名 |
|
||||
|repo |是|string |project's identifier |
|
||||
|base |是|string |pull request's id |
|
||||
|head |是|string |pull request's id |
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|-|-|-|
|
||||
|commits_count |int|commits总数量|
|
||||
|commits |array||
|
||||
|-- author |object|项目作者|
|
||||
|---- login |string|用户login|
|
||||
|---- name |string|用户姓名|
|
||||
|---- image_url |string|用户头像|
|
||||
|-- committer |object|commit提交用户|
|
||||
|---- login |string|用户login|
|
||||
|---- name |string|用户姓名|
|
||||
|---- image_url |string|用户头像|
|
||||
|-- timestamp |int|commit的unix时间戳|
|
||||
|-- time_from_now|string|commit’s 提交时间距当前时间的时间值|
|
||||
|-- message |string|commit说明信息|
|
||||
|-- sha |string|commit’s sha值|
|
||||
|diff |object||
|
||||
|-- files_count |int|文件更改的总数量|
|
||||
|-- total_addition |int|添加代码总行数|
|
||||
|-- total_deletion |int|删除代码总行数|
|
||||
|-- files |Array||
|
||||
|-- sha |string|commit's sha |
|
||||
|-- name |string|当前文件名|
|
||||
|-- old_name |string| 修改之前的文件名称,与name相同的话,说明文件名未更改|
|
||||
|-- addition |int|文件添加的行数|
|
||||
|-- deletion |int|文件删除的行数|
|
||||
|-- type |int|文件类型, 1: 表示该文件只添加了内容,2: 表示该文件内容有修改, 3: 表示文件被删除或者改文件只删除了内容|
|
||||
|-- isCreated |boolean|当前文件是否为新增文件, true: 是, false: 否|
|
||||
|-- isDeleted |boolean|当前文件是否被删除, true: 是,false: 否|
|
||||
|-- isBin |boolean|当前文件是否为二进制文件,true: 是,false: 否|
|
||||
|-- isLFSFile |boolean|当前文件是否为LFS文件,true: 是,false: 否|
|
||||
|-- isRenamed |boolean|当前文件是否被重命名,true: 是,false: 否|
|
||||
|-- sections |array||
|
||||
|---- fileName |string|文件名称|
|
||||
|---- lines |array||
|
||||
|------ leftIdx |string|文件变动之前所在行数|
|
||||
|------ rightIdx |string|文件更改后所在行数|
|
||||
|------ type |string|文件变更类型,1: 内容未改动,2: 添加, 3: 删除, 4: diff统计信息|
|
||||
|------ content |string|文件变更的内容|
|
||||
|------ sectionInfo |object||
|
||||
|-------- path |string|文件相对仓库的路径|
|
||||
|-------- lastLeftIdx |int||
|
||||
|-------- lastRightIdx |int||
|
||||
|-------- leftHunkSize |int|文件变更之前的行数|
|
||||
|-------- rightHunkSize |int|文件变更之后的行数(及当前页面编辑器显示的总行数)|
|
||||
|-------- leftIdx |int|文件变更之前所在行数|
|
||||
|-------- rightIdx |int|文件变更之后所在行数|
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"commits_count": 1,
|
||||
"commits": [
|
||||
{
|
||||
"author": {
|
||||
"id": 36480,
|
||||
"login": "jasder",
|
||||
"name": "段甲生",
|
||||
"image_url": "avatars/User/b"
|
||||
},
|
||||
"committer": {
|
||||
"id": 36480,
|
||||
"login": "jasder",
|
||||
"name": "段甲生",
|
||||
"image_url": "avatars/User/b"
|
||||
},
|
||||
"timestamp": 1604382982,
|
||||
"time_from_now": "4小时前",
|
||||
"message": "add some file\n* Add the tag list page to the release page\n* Apply suggestions from code review\n* Add the tags list view\n* Add the delete tag way on ui\n* Not delete tag and clear message when delete a release\n",
|
||||
"sha": "8f5faee0d3b3be1b8063e84da0c79dd75327b968"
|
||||
}
|
||||
],
|
||||
"diff": {
|
||||
"files_count": 6,
|
||||
"total_addition": 447,
|
||||
"total_deletion": 0,
|
||||
"files": [
|
||||
{
|
||||
"name": "build.go",
|
||||
"old_name": "build.go",
|
||||
"index": 1,
|
||||
"addition": 33,
|
||||
"deletion": 0,
|
||||
"type": 1,
|
||||
"isCreated": true,
|
||||
"isDeleted": false,
|
||||
"isBin": false,
|
||||
"isLFSFile": false,
|
||||
"isRenamed": false,
|
||||
"isSubmodule": false,
|
||||
"sections": [
|
||||
{
|
||||
"fileName": "build.go",
|
||||
"name": "",
|
||||
"lines": [
|
||||
{
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 0,
|
||||
"type": 4,
|
||||
"content": "@@ -0,0 +1,33 @@",
|
||||
"sectionInfo": {
|
||||
"path": "build.go",
|
||||
"lastLeftIdx": 0,
|
||||
"lastRightIdx": 0,
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 1,
|
||||
"leftHunkSize": 0,
|
||||
"rightHunkSize": 33
|
||||
}
|
||||
},
|
||||
{
|
||||
"leftIdx": 0,
|
||||
"rightIdx": 1,
|
||||
"type": 2,
|
||||
"content": "+// Copyright 2020 The Gitea Authors. All rights reserved.",
|
||||
"sectionInfo": null
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## List pull requests
|
||||
获取合并请求列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/Jasder/gitlink/pulls.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/Jasder/gitlink/pulls.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/pulls.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|
||||
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "响应成功",
|
||||
"open_count": 4,
|
||||
"close_count": 51,
|
||||
"merged_issues_size": 123,
|
||||
"search_count": 4,
|
||||
"limit": null,
|
||||
"user_admin_or_member": true,
|
||||
"user_admin_or_developer": true,
|
||||
"project_name": "Gitlink",
|
||||
"project_author_name": "Gitlink",
|
||||
"issues": [
|
||||
{
|
||||
"pull_request_id": 1189,
|
||||
"pull_request_status": 0,
|
||||
"pull_request_head": "develop",
|
||||
"pull_request_base": "master",
|
||||
"pull_request_staus": "open",
|
||||
"is_original": false,
|
||||
"fork_project_id": null,
|
||||
"fork_project_identifier": null,
|
||||
"fork_project_user": null,
|
||||
"id": 51888,
|
||||
"name": "FIx release v3.2.0",
|
||||
"pr_time": "59分钟前",
|
||||
"assign_user_name": "victor",
|
||||
"assign_user_login": "moshenglv",
|
||||
"author_name": "段甲生",
|
||||
"author_login": "jasder",
|
||||
"avatar_url": "images/avatars/User/36480?t=1615520120",
|
||||
"priority": "正常",
|
||||
"version": null,
|
||||
"journals_count": 0,
|
||||
"issue_tags": null
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
|
@ -274,6 +274,124 @@ await octokit.request('GET /api/yystopf/ceshi/detail.json')
|
|||
}
|
||||
```
|
||||
|
||||
## 仓库标签列表
|
||||
仓库标签列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/yystopf/csfjkkj/tags.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/csfjkkj/tags.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/tags.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|page |否| 1 | integer | 页码 |
|
||||
|limit |否| 20| integer | 每页个数 |
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |标签id |
|
||||
|name |string|标签名称|
|
||||
|zipball_url |string|标签zip包下载地址|
|
||||
|tarball_url |string|标签tar包下载地址|
|
||||
|tagger |object|打标签的人|
|
||||
|time_ago |string|打标签的时间|
|
||||
|created_at_unix|string|打标签的时间戳|
|
||||
|message |string|标签信息|
|
||||
|commit |object|标签最后一个commit|
|
||||
|commit.sha |string|commit的id|
|
||||
|commit.message |string|commit的提交信息|
|
||||
|commit.time_ago|string|commit的提交时间|
|
||||
|commit.created_at_unix|string|commit的提交时间戳|
|
||||
|commit.committer|object|commit的提交者|
|
||||
|commit.author|object|commit的作者|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
[
|
||||
{
|
||||
"name": "v2.0.0",
|
||||
"id": "c7d0873ee41796d1a0e193063095ccf539a9bf31",
|
||||
"zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.zip",
|
||||
"tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v2.0.0.tar.gz",
|
||||
"tagger": {
|
||||
"id": 4,
|
||||
"login": "testforge1",
|
||||
"name": "testforge1",
|
||||
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
|
||||
},
|
||||
"time_ago": "1天前",
|
||||
"created_at_unix": 1632376903,
|
||||
"message": "jdfkls",
|
||||
"commit": {
|
||||
"sha": "08fe383f1e5ebe2e2a384a8ea3ee890a758c7cd7",
|
||||
"message": "add\n",
|
||||
"time_ago": "1天前",
|
||||
"created_at_unix": 1632376186,
|
||||
"committer": {
|
||||
"id": 4,
|
||||
"login": "testforge1",
|
||||
"name": "testforge1",
|
||||
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
|
||||
},
|
||||
"author": {
|
||||
"id": 4,
|
||||
"login": "testforge1",
|
||||
"name": "testforge1",
|
||||
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "v1.0.0",
|
||||
"id": "12168ad39c3ef201a445a2db181a3e43d50e40dd",
|
||||
"zipball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.zip",
|
||||
"tarball_url": "http://localhost:3000/api/yystopf/csfjkkj/archive/v1.0.0.tar.gz",
|
||||
"tagger": {
|
||||
"id": null,
|
||||
"login": "viletyy",
|
||||
"name": "viletyy",
|
||||
"image_url": "system/lets/letter_avatars/2/V/39_141_222/120.png"
|
||||
},
|
||||
"time_ago": "10天前",
|
||||
"created_at_unix": 1631588042,
|
||||
"message": "dfks",
|
||||
"commit": {
|
||||
"sha": "5291b5e45a377c1f7710cc6647259887ed7aaccf",
|
||||
"message": "ADD file via upload\n",
|
||||
"time_ago": "21天前",
|
||||
"created_at_unix": 1630648417,
|
||||
"committer": {
|
||||
"id": null,
|
||||
"login": "yystopf",
|
||||
"name": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
|
||||
},
|
||||
"author": {
|
||||
"id": null,
|
||||
"login": "yystopf",
|
||||
"name": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
## 编辑仓库信息
|
||||
编辑仓库信息
|
||||
|
||||
|
|
@ -867,3 +985,796 @@ await octokit.request('GET /api/jasder/jasder_test/sub_entries.json')
|
|||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取仓库README文件
|
||||
获取仓库README文件
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "ref=master" \
|
||||
-d "filepath=lib" \
|
||||
http://localhost:3000/api/yystopf/csfjkkj/readme.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/csfjkkj/readme.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/readme.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|ref |否| | string |分支名称、tag名称或是提交记录id,默认为默认分支 |
|
||||
|filepath |否| | string |子目录名称,默认为空 |
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type |string|文件类型, file:文件,dir:文件目录
|
||||
|encoding |string |编码 |
|
||||
|size |int|文件夹或文件大小 单位B
|
||||
|name |string|文件夹或文件名称|
|
||||
|path |string|文件夹或文件相对路径|
|
||||
|content |string|文件内容
|
||||
|sha |string|文件commitid
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "file",
|
||||
"encoding": "base64",
|
||||
"size": 24,
|
||||
"name": "README.md",
|
||||
"path": "lib/README.md",
|
||||
"content": "ZGZhc2RhZGpmIGRrZnNsCgpzZGZkZnMK",
|
||||
"sha": "860962cd21c60b1a9e07d723080c87c32c18d44a"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取仓库贡献者
|
||||
获取仓库贡献者
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
-d "ref=master" \
|
||||
-d "filepath=lib" \
|
||||
http://localhost:3000/api/yystopf/csfjkkj/contributors.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/csfjkkj/contributors.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/contributors.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|ref |否| | string |分支名称、tag名称或是提交记录id,默认为整个仓库 |
|
||||
|filepath |否| | string |子目录名称,默认为空 |
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|total_count |integer|贡献者数量|
|
||||
|contributions |integer|贡献数量|
|
||||
|login |string |用户登录名 |
|
||||
|type |string|用户类型 |
|
||||
|name |string|用户昵称|
|
||||
|image_url |string|用户头像|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"contributors": [
|
||||
{
|
||||
"contributions": 5,
|
||||
"login": "testforge2",
|
||||
"type": "User",
|
||||
"name": "testforge2",
|
||||
"image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png"
|
||||
},
|
||||
{
|
||||
"contributions": 79,
|
||||
"login": "yystopf",
|
||||
"type": "User",
|
||||
"name": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/Y/241_125_89/120.png"
|
||||
}
|
||||
],
|
||||
"total_count": 2
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
|
||||
## 获取仓库webhooks列表
|
||||
获取仓库webhooks列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/webhooks.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/webhooks.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |id |
|
||||
|url |string|地址|
|
||||
|http_method |string|请求方式|
|
||||
|is_active |bool |是否激活|
|
||||
|type |string|类型|
|
||||
|last_status |string|最后一次推送的状态|
|
||||
|create_time |string|创建时间|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 4,
|
||||
"webhooks": [
|
||||
{
|
||||
"id": 2,
|
||||
"url": "https://oapi.dingtalk.com/robot/send?access_token=7e1e19d0eddb6a5e33c5c2c4e66f4c88f9437184b9ed2c2653194c6374c7d513",
|
||||
"http_method": "",
|
||||
"is_active": true,
|
||||
"type": "dingtalk",
|
||||
"last_status": "succeed",
|
||||
"create_time": "2021-07-12 10:50:07"
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"url": "http://localhost:3000",
|
||||
"http_method": "GET",
|
||||
"is_active": true,
|
||||
"type": "gitea",
|
||||
"last_status": "succeed",
|
||||
"create_time": "2021-07-26 10:03:45"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"url": "http://localhost:10081",
|
||||
"http_method": "POST",
|
||||
"is_active": true,
|
||||
"type": "gitea",
|
||||
"last_status": "waiting",
|
||||
"create_time": "2021-07-26 16:56:53"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"url": "http://localhost:3001",
|
||||
"http_method": "POST",
|
||||
"is_active": true,
|
||||
"type": "gitea",
|
||||
"last_status": "fail",
|
||||
"create_time": "2021-07-26 16:58:23"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取仓库单个webhook
|
||||
获取仓库单个webhook
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/3/edit.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/webhooks/3/edit.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/webhooks/:id/edit.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|id |是||integer|webhook ID|
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |id |
|
||||
|url |string|地址|
|
||||
|content_type |string|POST Content Type|
|
||||
|http_method |string|请求方式|
|
||||
|secret| |string|密钥|
|
||||
|is_active |bool |是否激活|
|
||||
|type |string|类型|
|
||||
|last_status |string|最后一次推送的状态, waiting 等待,fail 失败,succeed 成功|
|
||||
|branch_filter |string|分支过滤|
|
||||
|events |string|触发条件|
|
||||
|create_time |string|创建时间|
|
||||
|
||||
|
||||
参数| 含义|
|
||||
--------- | ------- | ------- |
|
||||
|create|创建分支或标签|
|
||||
|delete|分支或标签删除|
|
||||
|fork|仓库被fork|
|
||||
|push|git仓库推送|
|
||||
|issue|易修已打开、已关闭、已重新打开或编辑|
|
||||
|issue_assign|易修被指派|
|
||||
|issue_label|易修标签被更新或删除|
|
||||
|issue_milestone|易修被收入里程碑|
|
||||
|issue_comment|易修评论|
|
||||
|pull_request|合并请求|
|
||||
|pull_request_assign|合并请求被指派|
|
||||
|pull_request_label|合并请求被贴上标签|
|
||||
|pull_request_milestone|合并请求被记录于里程碑中|
|
||||
|pull_request_comment|合并请求被评论|
|
||||
|pull_request_review_approved|合并请求被批准|
|
||||
|pull_request_review_rejected|合并请求被拒绝|
|
||||
|pull_request_review_comment|合并请求被提出审查意见|
|
||||
|pull_request_sync|合并请求被同步|
|
||||
|repository|创建或删除仓库|
|
||||
|release|版本发布|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 3,
|
||||
"http_method": "GET",
|
||||
"content_type": "form",
|
||||
"url": "http://localhost:3000",
|
||||
"secret": "123456",
|
||||
"last_status": "succeed",
|
||||
"is_active": true,
|
||||
"type": "gitea",
|
||||
"create_time": "2021-07-26 10:03:45",
|
||||
"branch_filter": "*",
|
||||
"events": [
|
||||
"create",
|
||||
"delete",
|
||||
"fork",
|
||||
"issues",
|
||||
"issue_assign",
|
||||
"issue_label",
|
||||
"issue_milestone",
|
||||
"issue_comment",
|
||||
"push",
|
||||
"pull_request",
|
||||
"pull_request_assign",
|
||||
"pull_request_label",
|
||||
"pull_request_milestone",
|
||||
"pull_request_comment",
|
||||
"pull_request_review",
|
||||
"pull_request_sync",
|
||||
"repository",
|
||||
"release"
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 添加仓库webhook
|
||||
添加仓库webhook
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/yystopf/ceshi/webhooks.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/:owner/:repo/webhooks.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| | string |用户登录名 |
|
||||
|repo |是| | string |项目标识identifier |
|
||||
|webhook.url |是| | string |目标url |
|
||||
|webhook.type |否| | string |类型|
|
||||
|webhook.http_method |是| | string | http方法, POST和GET |
|
||||
|webhook.content_type |是| | string | POST Content Type |
|
||||
|webhook.secret |否| | string |密钥文本|
|
||||
|webhook.active |是| | bool | 是否激活|
|
||||
|webhook.branch_filter|否| |string|分支过滤|
|
||||
|webhook.events |否| |array|触发事件|
|
||||
|
||||
触发事件字段说明
|
||||
|
||||
参数| 含义|
|
||||
--------- | ------- | ------- |
|
||||
|create|创建分支或标签|
|
||||
|delete|分支或标签删除|
|
||||
|fork|仓库被fork|
|
||||
|push|git仓库推送|
|
||||
|issue|易修已打开、已关闭、已重新打开或编辑|
|
||||
|issue_assign|易修被指派|
|
||||
|issue_label|易修标签被更新或删除|
|
||||
|issue_milestone|易修被收入里程碑|
|
||||
|issue_comment|易修评论|
|
||||
|pull_request|合并请求|
|
||||
|pull_request_assign|合并请求被指派|
|
||||
|pull_request_label|合并请求被贴上标签|
|
||||
|pull_request_milestone|合并请求被记录于里程碑中|
|
||||
|pull_request_comment|合并请求被评论|
|
||||
|pull_request_review_approved|合并请求被批准|
|
||||
|pull_request_review_rejected|合并请求被拒绝|
|
||||
|pull_request_review_comment|合并请求被提出审查意见|
|
||||
|pull_request_sync|合并请求被同步|
|
||||
|repository|创建或删除仓库|
|
||||
|release|版本发布|
|
||||
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"active": true,
|
||||
"content_type": "json",
|
||||
"http_method": "GET",
|
||||
"secret": "123456",
|
||||
"url": "http://localhost:10000",
|
||||
"branch_filter": "*",
|
||||
"events": ["push"]
|
||||
}
|
||||
```
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |id |
|
||||
|url |string|地址|
|
||||
|content_type |string|POST Content Type|
|
||||
|is_active |bool |是否激活|
|
||||
|type |string|类型|
|
||||
|events | array|触发事件 |
|
||||
|create_time |string|创建时间|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"id": 18,
|
||||
"type": "gitea",
|
||||
"content_type": "json",
|
||||
"url": "http://localhost:10000",
|
||||
"events": [
|
||||
"push"
|
||||
],
|
||||
"active": true,
|
||||
"create_time": "2021-07-26 18:53:43"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 更新仓库webhook
|
||||
更新仓库webhook
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X PATCH \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('PATCH /api/yystopf/ceshi/webhooks/7.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`PATCH /api/:owner/:repo/webhooks/:id.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| | string |用户登录名 |
|
||||
|repo |是| | string |项目标识identifier |
|
||||
|id |是| | string |webhook id |
|
||||
|webhook.url |是| | string |目标url |
|
||||
|webhook.type |否| | string |类型|
|
||||
|webhook.http_method |是| | string | http方法, POST和GET |
|
||||
|webhook.content_type |是| | string | POST Content Type |
|
||||
|webhook.secret |否| | string |密钥文本|
|
||||
|webhook.active |是| | bool | 是否激活|
|
||||
|webhook.branch_filter|否| |string|分支过滤|
|
||||
|webhook.events |否| |array|触发事件|
|
||||
|
||||
触发事件字段说明
|
||||
|
||||
参数| 含义|
|
||||
--------- | ------- | ------- |
|
||||
|create|创建分支或标签|
|
||||
|delete|分支或标签删除|
|
||||
|fork|仓库被fork|
|
||||
|push|git仓库推送|
|
||||
|issue|易修已打开、已关闭、已重新打开或编辑|
|
||||
|issue_assign|易修被指派|
|
||||
|issue_label|易修标签被更新或删除|
|
||||
|issue_milestone|易修被收入里程碑|
|
||||
|issue_comment|易修评论|
|
||||
|pull_request|合并请求|
|
||||
|pull_request_assign|合并请求被指派|
|
||||
|pull_request_label|合并请求被贴上标签|
|
||||
|pull_request_milestone|合并请求被记录于里程碑中|
|
||||
|pull_request_comment|合并请求被评论|
|
||||
|pull_request_review_approved|合并请求被批准|
|
||||
|pull_request_review_rejected|合并请求被拒绝|
|
||||
|pull_request_review_comment|合并请求被提出审查意见|
|
||||
|pull_request_sync|合并请求被同步|
|
||||
|repository|创建或删除仓库|
|
||||
|release|版本发布|
|
||||
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"active": true,
|
||||
"content_type": "json",
|
||||
"http_method": "GET",
|
||||
"secret": "123456",
|
||||
"url": "http://localhost:10000",
|
||||
"branch_filter": "*",
|
||||
"events": ["push"]
|
||||
}
|
||||
```
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
|
||||
## 删除仓库webhook
|
||||
删除仓库webhook
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X DELETE \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/7.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('DELETE /api/yystopf/ceshi/webhooks/7.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`DELETE /api/:owner/:repo/webhooks/:id.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| | string |用户登录名 |
|
||||
|repo |是| | string |项目标识identifier |
|
||||
|id |是| | string |webhook id |
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取仓库webhook的历史推送列表
|
||||
获取仓库webhook的历史推送列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/3/tasks.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/yystopf/ceshi/webhooks/3/tasks.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/:owner/:repo/webhooks/:id/tasks.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| |string |用户登录名 |
|
||||
|repo |是| |string |项目标识identifier |
|
||||
|id |是| |integer |webhook ID|
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|id |int |id |
|
||||
|uuid |string|推送uuid|
|
||||
|type |string|类型|
|
||||
|is_succeed |bool|是否推送成功|
|
||||
|is_delivered |bool|是否完成推送|
|
||||
|payload_content |json|请求主体内容|
|
||||
|request_content |json|请求内容,头部等等|
|
||||
|reponse_content |json|响应内容,状态,头部,主体等等|
|
||||
|delivered_time |string|推送时间|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 6,
|
||||
"tasks": [
|
||||
{
|
||||
"id": 20,
|
||||
"type": "gitea",
|
||||
"uuid": "99aa2c23-6884-4c44-9020-5469320aa408",
|
||||
"is_succeed": true,
|
||||
"is_delivered": true,
|
||||
"payload_content": {
|
||||
"secret": "123456",
|
||||
"ref": "refs/heads/master",
|
||||
"before": "feb48e31362787a7620b53d4df3c4effddbb6f0b",
|
||||
"after": "feb48e31362787a7620b53d4df3c4effddbb6f0b",
|
||||
"compare_url": "",
|
||||
"commits": [
|
||||
{
|
||||
"id": "feb48e31362787a7620b53d4df3c4effddbb6f0b",
|
||||
"message": "fix\n",
|
||||
"url": "http://localhost:10081/yystopf/ceshi/commit/feb48e31362787a7620b53d4df3c4effddbb6f0b",
|
||||
"author": {
|
||||
"name": "viletyy",
|
||||
"email": "yystopf@163.com",
|
||||
"username": "root"
|
||||
},
|
||||
"committer": {
|
||||
"name": "viletyy",
|
||||
"email": "yystopf@163.com",
|
||||
"username": "root"
|
||||
},
|
||||
"verification": {
|
||||
"verified": false,
|
||||
"reason": "gpg.error.not_signed_commit",
|
||||
"signature": "",
|
||||
"signer": null,
|
||||
"payload": ""
|
||||
},
|
||||
"timestamp": "2021-07-26T13:52:13+08:00",
|
||||
"added": null,
|
||||
"removed": null,
|
||||
"modified": null
|
||||
}
|
||||
],
|
||||
"head_commit": null,
|
||||
"repository": {
|
||||
"id": 2,
|
||||
"owner": {
|
||||
"id": 3,
|
||||
"login": "yystopf",
|
||||
"full_name": "",
|
||||
"email": "yystopf@forge.com",
|
||||
"avatar_url": "http://localhost:10081/user/avatar/yystopf/-1",
|
||||
"language": "zh-CN",
|
||||
"is_admin": true,
|
||||
"last_login": "2021-07-21T18:38:21+08:00",
|
||||
"created": "2021-06-03T14:50:25+08:00",
|
||||
"username": "yystopf"
|
||||
},
|
||||
"name": "ceshi",
|
||||
"full_name": "yystopf/ceshi",
|
||||
"description": "",
|
||||
"empty": false,
|
||||
"private": false,
|
||||
"fork": false,
|
||||
"template": false,
|
||||
"parent": null,
|
||||
"mirror": false,
|
||||
"size": 3846,
|
||||
"html_url": "http://localhost:10081/yystopf/ceshi",
|
||||
"ssh_url": "virus@localhost:10081:yystopf/ceshi.git",
|
||||
"clone_url": "http://localhost:10081/yystopf/ceshi.git",
|
||||
"original_url": "",
|
||||
"website": "",
|
||||
"stars_count": 0,
|
||||
"forks_count": 1,
|
||||
"watchers_count": 1,
|
||||
"open_issues_count": 0,
|
||||
"open_pr_counter": 0,
|
||||
"release_counter": 0,
|
||||
"default_branch": "master",
|
||||
"archived": false,
|
||||
"created_at": "2021-06-03T15:15:30+08:00",
|
||||
"updated_at": "2021-07-26T13:52:16+08:00",
|
||||
"permissions": {
|
||||
"admin": false,
|
||||
"push": false,
|
||||
"pull": false
|
||||
},
|
||||
"has_issues": true,
|
||||
"internal_tracker": {
|
||||
"enable_time_tracker": true,
|
||||
"allow_only_contributors_to_track_time": true,
|
||||
"enable_issue_dependencies": true
|
||||
},
|
||||
"has_wiki": true,
|
||||
"has_pull_requests": true,
|
||||
"ignore_whitespace_conflicts": false,
|
||||
"allow_merge_commits": true,
|
||||
"allow_rebase": true,
|
||||
"allow_rebase_explicit": true,
|
||||
"allow_squash_merge": true,
|
||||
"avatar_url": "",
|
||||
"internal": false
|
||||
},
|
||||
"pusher": {
|
||||
"id": 0,
|
||||
"login": "yystopf",
|
||||
"full_name": "",
|
||||
"email": "yystopf@forge.com",
|
||||
"avatar_url": "http://localhost:10081/user/avatar/yystopf/-1",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2021-06-03T14:50:25+08:00",
|
||||
"username": "yystopf"
|
||||
},
|
||||
"sender": {
|
||||
"id": 0,
|
||||
"login": "yystopf",
|
||||
"full_name": "",
|
||||
"email": "yystopf@forge.com",
|
||||
"avatar_url": "http://localhost:10081/user/avatar/yystopf/-1",
|
||||
"language": "",
|
||||
"is_admin": false,
|
||||
"last_login": "0001-01-01T00:00:00Z",
|
||||
"created": "2021-06-03T14:50:25+08:00",
|
||||
"username": "yystopf"
|
||||
}
|
||||
},
|
||||
"request_content": {
|
||||
"headers": {
|
||||
"X-GitHub-Delivery": "99aa2c23-6884-4c44-9020-5469320aa408",
|
||||
"X-GitHub-Event": "push",
|
||||
"X-Gitea-Delivery": "99aa2c23-6884-4c44-9020-5469320aa408",
|
||||
"X-Gitea-Event": "push",
|
||||
"X-Gitea-Signature": "34a01edcd952ff6410ff6ebc946471161bde74aff86171f21621d2c2c4130f66",
|
||||
"X-Gogs-Delivery": "99aa2c23-6884-4c44-9020-5469320aa408",
|
||||
"X-Gogs-Event": "push",
|
||||
"X-Gogs-Signature": "34a01edcd952ff6410ff6ebc946471161bde74aff86171f21621d2c2c4130f66"
|
||||
}
|
||||
},
|
||||
"response_content": {
|
||||
"status": 200,
|
||||
"headers": {
|
||||
"Cache-Control": "no-store, must-revalidate, private, max-age=0",
|
||||
"Content-Length": "2556",
|
||||
"Content-Type": "text/html; charset=utf-8",
|
||||
"Referrer-Policy": "strict-origin-when-cross-origin",
|
||||
"Set-Cookie": "__profilin=p%3Dt; path=/; HttpOnly",
|
||||
"Vary": "Origin",
|
||||
"X-Content-Type-Options": "nosniff",
|
||||
"X-Download-Options": "noopen",
|
||||
"X-Frame-Options": "SAMEORIGIN",
|
||||
"X-Miniprofiler-Ids": "9ynvpncz5xm0rpgorb5y,hgggd9mv6lr4a9drcrlr,j7zqlx2vy5aji2vtgoba,f1ktsmh3jxvq0z2hf612,mih3dvgvlqhi3zy8lf2x,5k1qbkvbnru8mye9cest,tj6ern8w6awqf2zsimbr,9isaehvubivd52wo5p9v,1rzfhtq1nhuwbgy9p76g,z0xzidzyywna0y7a69m0,hzoklky92ycjqt42gi0s,y0ai7y0t28mcn8x0py2x,322il7nadinp51mw2r5m,m6dukftfsh6tjcxzp1gq,667wlqbytfwbrirnmma1,jcehj3dl8lkw8gk510cr",
|
||||
"X-Miniprofiler-Original-Cache-Control": "max-age=0, private, must-revalidate",
|
||||
"X-Permitted-Cross-Domain-Policies": "none",
|
||||
"X-Request-Id": "08bff080-bbb5-4183-b845-81de3d47120a",
|
||||
"X-Runtime": "0.394766",
|
||||
"X-Xss-Protection": "1; mode=block"
|
||||
},
|
||||
"body": "<!doctype html><html lang=\"zh-CN\" class=\"notranslate translated-ltr\" translate=\"no\"><head><meta charset=\"utf-8\"><meta name=\"”Keywords”\" content=\"”trustie,trustieforge,forge,确实让创建更美好,协同开发平台″\"><meta name=\"”Keywords”\" content=\"”TrustieOpenSourceProject″\"><meta name=\"”Keywords”\" content=\"”issue,bug,tracker,软件工程,课程实践″\"><meta name=\"”Description”\" content=\"”持续构建协同、共享、可信的软件创建生态开源创作与软件生产相结合,支持大规模群体开展软件协同创新活动”\"><meta name=\"theme-color\" content=\"#000000\"><link rel=\"manifest\" href=\"/react/build//manifest.json\"><link rel=\"stylesheet\" href=\"/react/build/css/iconfont.css\"><link rel=\"stylesheet\" href=\"/react/build/css/edu-purge.css\"><link rel=\"stylesheet\" href=\"/react/build/css/editormd.min.css\"><link rel=\"stylesheet\" href=\"/react/build/css/merge.css\"><link href=\"/react/build/static/css/main.07f7e90c.chunk.css\" rel=\"stylesheet\"></head><body><div id=\"md_div\" style=\"display:none\"></div><div id=\"root\" class=\"page -layout-v -fit widthunit\"></div><div id=\"picture_display\" style=\"display:none\"></div><script src=\"/react/build/js/jquery-1.8.3.min.js\"></script><script src=\"/react/build/js/js_min_all.js\"></script><script src=\"/react/build/js/codemirror/codemirror.js\"></script><script src=\"/react/build/js/editormd/editormd.min.js\"></script><script src=\"/react/build/js/codemirror/merge/merge.js\"></script><script src=\"/react/build/./static/js/runtime~main.3d644966.js\"></script><script src=\"/react/build/./static/js/main.e46872e3.chunk.js\"></script><script async type=\"text/javascript\" id=\"mini-profiler\" src=\"/mini-profiler-resources/includes.js?v=67dd1c2571ced7fc74ae7f1813e47bdf\" data-version=\"67dd1c2571ced7fc74ae7f1813e47bdf\" data-path=\"/mini-profiler-resources/\" data-current-id=\"9ynvpncz5xm0rpgorb5y\" data-ids=\"9ynvpncz5xm0rpgorb5y,hgggd9mv6lr4a9drcrlr,j7zqlx2vy5aji2vtgoba,f1ktsmh3jxvq0z2hf612,mih3dvgvlqhi3zy8lf2x,5k1qbkvbnru8mye9cest,tj6ern8w6awqf2zsimbr,9isaehvubivd52wo5p9v,1rzfhtq1nhuwbgy9p76g,z0xzidzyywna0y7a69m0,hzoklky92ycjqt42gi0s,y0ai7y0t28mcn8x0py2x,322il7nadinp51mw2r5m,m6dukftfsh6tjcxzp1gq,667wlqbytfwbrirnmma1,jcehj3dl8lkw8gk510cr\" data-horizontal-position=\"left\" data-vertical-position=\"top\" data-trivial=\"false\" data-children=\"false\" data-max-traces=\"20\" data-controls=\"false\" data-total-sql-count=\"false\" data-authorized=\"true\" data-toggle-shortcut=\"alt+p\" data-start-hidden=\"false\" data-collapse-results=\"true\" data-html-container=\"body\"></script>\n</body></html>"
|
||||
},
|
||||
"delivered_time": "2021-07-28 11:47:29"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 仓库webhook测试推送
|
||||
仓库webhook测试推送
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST \
|
||||
http://localhost:3000/api/yystopf/ceshi/webhooks/3/test.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/yystopf/ceshi/webhooks/3/test.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/:owner/:repo/webhooks/:id/test.json`
|
||||
|
||||
### 请求参数:
|
||||
参数 | 必选 | 默认 | 类型 | 字段说明
|
||||
--------- | ------- | ------- | -------- | ----------
|
||||
|owner |是| | string |用户登录名 |
|
||||
|repo |是| | string |项目标识identifier |
|
||||
|id |是| | integer|webhook ID|
|
||||
|
||||
|
||||
|
||||
|
||||
### 返回字段说明:
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
|
@ -1 +0,0 @@
|
|||
# Teams
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<!--
|
||||
* @Date: 2021-03-01 10:35:21
|
||||
* @LastEditors: viletyy
|
||||
* @LastEditTime: 2021-06-11 16:28:51
|
||||
* @LastEditTime: 2021-09-15 18:00:10
|
||||
* @FilePath: /forgeplus/app/docs/slate/source/includes/_users.md
|
||||
-->
|
||||
# Users
|
||||
|
|
@ -47,6 +47,275 @@ await octokit.request('GET /api/users/me.json')
|
|||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 用户消息列表
|
||||
获取用户消息列表
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/users/:login/messages.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/users/:login/messages.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET api/users/yystopf/messages.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type | string | 消息类型,不传为所有消息,notification为系统消息,atme为@我消息|
|
||||
|status | integer | 是否已读,不传为所有消息,1为未读,2为已读 |
|
||||
|limit | integer | 每页个数 |
|
||||
|page | integer | 页码 |
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|total_count | integer | 消息总数 |
|
||||
|type | string | 消息类型 |
|
||||
|unread_notification | integer | 未读系统通知数量 |
|
||||
|unread_atme | integer | 未读@我数量 |
|
||||
|messages.id | integer | 消息id |
|
||||
|messages.status | integer | 消息是否已读,1为未读,2为已读 |
|
||||
|messages.content | string | 消息内容 |
|
||||
|messages.notification_url | string | 消息跳转地址 |
|
||||
|messages.source | string | 消息来源 |
|
||||
|messages.timeago | string | 消息时间 |
|
||||
|messages.type | string | 消息类型,notification为系统消息,atme为@我消息|
|
||||
|sender | object | 消息发送者 |
|
||||
|
||||
#### 消息来源source字段说明
|
||||
类型|说明
|
||||
--------- | -----------
|
||||
|IssueAssigned | 有新指派给我的易修 |
|
||||
|IssueAssignerExpire | 我负责的易修截止日期到达最后一天 |
|
||||
|IssueAtme | 在易修中@我 |
|
||||
|IssueChanged | 我创建或负责的易修状态变更 |
|
||||
|IssueCreatorExpire | 我创建的易修截止日期到达最后一天 |
|
||||
|IssueDeleted | 我创建或负责的易修删除 |
|
||||
|IssueJournal | 我创建或负责的易修有新的评论 |
|
||||
|LoginIpTip | 登录异常提示 |
|
||||
|OrganizationJoined | 账号被拉入组织 |
|
||||
|OrganizationLeft | 账号被移出组织 |
|
||||
|OrganizationRole | 账号组织权限变更 |
|
||||
|ProjectDeleted | 我关注的仓库被删除 |
|
||||
|ProjectFollowed | 我管理的仓库被关注 |
|
||||
|ProjectForked | 我管理的仓库被复刻 |
|
||||
|ProjectIssue | 我管理/关注的仓库有新的易修 |
|
||||
|ProjectJoined | 账号被拉入项目 |
|
||||
|ProjectLeft | 账号被移出项目 |
|
||||
|ProjectMemberJoined | 我管理的仓库有成员加入 |
|
||||
|ProjectMemberLeft | 我管理的仓库有成员移出 |
|
||||
|ProjectMilestone | 我管理的仓库有新的里程碑 |
|
||||
|ProjectPraised | 我管理的仓库被点赞 |
|
||||
|ProjectPullRequest | 我管理/关注的仓库有新的合并请求 |
|
||||
|ProjectRole | 账号仓库权限变更 |
|
||||
|ProjectSettingChanged | 我管理的仓库项目设置被更改 |
|
||||
|ProjectTransfer | 我关注的仓库被转移 |
|
||||
|ProjectVersion | 我关注的仓库有新的发行版 |
|
||||
|PullRequestAssigned | 有新指派给我的合并请求 |
|
||||
|PullReuqestAtme | 在合并请求中@我 |
|
||||
|PullRequestChanged | 我创建或负责的合并请求状态变更 |
|
||||
|PullRequestClosed | 我创建或负责的合并请求被关闭 |
|
||||
|PullRequestJournal | 我创建或负责的合并请求有新的评论 |
|
||||
|PullRequestMerged | 我创建或负责的合并请求被合并 |
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"total_count": 5,
|
||||
"type": "",
|
||||
"unread_notification": 3,
|
||||
"unread_atme": 2,
|
||||
"messages": [
|
||||
{
|
||||
"id": 1,
|
||||
"status": 1,
|
||||
"content": "Atme Message Content 1",
|
||||
"notification_url": "http://www.baidu.com",
|
||||
"source": "PullRequestAtme",
|
||||
"time_ago": "1天前",
|
||||
"type": "atme",
|
||||
"sender": {
|
||||
"id": 5,
|
||||
"type": "User",
|
||||
"name": "testforge2",
|
||||
"login": "testforge2",
|
||||
"image_url": "system/lets/letter_avatars/2/T/236_177_85/120.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"status": 0,
|
||||
"content": "Atme Message Content 2",
|
||||
"notification_url": "http://www.baidu.com",
|
||||
"source": "IssueAtme",
|
||||
"time_ago": "1天前",
|
||||
"type": "atme",
|
||||
"sender": {
|
||||
"id": 4,
|
||||
"type": "User",
|
||||
"name": "testforge1",
|
||||
"login": "testforge1",
|
||||
"image_url": "system/lets/letter_avatars/2/T/19_237_174/120.png"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"status": 1,
|
||||
"content": "Notification Message Content 1",
|
||||
"notification_url": "http://www.baidu.com",
|
||||
"source": "IssueDelete",
|
||||
"time_ago": "1天前",
|
||||
"type": "notification"
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"status": 0,
|
||||
"content": "Notification Message Content 2",
|
||||
"notification_url": "http://www.baidu.com",
|
||||
"source": "IssueChanged",
|
||||
"time_ago": "1天前",
|
||||
"type": "notification"
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"status": 0,
|
||||
"content": "Notification Message Content 3",
|
||||
"notification_url": "http://www.baidu.com",
|
||||
"source": "ProjectJoined",
|
||||
"time_ago": "1天前",
|
||||
"type": "notification"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 发送消息
|
||||
发送消息, 目前只支持atme
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/users/:login/messages.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/users/:login/messages.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/users/yystopf/messages.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type | string | 消息类型 |
|
||||
|receivers_login | array | 需要发送消息的用户名数组|
|
||||
|atmeable_type | string | atme消息对象,是从哪里@我的,比如评论:Journal、易修:Issue、合并请求:PullRequest |
|
||||
|atmeable_id | integer | atme消息对象id |
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "atme",
|
||||
"receivers_login": ["yystopf", "testforge1"],
|
||||
"atmeable_type": "Journal",
|
||||
"atmeable_id": 67
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 阅读消息
|
||||
阅读消息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/users/:login/messages/read.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/users/:login/messages/read.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST api/users/yystopf/messages/read.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type | string | 消息类型,不传为所有消息,notification为系统消息,atme为@我消息|
|
||||
|ids | array | 消息id数组,包含-1则把所有未读消息标记为已读|
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 删除消息
|
||||
删除消息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X DELETE http://localhost:3000/api/users/:login/messages.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('DELETE /api/users/:login/messages.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`DELETE api/users/yystopf/messages.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type | string | 消息类型,atme为@我消息|
|
||||
|ids | array | 消息id数组,包含-1则把所有消息删除|
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "success"
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
|
||||
## 更改用户信息
|
||||
更改用户信息
|
||||
|
||||
|
|
@ -103,6 +372,290 @@ await octokit.request('PATCH/PUT /api/users/:login.json')
|
|||
"message": "success"
|
||||
}
|
||||
```
|
||||
|
||||
## 获取平台消息设置配置信息
|
||||
获取平台消息设置配置信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/template_message_settings.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/template_message_settings.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/template_message_settings.json`
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|type |string |消息配置类型 |
|
||||
|type_name |string |消息配置类型含义|
|
||||
|total_settings_count |int |配置条数|
|
||||
|settings.name |string |配置名称|
|
||||
|settings.key |string |配置标识|
|
||||
|settings.notification_disabled |boolean |站内信设置是否禁用|
|
||||
|settings.email_disabled |boolean |邮件设置是否禁用|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "响应成功",
|
||||
"setting_types": [
|
||||
{
|
||||
"type": "TemplateMessageSetting::Normal",
|
||||
"type_name": "",
|
||||
"total_settings_count": 3,
|
||||
"settings": [
|
||||
{
|
||||
"name": "被拉入或移出组织",
|
||||
"key": "Organization",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
},
|
||||
{
|
||||
"name": "被拉入或移出项目",
|
||||
"key": "Project",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
},
|
||||
{
|
||||
"name": "有权限变更",
|
||||
"key": "Permission",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "TemplateMessageSetting::CreateOrAssign",
|
||||
"type_name": "我创建的或负责的",
|
||||
"total_settings_count": 4,
|
||||
"settings": [
|
||||
{
|
||||
"name": "易修被指派",
|
||||
"key": "IssueAssigned",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
},
|
||||
{
|
||||
"name": "合并请求被指派",
|
||||
"key": "PullRequestAssigned",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "TemplateMessageSetting::ManageProject",
|
||||
"type_name": "我管理的仓库",
|
||||
"total_settings_count": 4,
|
||||
"settings": [
|
||||
{
|
||||
"name": "有新的易修",
|
||||
"key": "Issue",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
},
|
||||
{
|
||||
"name": "有新的合并请求",
|
||||
"key": "PullRequest",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
},
|
||||
{
|
||||
"name": "有成员变动",
|
||||
"key": "Member",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
},
|
||||
{
|
||||
"name": "设置更改",
|
||||
"key": "SettingChanged",
|
||||
"notification_disabled": true,
|
||||
"email_disabled": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取用户消息设置配置信息
|
||||
获取用户消息设置配置信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X GET http://localhost:3000/api/users/yystopf/template_message_settings.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('GET /api/uses/yystopf/template_message_settings.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`GET /api/users/:user_id/template_message_settings.json`
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|notification_body |string |站内信配置 |
|
||||
|email_body |string |邮件配置|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "响应成功",
|
||||
"user": {
|
||||
"id": 2,
|
||||
"type": "User",
|
||||
"name": "heh",
|
||||
"login": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
|
||||
},
|
||||
"notification_body": {
|
||||
"CreateOrAssign::IssueAssigned": true,
|
||||
"CreateOrAssign::PullRequestAssigned": true,
|
||||
"ManageProject::Issue": true,
|
||||
"ManageProject::PullRequest": true,
|
||||
"ManageProject::Member": true,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"Normal::Organization": true,
|
||||
"Normal::Project": true,
|
||||
"Normal::Permission": true
|
||||
},
|
||||
"email_body": {
|
||||
"CreateOrAssign::IssueAssigned": false,
|
||||
"CreateOrAssign::PullRequestAssigned": false,
|
||||
"ManageProject::Issue": false,
|
||||
"ManageProject::PullRequest": false,
|
||||
"ManageProject::Member": false,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"Normal::Organization": false,
|
||||
"Normal::Project": true,
|
||||
"Normal::Permission": false
|
||||
}
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 重新设置用户消息设置配置信息
|
||||
重新设置用户消息设置配置信息
|
||||
|
||||
> 示例:
|
||||
|
||||
```shell
|
||||
curl -X POST http://localhost:3000/api/users/yystopf/template_message_settings/update_setting.json
|
||||
```
|
||||
|
||||
```javascript
|
||||
await octokit.request('POST /api/uses/yystopf/template_message_settings/update_setting.json')
|
||||
```
|
||||
|
||||
### HTTP 请求
|
||||
`POST /api/users/:user_id/template_message_settings/update_setting.json`
|
||||
|
||||
### 请求字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|notification_body |string |站内信配置 |
|
||||
|email_body |string |邮件配置|
|
||||
|
||||
|
||||
> 请求的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"setting": {
|
||||
"notification_body": {
|
||||
"CreateOrAssign::IssueAssigned": true,
|
||||
"CreateOrAssign::PullRequestAssigned": true,
|
||||
"ManageProject::Issue": true,
|
||||
"ManageProject::PullRequest": true,
|
||||
"ManageProject::Member": true,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"Normal::Organization": true,
|
||||
"Normal::Project": true,
|
||||
"Normal::Permission": true
|
||||
},
|
||||
"email_body": {
|
||||
"CreateOrAssign::IssueAssigned": false,
|
||||
"CreateOrAssign::PullRequestAssigned": false,
|
||||
"ManageProject::Issue": false,
|
||||
"ManageProject::PullRequest": false,
|
||||
"ManageProject::Member": false,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"Normal::Organization": false,
|
||||
"Normal::Project": "t",
|
||||
"Normal::Permission": false
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 返回字段说明:
|
||||
参数 | 类型 | 字段说明
|
||||
--------- | ----------- | -----------
|
||||
|notification_body |string |站内信配置 |
|
||||
|email_body |string |邮件配置|
|
||||
|
||||
|
||||
> 返回的JSON示例:
|
||||
|
||||
```json
|
||||
{
|
||||
"status": 0,
|
||||
"message": "响应成功",
|
||||
"user": {
|
||||
"id": 2,
|
||||
"type": "User",
|
||||
"name": "heh",
|
||||
"login": "yystopf",
|
||||
"image_url": "system/lets/letter_avatars/2/H/188_239_142/120.png"
|
||||
},
|
||||
"notification_body": {
|
||||
"CreateOrAssign::IssueAssigned": true,
|
||||
"CreateOrAssign::PullRequestAssigned": true,
|
||||
"ManageProject::Issue": true,
|
||||
"ManageProject::PullRequest": true,
|
||||
"ManageProject::Member": true,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"Normal::Organization": true,
|
||||
"Normal::Project": true,
|
||||
"Normal::Permission": true
|
||||
},
|
||||
"email_body": {
|
||||
"CreateOrAssign::IssueAssigned": false,
|
||||
"CreateOrAssign::PullRequestAssigned": false,
|
||||
"ManageProject::Issue": false,
|
||||
"ManageProject::PullRequest": false,
|
||||
"ManageProject::Member": false,
|
||||
"ManageProject::SettingChanged": true,
|
||||
"Normal::Organization": false,
|
||||
"Normal::Project": true,
|
||||
"Normal::Permission": false
|
||||
}
|
||||
}
|
||||
```
|
||||
<aside class="success">
|
||||
Success Data.
|
||||
</aside>
|
||||
|
||||
## 获取用户星标项目
|
||||
获取用户星标项目
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue