From cbe10b4b890d09ded69744354b59938053da5a0f Mon Sep 17 00:00:00 2001 From: xxq250 Date: Thu, 1 Dec 2022 18:03:06 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20=E7=AC=AC=E4=B8=89=E6=96=B9=E6=8E=88?= =?UTF-8?q?=E6=9D=83=E7=99=BB=E5=BD=95(github,gitee,qq,wechat)=EF=BC=8C?= =?UTF-8?q?=E8=BE=93=E5=87=BAURL=E5=88=B0=E5=89=8D=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/settings_controller.rb | 18 ++++++++++++++++++ app/views/settings/show.json.jbuilder | 1 + 2 files changed, 19 insertions(+) diff --git a/app/controllers/settings_controller.rb b/app/controllers/settings_controller.rb index f3eedd0a1..e365c3e29 100644 --- a/app/controllers/settings_controller.rb +++ b/app/controllers/settings_controller.rb @@ -7,6 +7,7 @@ class SettingsController < ApplicationController get_sub_competitions get_personal_menu get_third_party + get_third_party_new get_top_system_notification end @@ -67,6 +68,23 @@ class SettingsController < ApplicationController url: EducoderOauth.oauth_url } end + + def get_third_party_new + @third_party_new = [] + @third_party_new << { + name: 'educoder', + url: EducoderOauth.oauth_url, + method: 'get' + } + config = Rails.application.config_for(:configuration) + (config.dig("oauth").keys - ["educoder"]).each do |provider| + @third_party_new << { + name: provider, + url: "/auth/#{provider}", + method: 'post' + } + end + end def get_top_system_notification @top_system_notification = SystemNotification.is_top.first diff --git a/app/views/settings/show.json.jbuilder b/app/views/settings/show.json.jbuilder index abe8207eb..be79dc594 100644 --- a/app/views/settings/show.json.jbuilder +++ b/app/views/settings/show.json.jbuilder @@ -61,6 +61,7 @@ json.setting do json.common @common json.third_party @third_party + json.third_party_new @third_party_new if @top_system_notification.present? json.system_notification do