Merge branch 'standalone_develop' into pre_trustie_server

This commit is contained in:
yystopf 2026-08-05 12:09:35 +08:00
commit 92a7aec5ba
4 changed files with 154 additions and 67 deletions

View File

@ -1,4 +1,4 @@
class Oauth2Controller < ActionController::Base
class Oauth2Controller < ApplicationController
layout 'doorkeeper/application'
include LoginHelper
@ -9,6 +9,12 @@ class Oauth2Controller < ActionController::Base
end
def create
if User.current.logged?
to_url = params[:call_url] + "&auth=" + User.current.login
to_url = params[:call_url] + "&auth=" + User.current.login + "&state=" + params[:state] if params[:state].present?
redirect_to to_url
return
end
if params[:login].blank?
@error = {msg: '邮箱地址或用户名不能为空', id: 'login'}
elsif params[:password].blank?

View File

@ -1,41 +1,43 @@
json.file_nums diff['NumFiles']
json.total_addition diff['TotalAddition']
json.total_deletion diff['TotalDeletion']
json.files diff['Files'].each do |file|
json.name file['Name']
json.oldname file['OldName']
json.addition file['Addition']
json.deletion file['Deletion']
json.type file['Type']
json.is_created file['IsCreated']
json.is_deleted file['IsDeleted']
json.is_bin file['IsBin']
json.is_lfs_file file['IsLFSFile']
json.is_renamed file['IsRenamed']
json.is_ambiguous file['IsAmbiguous']
json.is_submodule file['IsSubmodule']
json.diff file['Diff']
json.sections file['Sections'] do |section|
json.file_name section['FileName']
json.name section['Name']
json.lines section['Lines'] do |line|
json.left_index line['LeftIdx']
json.right_index line['RightIdx']
json.match line['Match']
json.type line['Type']
json.content line['Content']
unless line['SectionInfo'].blank?
json.section_path line['SectionInfo']['Path']
json.section_last_left_index line['SectionInfo']['LastLeftIdx']
json.section_last_right_index line['SectionInfo']['LastRightIdx']
json.section_left_index line['SectionInfo']['LeftIdx']
json.section_right_index line['SectionInfo']['RightIdx']
json.section_left_hunk_size line['SectionInfo']['LeftHunkSize']
json.section_right_hunk_size line['SectionInfo']['RightHunkSize']
if diff.present?
json.file_nums diff['NumFiles']
json.total_addition diff['TotalAddition']
json.total_deletion diff['TotalDeletion']
json.files diff['Files'].each do |file|
json.name file['Name']
json.oldname file['OldName']
json.addition file['Addition']
json.deletion file['Deletion']
json.type file['Type']
json.is_created file['IsCreated']
json.is_deleted file['IsDeleted']
json.is_bin file['IsBin']
json.is_lfs_file file['IsLFSFile']
json.is_renamed file['IsRenamed']
json.is_ambiguous file['IsAmbiguous']
json.is_submodule file['IsSubmodule']
json.diff file['Diff']
json.sections file['Sections'] do |section|
json.file_name section['FileName']
json.name section['Name']
json.lines section['Lines'] do |line|
json.left_index line['LeftIdx']
json.right_index line['RightIdx']
json.match line['Match']
json.type line['Type']
json.content line['Content']
unless line['SectionInfo'].blank?
json.section_path line['SectionInfo']['Path']
json.section_last_left_index line['SectionInfo']['LastLeftIdx']
json.section_last_right_index line['SectionInfo']['LastRightIdx']
json.section_left_index line['SectionInfo']['LeftIdx']
json.section_right_index line['SectionInfo']['RightIdx']
json.section_left_hunk_size line['SectionInfo']['LeftHunkSize']
json.section_right_hunk_size line['SectionInfo']['RightHunkSize']
end
end
end
json.is_incomplete file['IsIncomplete']
json.is_incomplete_line_too_long file['IsIncompleteLineTooLong']
json.is_protected file['IsProtected']
end
json.is_incomplete file['IsIncomplete']
json.is_incomplete_line_too_long file['IsIncompleteLineTooLong']
json.is_protected file['IsProtected']
end

View File

@ -1,26 +1,101 @@
<style>
.ui.checkbox {
margin: 0;
padding: 0;
}
.ui.checkbox {
position: relative;
display: inline-block;
min-height: 17px;
font-size: 1rem;
line-height: 15px;
min-width: 17px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
outline: none;
vertical-align: middle;
}
.ui.checkbox input {
position: absolute;
top: 0px;
left: 0px;
opacity: 0 !important;
outline: none;
z-index: -1;
}
input[type="checkbox"], input[type="radio"] {
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
<main role="main">
<p class="auth-desc">
申请使用<strong class="app-name"> GitLink </strong>账号登录
<strong class="app-name"><%= @app&.name %></strong>
</p>
input {
line-height: normal;
}
</style>
<% if User.current.logged? %>
<main role="main">
<p class="auth-desc">
<strong class="app-name"><%= @app&.name %></strong>客户端<br/>
此第三方应用请求获得以下权限:
<div class="actions">
<div class="w">
<%= form_tag oauth2_path, method: :post, authenticity_token: true, remote: true, class: 'login-form' do %>
<%= hidden_field_tag :client_id, @app.uid %>
<%= hidden_field_tag :call_url, @call_url %>
<%= hidden_field_tag :state, params[:state] %>
<p id="account_error" class='error'></p>
<%= text_field_tag :login, '', placeholder: '请输入邮箱地址/用户名' %>
<p id="login_error" class='error'></p>
<%= password_field_tag :password, '', placeholder: '请输入密码'%>
<p id="password_error" class='error'></p>
<%= submit_tag '授权登录', class: "btn btn-login btn-lg btn-block mt-20" %>
<% end %>
<div class="reg">
<%= link_to "注 册", '/register', class: 'reg-link' %>
</p>
<div class="choose-checkbox-authorization">
<ul class="text-info">
<li>
<div class="checkbox checked ui">
<input type="checkbox" name="scopes[]" id="user_info" value="user_info" disabled="disabled" checked="checked">
<label for="______________">访问你的个人信息、最新动态等</label>
</div>
</li>
<li>
<div class="checkbox choose-single-checkbox ui checked">
<input type="checkbox" name="scopes[]" id="emails" value="emails" checked="checked" tabindex="0" class="hidden">
<label for="__________">查看你的个人邮箱信息</label>
</div>
</li>
</ul>
</div>
<div class="actions">
<div class="w">
<%= form_tag oauth2_path, method: :post, authenticity_token: true, remote: true, class: 'login-form' do %>
<%= hidden_field_tag :client_id, @app.uid %>
<%= hidden_field_tag :call_url, @call_url %>
<%= submit_tag '同意授权', class: "btn btn-login btn-lg btn-block mt-20" %>
<% end %>
<div class="reg">
<%= link_to "拒绝", '/access_denied', class: 'reg-link' %>
</div>
</div>
</div>
</div>
</main>
</main>
<% else %>
<main role="main">
<p class="auth-desc">
申请使用<strong class="app-name"> GitLink </strong>账号登录
<strong class="app-name"><%= @app&.name %></strong>
</p>
<div class="actions">
<div class="w">
<%= form_tag oauth2_path, method: :post, authenticity_token: true, remote: true, class: 'login-form' do %>
<%= hidden_field_tag :client_id, @app.uid %>
<%= hidden_field_tag :call_url, @call_url %>
<p id="account_error" class='error'></p>
<%= text_field_tag :login, '', placeholder: '请输入邮箱地址/用户名' %>
<p id="login_error" class='error'></p>
<%= password_field_tag :password, '', placeholder: '请输入密码' %>
<p id="password_error" class='error'></p>
<%= submit_tag '授权登录', class: "btn btn-login btn-lg btn-block mt-20" %>
<% end %>
<div class="reg">
<%= link_to "注 册", '/register', class: 'reg-link' %>
</div>
</div>
</div>
</main>
<% end %>

View File

@ -20,14 +20,18 @@ elsif trend.trend_type == "VersionRelease"
json.partial! "version_releases/simple_version_release", locals: {version: trend.trend}
elsif trend.trend_type == "CommitLog"
commit_log = trend.trend
json.name commit_log.message
json.created_at format_time(commit_log.created_at)
json.commit_log do
json.user do
json.partial! 'users/user_simple', locals: {user: commit_log.user}
if commit_log.present?
json.name commit_log.message
json.created_at format_time(commit_log.created_at)
json.commit_log do
json.user do
json.partial! 'users/user_simple', locals: {user: commit_log.user}
end
json.ref commit_log.ref.to_s.gsub("refs/heads/", "")
json.extract! commit_log, :id,:name,:full_name,:message, :commit_id,:created_at,:updated_at
end
json.ref commit_log.ref.to_s.gsub("refs/heads/", "")
json.extract! commit_log, :id,:name,:full_name,:message, :commit_id,:created_at,:updated_at
else
json.nil
end
else
json.name trend.trend&.title