From c5505dc4a2b6b2cc6d0458a98b7a16c4d662f796 Mon Sep 17 00:00:00 2001 From: yystopf Date: Mon, 4 Nov 2024 17:16:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=BC=80=E6=BA=90?= =?UTF-8?q?=E5=81=A5=E5=BA=B7=E5=BA=A6=E6=8E=A5=E5=8F=A3keyid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/v1/projects/oss_health_measuring_controller.rb | 9 +++++++++ config/routes/api.rb | 1 + 2 files changed, 10 insertions(+) diff --git a/app/controllers/api/v1/projects/oss_health_measuring_controller.rb b/app/controllers/api/v1/projects/oss_health_measuring_controller.rb index 370a4c824..5cc95907f 100644 --- a/app/controllers/api/v1/projects/oss_health_measuring_controller.rb +++ b/app/controllers/api/v1/projects/oss_health_measuring_controller.rb @@ -10,6 +10,15 @@ class Api::V1::Projects::OssHealthMeasuringController < Api::V1::BaseController render :json=> response.read_body end + def keyid + url = URI("#{EduSetting.get("ohm_server_url")}/api/OSS_Health_Measuring/#{params[:owner]}/#{params[:repo]}/#{params[:key_id]}") + + http = Net::HTTP.new(url.host, url.port); + request = Net::HTTP::Get.new(url) + response = http.request(request) + render :json=> response.read_body + end + def can_get url = URI("#{EduSetting.get("ohm_server_url")}/api/OHM_can_get/#{params[:owner]}/#{params[:repo]}") diff --git a/config/routes/api.rb b/config/routes/api.rb index 6669adac2..7f0a68ed6 100644 --- a/config/routes/api.rb +++ b/config/routes/api.rb @@ -134,6 +134,7 @@ defaults format: :json do resources :oss_health_measuring, only: [:index] do collection do get :can_get + get :keyid end end resources :portrait, only: [:index]