Merge branch 'liyuchun_62870' into zenops_41

This commit is contained in:
sunguangming
2022-08-02 14:14:20 +08:00
2 changed files with 14 additions and 2 deletions
+13 -2
View File
@@ -205,8 +205,19 @@ class gogsModel extends model
$url = sprintf($apiRoot, "/user");
$httpData = commonModel::httpWithHeader($url);
$user = json_decode($httpData['body']);
if(empty($user)) return false;
if(isset($user->message) or isset($user->error)) return null;
if(empty($httpData['header'])) return false;
if(empty($user)) return null;
/* Check whether the token belongs to the administrator by edit user. */
$editUserUrl = sprintf($apiRoot, "/admin/users/" . $user->username);
$data = new stdclass();
$data->login_name = $user->login;
$data->email = $user->email;
$result = commonModel::http($editUserUrl, $data, array(), array(), 'data', 'PATCH');
$user = json_decode($result);
if(empty($user)) return null;
return true;
}
+1
View File
@@ -135,6 +135,7 @@ $lang->repo->encodingList['utf_8'] = 'UTF-8';
$lang->repo->encodingList['gbk'] = 'GBK';
$lang->repo->scmList['Gitlab'] = 'GitLab';
$lang->repo->scmList['Gogs'] = 'Gogs';
$lang->repo->scmList['Gitea'] = 'Gitea';
$lang->repo->scmList['Git'] = '本地 Git';
$lang->repo->scmList['Subversion'] = 'Subversion';