mirror of
https://gitlink.org.cn/Gitlink/forgeplus.git
synced 2026-05-03 03:40:49 +08:00
softbot补充和调整接口
This commit is contained in:
@@ -2,10 +2,23 @@ class InstallationsController < ApplicationController
|
||||
include RegisterHelper
|
||||
before_action :require_login
|
||||
|
||||
# app详情
|
||||
def app
|
||||
@bot = Bot.find_by(uid: current_user.id)
|
||||
end
|
||||
|
||||
def index
|
||||
@install_bots = BotInstall.where(:installer_id => current_user.id)
|
||||
end
|
||||
|
||||
def show
|
||||
@install_bot = BotInstall.find params[:id]
|
||||
end
|
||||
|
||||
def repositories
|
||||
@install_bots = BotInstall.where(:installer_id => current_user.id)
|
||||
end
|
||||
|
||||
def update_secret
|
||||
ActiveRecord::Base.transaction do
|
||||
bot = Bot.find params[:id]
|
||||
@@ -25,6 +38,24 @@ class InstallationsController < ApplicationController
|
||||
render_ok
|
||||
end
|
||||
|
||||
def update_callback_url
|
||||
bot = Bot.find params[:id]
|
||||
application = Doorkeeper::Application.find_by(uid: bot.client_id, secret: bot.client_secret)
|
||||
# application.redirect_uri = bot.callback_url
|
||||
application.save
|
||||
render_ok
|
||||
end
|
||||
|
||||
def suspended
|
||||
@install_bot = BotInstall.find params[:id]
|
||||
@install_bot.update_attributes!(state: 0)
|
||||
render_ok
|
||||
end
|
||||
def unsuspended
|
||||
@install_bot = BotInstall.find params[:id]
|
||||
@install_bot.update_attributes!(state: 1)
|
||||
render_ok
|
||||
end
|
||||
def auth_active
|
||||
begin
|
||||
@bot = Bot.find params[:id]
|
||||
@@ -60,6 +91,7 @@ class InstallationsController < ApplicationController
|
||||
:expires_in => "604800",
|
||||
:use_refresh_token => true
|
||||
})
|
||||
@install_bot.update_attributes!(state: 1)
|
||||
render_ok(token: @access_token.token)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user