Fix #249 - use window.location hack to let people login from sandboxed iOS homescreen

This commit is contained in:
Eugen Rochko 2016-12-21 00:13:13 +01:00
parent 806ffbab63
commit e09d3a2c66
9 changed files with 48 additions and 13 deletions

View File

@ -1,7 +1,7 @@
import emojify from './components/emoji' import emojify from './components/emoji'
$(() => { $(() => {
$.each($('.entry .content, .entry .status__content, .display-name, .name, .account__header__content'), (_, content) => { $.each($('.entry .content, .entry .status__content, .status__display-name, .display-name, .name, .account__header__content'), (_, content) => {
const $content = $(content); const $content = $(content);
$content.html(emojify($content.html())); $content.html(emojify($content.html()));
}); });
@ -17,4 +17,13 @@ $(() => {
$('.media-spoiler').on('click', e => { $('.media-spoiler').on('click', e => {
$(e.target).hide(); $(e.target).hide();
}); });
$('.webapp-btn').on('click', e => {
console.log(e);
if (e.button === 0) {
e.preventDefault();
window.location.href = $(e.target).attr('href');
}
});
}); });

View File

@ -3,24 +3,26 @@
box-shadow: 0 0 15px rgba(0, 0, 0, 0.2); box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
.entry { .entry {
.status.light, .detailed-status.light { background: lighten(#d9e1e8, 8%);
&, .detailed-status.light {
border-bottom: 1px solid #d9e1e8; border-bottom: 1px solid #d9e1e8;
} }
&:last-child { &:last-child {
.status.light, .detailed-status.light { &, .detailed-status.light {
border-bottom: 0; border-bottom: 0;
border-radius: 0 0 4px 4px; border-radius: 0 0 4px 4px;
} }
} }
&:first-child { &:first-child {
.status.light, .detailed-status.light { &, .detailed-status.light {
border-radius: 4px 4px 0 0; border-radius: 4px 4px 0 0;
} }
&:last-child { &:last-child {
.status.light, .detailed-status.light { &, .detailed-status.light {
border-radius: 4px; border-radius: 4px;
} }
} }
@ -32,7 +34,6 @@
position: relative; position: relative;
min-height: 48px; min-height: 48px;
cursor: default; cursor: default;
background: lighten(#d9e1e8, 8%);
.status__header { .status__header {
font-size: 15px; font-size: 15px;
@ -280,6 +281,25 @@
} }
} }
} }
.pre-header {
padding: 14px 0px;
padding-left: (48px + 14px*2);
padding-bottom: 0;
margin-bottom: -4px;
color: #9baec8;
font-size: 14px;
position: relative;
.pre-header__icon {
position: absolute;
left: (48px + 14px*2 - 30px);
}
.status__display-name.muted strong {
color: #9baec8;
}
}
} }
.embed { .embed {

View File

@ -4,7 +4,7 @@ class MediaController < ApplicationController
before_action :set_media_attachment before_action :set_media_attachment
def show def show
redirect_to TagManager.instance.url_for(@media_attachment.status) redirect_to @media_attachment.file.url(:original)
end end
private private

View File

@ -2,6 +2,7 @@
= Rails.configuration.x.local_domain = Rails.configuration.x.local_domain
- content_for :header_tags do - content_for :header_tags do
= javascript_include_tag 'application_public'
%meta{ property: 'og:site_name', content: 'Mastodon' }/ %meta{ property: 'og:site_name', content: 'Mastodon' }/
%meta{ property: 'og:type', content: 'website' }/ %meta{ property: 'og:type', content: 'website' }/
%meta{ property: 'og:title', content: Rails.configuration.x.local_domain }/ %meta{ property: 'og:title', content: Rails.configuration.x.local_domain }/
@ -25,5 +26,5 @@
= link_to t('about.terms'), terms_path = link_to t('about.terms'), terms_path
= link_to t('about.source_code'), 'https://github.com/Gargron/mastodon' = link_to t('about.source_code'), 'https://github.com/Gargron/mastodon'
= link_to t('about.get_started'), new_user_registration_path, class: 'button' = link_to t('about.get_started'), new_user_registration_path, class: 'button webapp-btn'
= link_to t('auth.login'), new_user_session_path, class: 'button' = link_to t('auth.login'), new_user_session_path, class: 'button webapp-btn'

View File

@ -1,5 +1,4 @@
- content_for :header_tags do - content_for :header_tags do
%meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/
= javascript_include_tag 'application' = javascript_include_tag 'application'
= react_component 'Mastodon', default_props, class: 'app-holder', prerender: false = react_component 'Mastodon', default_props, class: 'app-holder', prerender: false

View File

@ -9,6 +9,7 @@
%link{:rel => "manifest", :href => "/manifest.json"}/ %link{:rel => "manifest", :href => "/manifest.json"}/
%meta{:name => "msapplication-config", :content => "/browserconfig.xml"}/ %meta{:name => "msapplication-config", :content => "/browserconfig.xml"}/
%meta{:name => "theme-color", :content => "#2b90d9"}/ %meta{:name => "theme-color", :content => "#2b90d9"}/
%meta{:name => "apple-mobile-web-app-capable", :content => "yes"}/
%title %title
= "#{yield(:page_title)} - " if content_for?(:page_title) = "#{yield(:page_title)} - " if content_for?(:page_title)

View File

@ -9,9 +9,12 @@
.entry{ class: entry_classes(status, is_predecessor, is_successor, include_threads) } .entry{ class: entry_classes(status, is_predecessor, is_successor, include_threads) }
- if status.reblog? - if status.reblog?
.pre-header .pre-header
%i.fa.fa-retweet %div.pre-header__icon
Shared by = fa_icon('retweet fw')
= link_to display_name(status.account), TagManager.instance.url_for(status.account), class: 'name' %span
= link_to TagManager.instance.url_for(status.account), class: 'status__display-name muted' do
%strong= display_name(status.account)
= t('stream_entries.reblogged')
= render partial: centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status', locals: { status: proper_status(status) } = render partial: centered ? 'stream_entries/detailed_status' : 'stream_entries/simple_status', locals: { status: proper_status(status) }

View File

@ -55,6 +55,7 @@ de:
stream_entries: stream_entries:
favourited: favorisierte einen Beitrag von favourited: favorisierte einen Beitrag von
is_now_following: folgt nun is_now_following: folgt nun
reblogged: teilte
users: users:
invalid_email: Inkorrekte E-mail-Addresse invalid_email: Inkorrekte E-mail-Addresse
will_paginate: will_paginate:

View File

@ -71,6 +71,7 @@ en:
favourited: favourited a post by favourited: favourited a post by
is_now_following: is now following is_now_following: is now following
sensitive_content: Sensitive content sensitive_content: Sensitive content
reblogged: boosted
time: time:
formats: formats:
default: "%b %d, %Y, %H:%M" default: "%b %d, %Y, %H:%M"