|
|
|
@@ -19,7 +19,7 @@ class InstallationsController < ApplicationController |
|
|
|
def repositories |
|
|
|
# 与github差异,所以取安装用户和bot对应所有的仓库 |
|
|
|
# 必须使用access_tokens获取到bot的token才能查询 |
|
|
|
tip_exception "Token无效" if current_user.platform != "bot" |
|
|
|
tip_exception "无效Token" if current_user.platform != "bot" |
|
|
|
bot = Bot.find_by(uid: current_user.id) |
|
|
|
@install_bots = BotInstall.where(bot_id: bot.id).where(installer_id: params[:id]) |
|
|
|
end |
|
|
|
@@ -118,6 +118,9 @@ class InstallationsController < ApplicationController |
|
|
|
decoded_token = JWT.decode token, nil, false |
|
|
|
# 前面已验证token有效期和正确性 |
|
|
|
decoded_token[0]["iss"] |
|
|
|
rescue JWT::DecodeError |
|
|
|
Rails.logger.error "jwt token decode error:#{token}" |
|
|
|
tip_exception("无效Token") |
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|