This commit is contained in:
2025-07-07 08:28:51 +09:00
parent ebcc535cf1
commit 9c1efbf047
3 changed files with 41 additions and 4 deletions
@@ -20,7 +20,7 @@ class PreviewController < ApplicationController
return head :unauthorized unless current_user
url = params[:url]
return head :bad_request unless url.present?
return head :bad_request if url.blank?
path = Rails.root.join('tmp', "thumb_#{ SecureRandom.hex }.png")
system("node #{ Rails.root }/lib/screenshot.js #{ Shellwords.escape(url) } #{ path }")
@@ -14,6 +14,13 @@ class UsersController < ApplicationController
end
end
def renew
user = current_user
user.inheritance_code = SecureRandom.uuid
user.save!
render json: { code: user.inheritance_code }
end
def me
user = User.find_by(inheritance_code: params[:code])
render(if user