From 5d43a9cae2dd03f500c4bd9736a9e71e131b6d02 Mon Sep 17 00:00:00 2001 From: Jason Rhodes Date: Thu, 6 Apr 2017 22:48:17 -0400 Subject: Email service options :P Small addition in case people want email service options, sparkpost.com gives you 100k/mo free --- .env.production.sample | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.env.production.sample') diff --git a/.env.production.sample b/.env.production.sample index a7f9eb4bf..9bb988ea6 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -26,7 +26,7 @@ OTP_SECRET= # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc # E-mail configuration -SMTP_SERVER=smtp.mailgun.org +SMTP_SERVER=smtp.mailgun.org, smtp.sparkpostmail.com, etc. SMTP_PORT=587 SMTP_LOGIN= SMTP_PASSWORD= -- cgit From e3a3422a65901c71ec3ff4a2729309c441660d63 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 7 Apr 2017 12:40:26 +0200 Subject: Allow setting of default language through config Setting of locale in controller extracted to Localized concern, the doorkeeper authorized applications controller moved under custom namespace with inclusion of Localized, which resolves the "it sometimes appears in a different random language" bug --- .env.production.sample | 3 +++ app/controllers/application_controller.rb | 9 ++------- app/controllers/concerns/localized.rb | 19 ++++++++++++++++++ app/controllers/oauth/authorizations_controller.rb | 9 ++------- .../oauth/authorized_applications_controller.rb | 16 +++++++++++++++ .../authorized_applications/index.html.haml | 23 ---------------------- .../oauth/authorized_applications/index.html.haml | 23 ++++++++++++++++++++++ config/routes.rb | 2 +- 8 files changed, 66 insertions(+), 38 deletions(-) create mode 100644 app/controllers/concerns/localized.rb create mode 100644 app/controllers/oauth/authorized_applications_controller.rb delete mode 100644 app/views/doorkeeper/authorized_applications/index.html.haml create mode 100644 app/views/oauth/authorized_applications/index.html.haml (limited to '.env.production.sample') diff --git a/.env.production.sample b/.env.production.sample index a7f9eb4bf..a0e963ca6 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -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 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c06142fd4..f00f9c1e3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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 diff --git a/app/controllers/concerns/localized.rb b/app/controllers/concerns/localized.rb new file mode 100644 index 000000000..b6f868090 --- /dev/null +++ b/app/controllers/concerns/localized.rb @@ -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 diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index 7c25266d8..cdbfde0fb 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -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 diff --git a/app/controllers/oauth/authorized_applications_controller.rb b/app/controllers/oauth/authorized_applications_controller.rb new file mode 100644 index 000000000..09dd5d3c4 --- /dev/null +++ b/app/controllers/oauth/authorized_applications_controller.rb @@ -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 diff --git a/app/views/doorkeeper/authorized_applications/index.html.haml b/app/views/doorkeeper/authorized_applications/index.html.haml deleted file mode 100644 index d4719881c..000000000 --- a/app/views/doorkeeper/authorized_applications/index.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- content_for :page_title do - = t('doorkeeper.authorized_applications.index.title') - -%table.table - %thead - %tr - %th= t('doorkeeper.authorized_applications.index.application') - %th= t('doorkeeper.authorized_applications.index.scopes') - %th= t('doorkeeper.authorized_applications.index.created_at') - %th - %tbody - - @applications.each do |application| - %tr - %td - - if application.website.blank? - = application.name - - else - = link_to application.name, application.website - %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('
').html_safe - %td= l application.created_at - %td - - unless application.superapp? - = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } diff --git a/app/views/oauth/authorized_applications/index.html.haml b/app/views/oauth/authorized_applications/index.html.haml new file mode 100644 index 000000000..d4719881c --- /dev/null +++ b/app/views/oauth/authorized_applications/index.html.haml @@ -0,0 +1,23 @@ +- content_for :page_title do + = t('doorkeeper.authorized_applications.index.title') + +%table.table + %thead + %tr + %th= t('doorkeeper.authorized_applications.index.application') + %th= t('doorkeeper.authorized_applications.index.scopes') + %th= t('doorkeeper.authorized_applications.index.created_at') + %th + %tbody + - @applications.each do |application| + %tr + %td + - if application.website.blank? + = application.name + - else + = link_to application.name, application.website + %th= application.scopes.map { |scope| t(scope, scope: [:doorkeeper, :scopes]) }.join('
').html_safe + %td= l application.created_at + %td + - unless application.superapp? + = table_link_to 'times', t('doorkeeper.authorized_applications.buttons.revoke'), oauth_authorized_application_path(application), method: :delete, data: { confirm: t('doorkeeper.authorized_applications.confirmations.revoke') } diff --git a/config/routes.rb b/config/routes.rb index ca77191f7..315ad5da5 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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 -- cgit From 786e6f94b986dbf98eae9d79bc75e147fcefc8ec Mon Sep 17 00:00:00 2001 From: Jantso Porali Date: Fri, 7 Apr 2017 12:58:12 +0200 Subject: Update Finnish translations, add sample Minio config (#954) --- .env.production.sample | 10 ++++++++++ app/views/user_mailer/confirmation_instructions.fi.html.erb | 5 +++++ app/views/user_mailer/confirmation_instructions.fi.text.erb | 5 +++++ app/views/user_mailer/password_change.fi.html.erb | 3 +++ app/views/user_mailer/password_change.fi.text.erb | 3 +++ .../user_mailer/reset_password_instructions.fi.html.erb | 8 ++++++++ .../user_mailer/reset_password_instructions.fi.text.erb | 8 ++++++++ config/locales/fi.yml | 12 ++++++------ docs/Using-Mastodon/FAQ.md | 3 ++- 9 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 app/views/user_mailer/confirmation_instructions.fi.html.erb create mode 100644 app/views/user_mailer/confirmation_instructions.fi.text.erb create mode 100644 app/views/user_mailer/password_change.fi.html.erb create mode 100644 app/views/user_mailer/password_change.fi.text.erb create mode 100644 app/views/user_mailer/reset_password_instructions.fi.html.erb create mode 100644 app/views/user_mailer/reset_password_instructions.fi.text.erb (limited to '.env.production.sample') diff --git a/.env.production.sample b/.env.production.sample index a7f9eb4bf..a4eabc384 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -44,6 +44,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= diff --git a/app/views/user_mailer/confirmation_instructions.fi.html.erb b/app/views/user_mailer/confirmation_instructions.fi.html.erb new file mode 100644 index 000000000..8b72722da --- /dev/null +++ b/app/views/user_mailer/confirmation_instructions.fi.html.erb @@ -0,0 +1,5 @@ +

Tervetuloa <%= @resource.email %>!

+ +

Voit vahvistaa Mastodon tilisi klikkaamalla alla olevaa linkkiä:

+ +

<%= link_to 'Varmista tilini', confirmation_url(@resource, confirmation_token: @token) %>

diff --git a/app/views/user_mailer/confirmation_instructions.fi.text.erb b/app/views/user_mailer/confirmation_instructions.fi.text.erb new file mode 100644 index 000000000..796913abb --- /dev/null +++ b/app/views/user_mailer/confirmation_instructions.fi.text.erb @@ -0,0 +1,5 @@ +Tervetuloa <%= @resource.email %>! + +Voit vahvistaa Mastodon tilisi klikkaamalla alla olevaa linkkiä: + +<%= confirmation_url(@resource, confirmation_token: @token) %> diff --git a/app/views/user_mailer/password_change.fi.html.erb b/app/views/user_mailer/password_change.fi.html.erb new file mode 100644 index 000000000..c56b96593 --- /dev/null +++ b/app/views/user_mailer/password_change.fi.html.erb @@ -0,0 +1,3 @@ +

Hei <%= @resource.email %>!

+ +

Lähetämme tämän viestin ilmoittaaksemme että salasanasi on vaihdettu.

diff --git a/app/views/user_mailer/password_change.fi.text.erb b/app/views/user_mailer/password_change.fi.text.erb new file mode 100644 index 000000000..d90c3fdeb --- /dev/null +++ b/app/views/user_mailer/password_change.fi.text.erb @@ -0,0 +1,3 @@ +Hei <%= @resource.email %>! + +Lähetämme tämän viestin ilmoittaaksemme että salasanasi on vaihdettu. diff --git a/app/views/user_mailer/reset_password_instructions.fi.html.erb b/app/views/user_mailer/reset_password_instructions.fi.html.erb new file mode 100644 index 000000000..53be0b62b --- /dev/null +++ b/app/views/user_mailer/reset_password_instructions.fi.html.erb @@ -0,0 +1,8 @@ +

Hei <%= @resource.email %>!

+ +

Joku on pyytänyt salasanvaihto Mastodonissa. Voit tehdä sen allaolevassa linkissä.

+ +

<%= link_to 'Vaihda salasanani', 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.

diff --git a/app/views/user_mailer/reset_password_instructions.fi.text.erb b/app/views/user_mailer/reset_password_instructions.fi.text.erb new file mode 100644 index 000000000..c826d5fc8 --- /dev/null +++ b/app/views/user_mailer/reset_password_instructions.fi.text.erb @@ -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. diff --git a/config/locales/fi.yml b/config/locales/fi.yml index cdb2b9886..947d3f646 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -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 diff --git a/docs/Using-Mastodon/FAQ.md b/docs/Using-Mastodon/FAQ.md index daedcbdd8..3b03a8ee4 100644 --- a/docs/Using-Mastodon/FAQ.md +++ b/docs/Using-Mastodon/FAQ.md @@ -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. \ No newline at end of file +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. -- cgit From 2ac8a590cd164891be0f11ca3d705a3ec948cecb Mon Sep 17 00:00:00 2001 From: Jason Rhodes Date: Fri, 7 Apr 2017 07:43:44 -0400 Subject: Moved into a comment per feedback --- .env.production.sample | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.env.production.sample') diff --git a/.env.production.sample b/.env.production.sample index 9bb988ea6..6d28a4a11 100644 --- a/.env.production.sample +++ b/.env.production.sample @@ -26,7 +26,8 @@ OTP_SECRET= # EMAIL_DOMAIN_WHITELIST=example1.com|example2.de|etc # E-mail configuration -SMTP_SERVER=smtp.mailgun.org, smtp.sparkpostmail.com, etc. +# Note: Mailgun and SparkPost (https://sparkpo.st/smtp) each have good free tiers +SMTP_SERVER=smtp.mailgun.org SMTP_PORT=587 SMTP_LOGIN= SMTP_PASSWORD= -- cgit