Merge branch 'master' into skylight

This commit is contained in:
Eugen Rochko 2017-04-07 13:09:25 +02:00
commit 1ec81ccec0
16 changed files with 94 additions and 23 deletions

View file

@ -25,6 +25,9 @@ OTP_SECRET=
# Only allow registrations with the following e-mail domains
# EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc
# Optionally change default language
# DEFAULT_LOCALE=de
# E-mail configuration
SMTP_SERVER=smtp.mailgun.org
SMTP_PORT=587
@ -44,6 +47,16 @@ SMTP_FROM_ADDRESS=notifications@example.com
# S3_PROTOCOL=http
# S3_HOSTNAME=192.168.1.123:9000
# S3 (Minio Config (optional) Please check Minio instance for details)
# S3_ENABLED=true
# S3_BUCKET=
# AWS_ACCESS_KEY_ID=
# AWS_SECRET_ACCESS_KEY=
# S3_REGION=
# S3_PROTOCOL=https
# S3_HOSTNAME=
# S3_ENDPOINT=
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
# S3_CLOUDFRONT_HOST=

View file

@ -1,6 +1,8 @@
# frozen_string_literal: true
class ApplicationController < ActionController::Base
include Localized
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
@ -14,7 +16,6 @@ class ApplicationController < ActionController::Base
rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity
before_action :store_current_location, except: :raise_not_found, unless: :devise_controller?
before_action :set_locale
before_action :set_user_activity
before_action :check_suspension, if: :user_signed_in?
@ -28,12 +29,6 @@ class ApplicationController < ActionController::Base
store_location_for(:user, request.url)
end
def set_locale
I18n.locale = current_user.try(:locale) || I18n.default_locale
rescue I18n::InvalidLocale
I18n.locale = I18n.default_locale
end
def require_admin!
redirect_to root_path unless current_user&.admin?
end

View file

@ -0,0 +1,19 @@
# frozen_string_literal: true
module Localized
extend ActiveSupport::Concern
included do
before_action :set_locale
end
def set_locale
I18n.locale = current_user.try(:locale) || default_locale
rescue I18n::InvalidLocale
I18n.locale = default_locale
end
def default_locale
ENV.fetch('DEFAULT_LOCALE') { I18n.default_locale }
end
end

View file

@ -1,9 +1,10 @@
# frozen_string_literal: true
class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
include Localized
skip_before_action :authenticate_resource_owner!
before_action :set_locale
before_action :store_current_location
before_action :authenticate_resource_owner!
@ -12,10 +13,4 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
def store_current_location
store_location_for(:user, request.url)
end
def set_locale
I18n.locale = current_user.try(:locale) || I18n.default_locale
rescue I18n::InvalidLocale
I18n.locale = I18n.default_locale
end
end

View file

@ -0,0 +1,16 @@
# frozen_string_literal: true
class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicationsController
include Localized
skip_before_action :authenticate_resource_owner!
before_action :store_current_location
before_action :authenticate_resource_owner!
private
def store_current_location
store_location_for(:user, request.url)
end
end

View file

@ -101,7 +101,7 @@ class AtomSerializer
serialize_status_attributes(object, status)
append_element(object, 'link', nil, rel: :alternate, type: 'text/html', href: TagManager.instance.url_for(status))
append_element(object, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(status.thread), href: TagManager.instance.url_for(status.thread)) if status.reply?
append_element(object, 'thr:in-reply-to', nil, ref: TagManager.instance.uri_for(status.thread), href: TagManager.instance.url_for(status.thread)) if status.reply? && !status.thread.nil?
object
end

View file

@ -0,0 +1,5 @@
<p>Tervetuloa <%= @resource.email %>!</p>
<p>Voit vahvistaa Mastodon tilisi klikkaamalla alla olevaa linkkiä:</p>
<p><%= link_to 'Varmista tilini', confirmation_url(@resource, confirmation_token: @token) %></p>

View file

@ -0,0 +1,5 @@
Tervetuloa <%= @resource.email %>!
Voit vahvistaa Mastodon tilisi klikkaamalla alla olevaa linkkiä:
<%= confirmation_url(@resource, confirmation_token: @token) %>

View file

@ -0,0 +1,3 @@
<p>Hei <%= @resource.email %>!</p>
<p>Lähetämme tämän viestin ilmoittaaksemme että salasanasi on vaihdettu.</p>

View file

@ -0,0 +1,3 @@
Hei <%= @resource.email %>!
Lähetämme tämän viestin ilmoittaaksemme että salasanasi on vaihdettu.

View file

@ -0,0 +1,8 @@
<p>Hei <%= @resource.email %>!</p>
<p>Joku on pyytänyt salasanvaihto Mastodonissa. Voit tehdä sen allaolevassa linkissä.</p>
<p><%= link_to 'Vaihda salasanani', edit_password_url(@resource, reset_password_token: @token) %></p>
<p>Jos et pyytänyt vaihtoa, poista tämä viesti.</p>
<p>Salasanaasi ei vaihdeta ennen kuin menet ylläolevaan linkkiin ja luot uuden.</p>

View file

@ -0,0 +1,8 @@
Hei <%= @resource.email %>!
Joku on pyytänyt salasanvaihto Mastodonissa. Voit tehdä sen allaolevassa linkissä.
<%= edit_password_url(@resource, reset_password_token: @token) %>
Jos et pyytänyt vaihtoa, poista tämä viesti.
Salasanaasi ei vaihdeta ennen kuin menet ylläolevaan linkkiin ja luot uuden.

View file

@ -16,18 +16,18 @@ fi:
chronology: Aikajana on kronologisessa järjestyksessä
ethics: 'Eettinen suunnittelu: ei mainoksia, no seurantaa'
gifv: GIFV settejä ja lyhyitä videoita
privacy: Julkaisu kohtainen yksityisyys aseuts
privacy: Julkaisu kohtainen yksityisyys asetus
public: Julkiset aikajanat
features_headline: Mikä erottaa Mastodonin muista
get_started: Aloita käyttö
links: Linkit
other_instances: muuhun palvelimeen
other_instances: Muut palvelimet
source_code: Lähdekoodi
status_count_after: statusta
status_count_before: Ovat luoneet
terms: Ehdot
user_count_after: käyttäjää
user_count_before: Koti käyttäjälle
user_count_after: käyttäjälle
user_count_before: Koti
accounts:
follow: Seuraa
followers: Seuraajat
@ -130,8 +130,8 @@ fi:
authorized_apps: Valtuutetut ohjelmat
back: Takaisin Mastodoniin
edit_profile: Muokkaa profiilia
export: Datan vienti
import: Datan tuonti
export: Vie dataa
import: Tuo dataa
preferences: Ominaisuudet
settings: Asetukset
two_factor_auth: Kaksivaiheinen tunnistus

View file

@ -11,7 +11,7 @@ Rails.application.routes.draw do
end
use_doorkeeper do
controllers authorizations: 'oauth/authorizations'
controllers authorizations: 'oauth/authorizations', authorized_applications: 'oauth/authorized_applications'
end
get '.well-known/host-meta', to: 'xrd#host_meta', as: :host_meta

View file

@ -36,8 +36,9 @@ While Mastodon is compatible with GNU social in terms of server to server commun
Because Mastodon has been created from a blank slate, it is much simpler to have the API mirror internal structures as closely as possible, rather than build an emulation layer. Secondly, the GNU social client API is actually a half-way implementation of the legacy Twitter API - that's the reason why it works with some older Twitter client apps. However, many of those apps are not maintained anymore, the GNU social API does not actually keep up with the real Twitter API and never fully implemented all its features; at the same time, the Twitter API was never meant for a federated service and so obscures some of the functionality.
#### How is Mastodon funded?
Development of Mastodon and hosting of mastodon.social is funded through my [Patreon (also BTC/PayPal donations)](https://www.patreon.com/user?u=619786). Beyond that, I am not interested in VC funding, monetizing, advertising, or anything of that sort. I could offer setup/maintenance services on demand.
The software is free and open source and communities should host their own servers if they can, that way the costs are more or less distributed. Obviously it'd be hard for me to pay the bills if literally everyone decided to use the mastodon.social instance only.
The software is free and open source and communities should host their own servers if they can, that way the costs are more or less distributed. Obviously it'd be hard for me to pay the bills if literally everyone decided to use the mastodon.social instance only.