Commit Graph

37 Commits

Author SHA1 Message Date
rubic0n 006322cff7 Remove Hash allocation
merge! takes a Hash as an argument. Rather than allocating a Hash,
just use two different `=` calls, to achieve the same result.
2021-02-18 00:35:31 -06:00
rubic0n a623252c59 Convert to boolean in C code
casecmp?(str) is 1.5x faster than casecmp(str).zero?
It's 1 less method call in Ruby, and the C code can convert
to boolean, rather than returning a number and determining
if it's zero.
2021-02-17 23:25:10 -06:00
Fosco Marotto 88d8bd2816 Merge remote-tracking branch 'origin/load_rails_6_0_defaults' into develop 2021-02-16 15:10:01 -05:00
Free Speech Forever 92c9092abd Avoid redundant OAuth queries when not signed in
If you aren't signed in, you don't have an auth token.
When you don't have an auth token, React was sending the headers

"Authorization: Bearer null"

This caused 5 Doorkeeper token lookups using
WHERE "oauth_access_tokens"."token" = 'null'
on the Explore page (the root of the app when not signed in).
2021-02-15 23:26:00 +00:00
Fosco Marotto 729c00a5a9 Bundle of corrections and one doorkeeper writing role change 2021-02-09 22:32:24 -05:00
Free Speech Forever 473c48b2aa Replace Makara with an initial Rails 6 role based splitting method. 2021-02-09 19:38:10 +00:00
rubic0n 87c41ede7a Load Rails 6.0 defaults and remove 6.0 migration initializer 2021-01-31 17:39:13 -06:00
rubic0n 8c018b8088 Don't autoload in initializers: SidekiqErrorHandler
DEPRECATION WARNING: Initialization autoloaded the constant
SidekiqErrorHandler.
2021-01-31 17:39:13 -06:00
rubic0n 497ec0c1db Teach Zeitwerk that REST is the class name, not Rest
Also add a comment about the inflector settings.

NameError: uninitialized constant InitialStateSerializer::REST
Did you mean?  Rest
/vagrant/app/serializers/initial_state_serializer.rb:7:in `<class:InitialStateSerializer>'
/vagrant/app/serializers/initial_state_serializer.rb:3:in `<main>'
2021-01-31 17:39:13 -06:00
rubic0n f77fa3ca4a Fix autoloading in initialization
DEPRECATION WARNING: Initialization autoloaded the constants
ActionText::ContentHelper and ActionText::TagHelper.

https://github.com/rails/rails/issues/36546

Rails has a Railtie that will take the config setting out of Rails
config, and put it onto ActionController when ActionController is
loaded. Calling ActionController in the initializer forces it to
autoload right now. Referencing the setting through the config allows
it to autoload in when it needs to.
2021-01-31 17:04:58 -06:00
rubic0n 2f95b0d67e Enable remaining settings
- use_cookies_with_metadata
  Provided extra options for cookies. Existing cookies will work fine.
  https://github.com/rails/rails/issues/36546
- return_only_media_type_on_content_type
  Include the charset in the content type. Looking at the headers that
  are being returned, it already did this.
- Use Zeitwerk as the autoloader
  https://github.com/fxn/zeitwerk
2021-01-31 17:04:58 -06:00
rubic0n 28beb28a78 Upgrade to Rails 6
- Added listen gem because rails app:update failed without it
- Removes nsa gem because it requires activesupport < 6
  Oddly, there's a newer version per GitHub that's not on RubyGems
  that raises the requirement to < 7. But, we need a new release
  before we can use that.
- Upgrade rails-i18n to v6, for Rails 6 compatibility
- Remove redis-rails since it requires Rails < 6, but we can just use
  the regular Rails :redis_cache_store that was introduced in 5.2.
- Run `rails app:update`
  - Had to weed through the `config/environments` changes to pick up
    newly added settings, while not losing settings that were
    intentionally configured
  - This generated config/initializers/new_framework_defaults_6_0.rb.
    The goal is to uncomment all of the settings in that file. Once
    they're all uncommented, delete the file and edit
    config/application.rb's load_defaults to be 6.0.
  - force_ssl controller method is deprecated in favor of a Rails
    config setting.
  - bin/setup was generated by Rails
  - Verbose query logging in development is really helpful. It shows
    you what line of code caused a query to execute.
  - Calling establish_connection after worker boot isn't necessary
    with ActiveRecord anymore. ActiveRecord handles it gracefully.
  - Rails generated a migration to add a foreign key for ActiveStorage.
    Gab currently doesn't use ActiveStorage, and instead uses Paperclip
    (since ActiveStorage didn't exist when Mastadon started). So, this
    change isn't relevant to Gab.
- Added ` || ''` in the profiles controller, because I was unable
  to save a change to a newly created profile. (This probably
  explains the 500 error I received on prod Gab recently.)
2021-01-23 09:01:31 -06:00
Fosco Marotto c9da516af6 Update hiredis driver and add a default REDIS_POOL_SIZE 2021-01-16 13:22:15 -05:00
mgabdev 7c6ef8bb9d Removed some Rack configs and moved RackAttack rate limits, headers
• Removed:
- some Rack configs and moved RackAttack rate limits, headers
2021-01-14 13:37:38 -05:00
admin 1ed29ddd53 Update redis.rb 2021-01-14 04:33:49 +00:00
mgabdev 8d3ebdd983 Updated rack_attack with few new limits and organization
• Updated:
- rack_attack with few new limits: 20x1d chat conversation creates, 60x10m searches, un auth api 150x5m
- organized all throttles in file, added comments
2021-01-13 12:01:47 -05:00
mgabdev 75d52c841e Progress 2020-12-15 19:31:30 -05:00
mgabdev 9a43c51085 Progress on dms, code cleanup
Progress on dms, code cleanup
2020-12-02 23:22:51 -05:00
mgabdev 20d4fc09af Merge branch 'develop' of https://code.gab.com/gab/social/gab-social into feature/removing_ruby_junk 2020-11-25 16:43:09 -06:00
Fosco Marotto 9ae186eb69 [paperclip] increase http read timeout 2020-11-22 16:32:34 -08:00
admin 2a9bec5ec2 Update to sidekiq 6.0 2020-11-15 20:46:54 +00:00
mgabdev fb612f60c8 Commiting 2020-11-15 12:48:32 -06:00
mgabdev 1ef59c2266 Updates to fixes for deploy
• Updates:
- to fixes for deploy
2020-11-09 16:19:04 -06:00
mgabdev 3c07e9d63b Added new security question to sign up, Added notification for unconfirmed emails
• Added:
- new security question to sign up
- notification for unconfirmed emails
- modal for describing issue with Gab emails
2020-10-16 16:25:37 -05:00
mgabdev 6d85c76c8f Added ability to set password for groups
• Added:
- ability to set password for groups
- GroupPasswordModal
- checks for if has password
- rate limiting in rack_attack
2020-09-11 17:27:00 -05:00
mgabdev 13af58da7a Added bookmarks
• Added:
- bookmarks for GabPRO members only
- migration for creation of StatusBookmarks
- all necessary routes, controllers
- redux for adding, removing, fetching and displaying bookmarks
- bookmark icon
- doorkeeper scopes
- backend and frontend support

Bookmarks behave like likes/favorites, except they aren't shared with other users and do not have an associated counter.

dfea7368c9
2020-07-24 18:48:31 -05:00
mgabdev 429bb277e9 Updated reset_password_within expiration to 24 hours
• Updated:
- reset_password_within expiration to 24 hours
2020-06-18 15:13:41 -04:00
mgabdev 8e349c368c Progress 2020-05-01 01:50:27 -04:00
mgabdev 80d41b8d94 Progress 2020-04-01 23:17:21 -04:00
mgabdev 331ae0ca38 Edits for chat button 2020-02-04 21:25:33 -05:00
Rob Colbert 4efa4f2c94 also allow openplatform.us to embed 2019-11-21 07:16:37 -05:00
Rob Colbert 5f19ac66ea let *.gab.com <iframe> gab.com as needed for OAuth2 sequences 2019-11-21 07:00:20 -05:00
admin 7a7f425bc7 Revert "compensate for lack of SMTP relay"
This reverts commit 4c3a602e11
2019-09-20 02:32:57 +00:00
Rob Colbert 4c3a602e11 compensate for lack of SMTP relay 2019-08-21 00:44:24 -04:00
robcolbert 5443767b3f adapt remote_ip determination for CF 2019-07-04 04:05:34 -04:00
robcolbert 80d47a33a4 adjust throttling 2019-07-04 03:55:50 -04:00
robcolbert bd0b5afc92 Gab Social. All are welcome. 2019-07-02 03:10:25 -04:00