mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Implement SMTP mailing and fix some bugs
This commit is contained in:
parent
0e8030121a
commit
d6b5ce0549
8 changed files with 30 additions and 9 deletions
|
|
@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
|
|
||||||
|
|
||||||
# 0.25.5 - 2025-04-13
|
# 0.25.5 - 2025-04-15
|
||||||
|
|
||||||
## Removed
|
## Removed
|
||||||
|
|
||||||
|
|
@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
- `rake points:migrate_to_lonlat` task now also tries to extract latitude and longitude from `raw_data` column before using `longitude` and `latitude` columns to fill `lonlat` column.
|
- `rake points:migrate_to_lonlat` task now also tries to extract latitude and longitude from `raw_data` column before using `longitude` and `latitude` columns to fill `lonlat` column.
|
||||||
- Docker entrypoints are now using `DATABASE_NAME` environment variable to check if Postgres is existing/available.
|
- Docker entrypoints are now using `DATABASE_NAME` environment variable to check if Postgres is existing/available.
|
||||||
|
|
||||||
|
## Added
|
||||||
|
|
||||||
|
- You can now provide SMTP settings in ENV vars to send emails.
|
||||||
|
|
||||||
|
|
||||||
# 0.25.4 - 2025-04-02
|
# 0.25.4 - 2025-04-02
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
class HomeController < ApplicationController
|
class HomeController < ApplicationController
|
||||||
def index
|
def index
|
||||||
|
# redirect_to 'https://dawarich.app', allow_other_host: true and return unless SELF_HOSTED
|
||||||
|
|
||||||
redirect_to map_url if current_user
|
redirect_to map_url if current_user
|
||||||
|
|
||||||
@points = current_user.tracked_points.without_raw_data if current_user
|
@points = current_user.tracked_points.without_raw_data if current_user
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ApplicationMailer < ActionMailer::Base
|
class ApplicationMailer < ActionMailer::Base
|
||||||
default from: "from@example.com"
|
default from: ENV['SMTP_FROM']
|
||||||
layout "mailer"
|
layout 'mailer'
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class Points::RawDataLonlatExtractor
|
||||||
|
|
||||||
# rubocop:disable Metrics/MethodLength
|
# rubocop:disable Metrics/MethodLength
|
||||||
def extract_lonlat(point)
|
def extract_lonlat(point)
|
||||||
if point.raw_data['activitySegment']['waypointPath']['waypoints'][0]
|
if point.raw_data.dig('activitySegment', 'waypointPath', 'waypoints', 0)
|
||||||
# google_semantic_history_parser
|
# google_semantic_history_parser
|
||||||
[
|
[
|
||||||
point.raw_data['activitySegment']['waypointPath']['waypoints'][0]['lngE7'].to_f / 10**7,
|
point.raw_data['activitySegment']['waypointPath']['waypoints'][0]['lngE7'].to_f / 10**7,
|
||||||
|
|
@ -30,7 +30,7 @@ class Points::RawDataLonlatExtractor
|
||||||
point.raw_data['longitudeE7'].to_f / 10**7,
|
point.raw_data['longitudeE7'].to_f / 10**7,
|
||||||
point.raw_data['latitudeE7'].to_f / 10**7
|
point.raw_data['latitudeE7'].to_f / 10**7
|
||||||
]
|
]
|
||||||
elsif point.raw_data['position']['LatLng']
|
elsif point.raw_data.dig('position', 'LatLng')
|
||||||
# google phone export
|
# google phone export
|
||||||
raw_coordinates = point.raw_data['position']['LatLng']
|
raw_coordinates = point.raw_data['position']['LatLng']
|
||||||
if raw_coordinates.include?('°')
|
if raw_coordinates.include?('°')
|
||||||
|
|
@ -41,7 +41,7 @@ class Points::RawDataLonlatExtractor
|
||||||
elsif point.raw_data['lon'] && point.raw_data['lat']
|
elsif point.raw_data['lon'] && point.raw_data['lat']
|
||||||
# gpx_track_importer, owntracks
|
# gpx_track_importer, owntracks
|
||||||
[point.raw_data['lon'], point.raw_data['lat']]
|
[point.raw_data['lon'], point.raw_data['lat']]
|
||||||
elsif point.raw_data['geometry']['coordinates'][0] && point.raw_data['geometry']['coordinates'][1]
|
elsif point.raw_data.dig('geometry', 'coordinates', 0) && point.raw_data.dig('geometry', 'coordinates', 1)
|
||||||
# geojson
|
# geojson
|
||||||
[
|
[
|
||||||
point.raw_data['geometry']['coordinates'][0],
|
point.raw_data['geometry']['coordinates'][0],
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if !SELF_HOSTED && devise_mapping&.registerable? && controller_name != 'registrations' %>
|
<% if !SELF_HOSTED && defined?(devise_mapping) && devise_mapping&.registerable? && controller_name != 'registrations' %>
|
||||||
<div class='my-2'>
|
<div class='my-2'>
|
||||||
<%= link_to "Register", new_registration_path(resource_name) %>
|
<%= link_to "Register", new_registration_path(resource_name) %>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -126,7 +126,7 @@
|
||||||
</li>
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<li><%= link_to 'Login', new_user_session_path %></li>
|
<li><%= link_to 'Login', new_user_session_path %></li>
|
||||||
<% if !SELF_HOSTED && devise_mapping&.registerable? %>
|
<% if !SELF_HOSTED && defined?(devise_mapping) && devise_mapping&.registerable? %>
|
||||||
<li><%= link_to 'Register', new_user_registration_path %></li>
|
<li><%= link_to 'Register', new_user_registration_path %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
||||||
|
|
@ -107,4 +107,17 @@ Rails.application.configure do
|
||||||
|
|
||||||
config.action_mailer.default_url_options = { host: hosts.first, port: 3000 }
|
config.action_mailer.default_url_options = { host: hosts.first, port: 3000 }
|
||||||
config.hosts.concat(hosts) if hosts.present?
|
config.hosts.concat(hosts) if hosts.present?
|
||||||
|
|
||||||
|
config.action_mailer.delivery_method = :smtp
|
||||||
|
config.action_mailer.smtp_settings = {
|
||||||
|
address: ENV['SMTP_SERVER'],
|
||||||
|
port: ENV['SMTP_PORT'],
|
||||||
|
domain: ENV['SMTP_DOMAIN'],
|
||||||
|
user_name: ENV['SMTP_USERNAME'],
|
||||||
|
password: ENV['SMTP_PASSWORD'],
|
||||||
|
authentication: 'plain',
|
||||||
|
enable_starttls: true,
|
||||||
|
open_timeout: 5,
|
||||||
|
read_timeout: 5
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ Devise.setup do |config|
|
||||||
# Configure the e-mail address which will be shown in Devise::Mailer,
|
# Configure the e-mail address which will be shown in Devise::Mailer,
|
||||||
# note that it will be overwritten if you use your own mailer class
|
# note that it will be overwritten if you use your own mailer class
|
||||||
# with default "from" parameter.
|
# with default "from" parameter.
|
||||||
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
|
config.mailer_sender = ENV['SMTP_FROM']
|
||||||
|
|
||||||
# Configure the class responsible to send e-mails.
|
# Configure the class responsible to send e-mails.
|
||||||
# config.mailer = 'Devise::Mailer'
|
# config.mailer = 'Devise::Mailer'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue