diff --git a/app.rb b/app.rb index 97212767..8f51a7c5 100644 --- a/app.rb +++ b/app.rb @@ -125,16 +125,6 @@ not_found do end error do -=begin - EmailWorker.perform_async({ - from: 'web@neocities.org', - to: 'errors@neocities.org', - subject: "[Neocities Error] #{env['sinatra.error'].class}: #{env['sinatra.error'].message}", - body: erb(:'templates/email/error', layout: false), - no_footer: true - }) -=end - if @api api_error 500, 'server_error', 'there has been an unknown server error, please try again later' end diff --git a/app/admin.rb b/app/admin.rb index 551e1e7a..acecd12f 100644 --- a/app/admin.rb +++ b/app/admin.rb @@ -194,7 +194,7 @@ post '/admin/email' do queued_sites.each do |site| EmailWorker.perform_at((day.days.from_now + seconds), { - from: 'Kyle from Neocities ', + from: Site::FROM_EMAIL, to: site.email, subject: params[:subject], body: params[:body] diff --git a/app/contact.rb b/app/contact.rb index 907965f5..9a615dd9 100644 --- a/app/contact.rb +++ b/app/contact.rb @@ -36,9 +36,9 @@ post '/contact' do end EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, reply_to: params[:email], - to: 'contact@neocities.org', + to: $config['support_email'], subject: subject, body: body, no_footer: true diff --git a/app/create.rb b/app/create.rb index d5ad17f3..b3de789b 100644 --- a/app/create.rb +++ b/app/create.rb @@ -121,7 +121,7 @@ post '/create' do @site.phone_verification_required = true if self.class.production? && BlackBox.phone_verification_required?(@site) rescue => e EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, to: 'errors@neocities.org', subject: "[Neocities Error] Phone verification exception", body: "#{e.inspect}\n#{e.backtrace}", diff --git a/app/dmca.rb b/app/dmca.rb index 56c126c5..8aabb2ab 100644 --- a/app/dmca.rb +++ b/app/dmca.rb @@ -24,7 +24,7 @@ post '/dmca/contact' do erb :'dmca' else EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, reply_to: params[:email], to: 'dmca@neocities.org', subject: "[Neocities DMCA Notice]: #{params[:subject]}", diff --git a/app/index.rb b/app/index.rb index f2c52de9..7c466dd0 100644 --- a/app/index.rb +++ b/app/index.rb @@ -169,7 +169,7 @@ the Neocities Cat body.strip! EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, to: params[:email], subject: '[Neocities] Username lookup', body: body diff --git a/app/webhooks.rb b/app/webhooks.rb index 1aeb8f67..fea80ed2 100644 --- a/app/webhooks.rb +++ b/app/webhooks.rb @@ -1,12 +1,4 @@ post '/webhooks/paypal' do - EmailWorker.perform_async({ - from: 'web@neocities.org', - to: 'errors@neocities.org', - subject: "[Neocities Paypal Webhook] Received a Webhook from Paypal", - body: params.inspect, - no_footer: true - }) - 'ok' end @@ -57,7 +49,7 @@ post '/webhooks/paypal/tipping_notify' do ) EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, to: params[:payer_email], subject: "You sent a #{@tip.amount_string} tip!", body: Tilt.new('./views/templates/email/tip_sent.erb', pretty: true).render(self) @@ -66,24 +58,12 @@ end post '/webhooks/stripe' do event = JSON.parse request.body.read - if event['type'] == 'customer.created' - username = event['data']['object']['description'].split(' - ').first - email = event['data']['object']['email'] - - EmailWorker.perform_async({ - from: 'web@neocities.org', - to: 'contact@neocities.org', - subject: "[Neocities] New customer: #{username}", - body: "#{username}\n#{email}\n#{Site[username: username].uri}", - no_footer: true - }) - end if event['type'] == 'charge.failed' site = stripe_get_site_from_event event EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, to: site.email, subject: "[Neocities] There was an issue charging your card", body: Tilt.new('./views/templates/email/charge_failure.erb', pretty: true).render(self) @@ -98,7 +78,7 @@ post '/webhooks/stripe' do site.save_changes validate: false EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, to: site.email, subject: "[Neocities] Supporter plan has ended", body: Tilt.new('./views/templates/email/supporter_ended.erb', pretty: true).render(self) @@ -112,7 +92,7 @@ post '/webhooks/stripe' do invoice_obj = event['data']['object'] EmailWorker.perform_async({ - from: 'web@neocities.org', + from: Site::FROM_EMAIL, to: site.email, subject: "[Neocities] Invoice", body: Tilt.new('./views/templates/email/invoice.erb', pretty: true).render( @@ -127,7 +107,6 @@ post '/webhooks/stripe' do end end - 'ok' end diff --git a/app_helpers.rb b/app_helpers.rb index 933584c3..8c3f19f4 100644 --- a/app_helpers.rb +++ b/app_helpers.rb @@ -85,7 +85,7 @@ def send_confirmation_email(site=current_site) EmailWorker.perform_async({ from: 'web@neocities.org', - reply_to: 'contact@neocities.org', + reply_to: 'noreply@neocities.org', to: site.email, subject: "[Neocities] Confirm your email address", body: Tilt.new('./views/templates/email/confirm.erb', pretty: true).render(self, site: site) diff --git a/config.yml.ci b/config.yml.ci index e6912228..39b388d8 100644 --- a/config.yml.ci +++ b/config.yml.ci @@ -29,3 +29,4 @@ minfraud_license_key: DERPDERPDERP google_custom_search_key: herpderp google_custom_search_cx: herpderp google_custom_search_query_limit: 69 +support_email: derp@example.com \ No newline at end of file diff --git a/config.yml.template b/config.yml.template index a790d98f..2a00ab14 100644 --- a/config.yml.template +++ b/config.yml.template @@ -31,6 +31,7 @@ development: google_custom_search_key: herpderp google_custom_search_cx: herpderp google_custom_search_query_limit: 69 + support_email: derp@example.com test: database: 'postgres://localhost/neocities_test' database_pool: 1 @@ -67,4 +68,5 @@ test: minfraud_license_key: DERPDERPDERP google_custom_search_key: herpderp google_custom_search_cx: herpderp - google_custom_search_query_limit: 69 \ No newline at end of file + google_custom_search_query_limit: 69 + support_email: derp@example.com \ No newline at end of file diff --git a/models/site.rb b/models/site.rb index 0d560af6..bedfccbb 100644 --- a/models/site.rb +++ b/models/site.rb @@ -121,7 +121,7 @@ class Site < Sequel::Model IP_CREATE_LIMIT = 1000 TOTAL_IP_CREATE_LIMIT = 10000 - FROM_EMAIL = 'noreply@neocities.org' + FROM_EMAIL = 'Neocities ' PLAN_FEATURES = {}