gearheads
/
mastodon
Archived
2
0
Fork 0

implement web share target (#6278)

* web share target

* fix

* fix
gh/stable
りんすき 2018-01-18 01:08:10 +09:00 committed by Eugen Rochko
parent 0a103c7749
commit fbe7756da6
2 changed files with 8 additions and 2 deletions

View File

@ -14,13 +14,14 @@ class SharesController < ApplicationController
private private
def initial_state_params def initial_state_params
text = [params[:title], params[:text], params[:url]].compact.join(' ')
{ {
settings: Web::Setting.find_by(user: current_user)&.data || {}, settings: Web::Setting.find_by(user: current_user)&.data || {},
push_subscription: current_account.user.web_push_subscription(current_session), push_subscription: current_account.user.web_push_subscription(current_session),
current_account: current_account, current_account: current_account,
token: current_session.token, token: current_session.token,
admin: Account.find_local(Setting.site_contact_username), admin: Account.find_local(Setting.site_contact_username),
text: params[:text], text: text,
} }
end end

View File

@ -6,7 +6,8 @@ class ManifestSerializer < ActiveModel::Serializer
attributes :name, :short_name, :description, attributes :name, :short_name, :description,
:icons, :theme_color, :background_color, :icons, :theme_color, :background_color,
:display, :start_url, :scope :display, :start_url, :scope,
:share_target
def name def name
object.site_title object.site_title
@ -49,4 +50,8 @@ class ManifestSerializer < ActiveModel::Serializer
def scope def scope
root_url root_url
end end
def share_target
{ url_template: 'share?title={title}&text={text}&url={url}' }
end
end end