179 Commits

Author SHA1 Message Date
Logan Fick
ccc3f11bff Merged pull request #58. 2019-04-02 17:40:20 -04:00
Tadhg
2fd545ae92 Merge pull request #1 from Aberdeener/Aberdeener-patch-1
Changed to Search All Threads
2019-04-02 14:35:48 -07:00
Tadhg
94108c1b14 Changed to Search All Threads 2019-04-02 14:35:14 -07:00
Logan Fick
6ef42dc331 Merged pull request #57. 2019-03-01 12:56:10 -05:00
Futseh
52659dd446 You can now update a profile even if the discord field is empty 2019-03-01 18:47:45 +01:00
Futseh
b8c862c43b Removed the regex validation for discord name 2019-03-01 18:23:27 +01:00
Logan Fick
32e7b99b6d Merged pull request #56. 2019-02-24 13:01:53 -05:00
Futseh
2fe1cead68 Added an extra layer of security towards not deleting threads 2019-02-24 18:55:33 +01:00
Futseh
d52bf6d586 This got removed for some reason, will look into it 2019-02-24 18:27:09 +01:00
Futseh
f6cb866b85 Can disable the oppurtunity to delete threads in the forums 2019-02-24 18:17:46 +01:00
Futseh
20ef79278f Doesn't work yet, but are close 2019-02-24 18:14:34 +01:00
Logan Fick
244a047cad Merged pull request #55. 2019-02-23 13:56:59 -05:00
Logan Fick
293e86ee67 Merged pull request #54. 2019-02-23 13:53:18 -05:00
Futseh
9870b0e4a9 Merge pull request #3 from Futseh/changes_to_users
Changed the colour of the resend mail button to better fit our theme
2019-02-22 19:25:19 +01:00
Futseh
6bfdf30f07 Changed the colour of the resend mail button to better fit our theme 2019-02-22 19:23:42 +01:00
Futseh
87d620fc41 Merge pull request #2 from Futseh/changes_to_users
Validates that the discord name is valid
2019-02-22 19:09:09 +01:00
Futseh
1c9f62fb97 Validates that the discord name is valid 2019-02-22 19:07:34 +01:00
Futseh
0b9f49e491 Merge pull request #1 from Futseh/changes_to_users
Removed skype added discord for users
2019-02-22 16:48:45 +01:00
Futseh
b3a3473923 Removed skype field and added Discord on users. Also dropped unused table 2019-02-22 16:44:25 +01:00
Logan Fick
7bae0042a0 Licensed redstoner.com under Creative Commons Zero v1.0 Universal. 2019-02-12 09:22:28 -05:00
Logan Fick
a4535e6565 Fixed Linguist detecting repository language as HTML. 2019-02-12 09:09:16 -05:00
Minenash
7316f07b88 Update donate.html.erb 2019-01-30 11:53:16 -05:00
Logan Fick
ef1997ac90 Updated multiple gems. 2018-11-20 17:29:25 -05:00
Logan Fick
ed7ef61c64 Merged pull request #53. 2018-11-11 16:27:00 -05:00
Minenash
10e10a72be Updated donor name. 2018-11-11 13:11:36 -05:00
Logan Fick
0f52de4e63 Updated multiple gems. 2018-11-04 21:13:50 -05:00
Logan Fick
4942e85e97 Updated Capistrano version lock. 2018-10-08 19:12:15 -04:00
Logan Fick
895d99300a Removed Slack image from footer. 2018-10-08 19:09:15 -04:00
Logan Fick
41bec1341d Updated multiple gems. 2018-10-08 19:06:40 -04:00
Logan Fick
7d6f7fcb07 Fixed issue #52. 2018-10-08 18:47:49 -04:00
Logan Fick
0de6b08b4e Removed hostnames from user profiles. 2018-09-13 20:48:24 -04:00
Logan Fick
f3908410c8 Updated paths for online players and banned players JSON files. 2018-07-26 11:53:37 -04:00
Logan Fick
5054ec209d Fixed usage of old logging directory. 2018-07-25 22:26:33 -04:00
Logan Fick
004152dcbd Fixed usage of incorrect Ruby version number. 2018-07-25 22:25:35 -04:00
Logan Fick
fa7b5dc3bd Upgraded Ruby and moved installation directory. 2018-07-25 15:38:27 -04:00
Logan Fick
a363862d38 Added Discord link to footer. 2018-07-22 18:30:26 -04:00
Logan Fick
9b3ae8b399 Removed warnings from website settings. 2018-06-10 21:31:26 -04:00
Logan Fick
37be5f56b6 Merged pull request #50. 2018-06-10 21:08:22 -04:00
Logan Fick
09e3312cca Made formatting more consistent. 2018-06-09 13:02:43 -04:00
Logan Fick
12efb76930 Added enforcement for requirement of staff members having 2FA enabled. 2018-06-09 12:56:06 -04:00
Logan Fick
8158520bcc Made login settings page title and buttons leading to it consistent. 2018-06-07 22:11:58 -04:00
Logan Fick
e8038a5416 Fixed 2FA enforcement on login screen. 2018-06-07 21:51:54 -04:00
Logan Fick
e3eaccd430 Added ability to configure 2FA settings in login settings. 2018-06-07 21:45:02 -04:00
Logan Fick
4a49bae011 Fixed name inconsistency between migration and schema. 2018-06-07 20:47:28 -04:00
Logan Fick
ce8cb6f4ae Renamed TOTP secret column in schema. 2018-06-07 20:43:51 -04:00
Logan Fick
1d1b66f4a0 Fixed incorrect function name. 2018-06-07 20:37:58 -04:00
Logan Fick
6d22462d7a Added TOTP field to login screen. 2018-06-07 20:31:11 -04:00
Logan Fick
a241749ee3 Added TOTP toggle status to schema. 2018-06-07 20:27:13 -04:00
Logan Fick
201e59964e Cleaned up schema. 2018-06-06 18:44:31 -04:00
Logan Fick
7eeccbc006 Installed TOTP gem and added TOTP column to schema. 2018-06-06 18:38:28 -04:00
Logan Fick
3d8199c9f9 Reverted messy attempt at switch to Puma as app server. 2018-05-27 18:09:46 -04:00
Logan Fick
8f16fd709d Changed location that Puma binds to. 2018-05-27 16:23:51 -04:00
Logan Fick
e1bfa25e09 Added missing items in Puma config file. 2018-05-27 16:19:36 -04:00
Logan Fick
4f4d3834d2 Made Capistrano use Puma tasks. 2018-05-19 12:30:28 -04:00
Logan Fick
8e534e3330 Switched to using Puma as the app server. 2018-05-19 12:15:20 -04:00
Logan Fick
0d9663e70b Updated multiple gems. 2018-04-27 17:05:40 -04:00
Logan Fick
240d7e1e58 Fixed syntax error. 2018-04-23 21:41:23 -04:00
Logan Fick
f7206dc888 Changed the sender name for emails. 2018-04-23 21:20:55 -04:00
Logan Fick
806dbba92c Changed the contact email address in emails. 2018-04-21 12:08:42 -04:00
Logan Fick
87778aded5 Changed the from and reply to email addresses. 2018-04-21 12:00:30 -04:00
Logan Fick
e9f46813de Moved SMTP settings to environment variables. 2018-04-21 11:52:21 -04:00
Logan Fick
14dfc4c1cd Reverted back to regular logo and server name. 2018-04-01 18:01:26 -04:00
Logan Fick
4810065e58 Fixed use of incorrect new logo on home page. 2018-03-31 20:05:21 -04:00
Logan Fick
5852ef06ff Fixed inconsistent logos on dual logo image. 2018-03-31 20:01:05 -04:00
Logan Fick
5b97df57c8 Fixed use of incorrect logo and server name. 2018-03-31 19:54:48 -04:00
Logan Fick
d7ad2b04a5 Made Gemfile stop using fork of jquery-textcomplete-rails. 2018-03-21 11:03:19 -04:00
Logan Fick
8db1eb0b9b Fixed dependency version issues. 2018-03-21 10:51:04 -04:00
Logan Fick
5a3b330493 Updated multiple gems. 2018-03-21 10:32:31 -04:00
Logan Fick
16a2b0fa18 Made many buttons and titles more consistent. 2018-03-12 19:26:55 -04:00
Logan Fick
5eadded99c Reverted protocol upgrade. 2018-02-24 20:45:24 -05:00
Logan Fick
1df6347195 Upgraded protocol used to fetch gems from GitHub repositories. 2018-02-24 20:10:23 -05:00
Logan Fick
f6770ed275 Updated multiple gems. 2018-02-24 19:56:41 -05:00
Logan Fick
bc216cb5b9 Updated Ruby. 2018-02-24 19:30:09 -05:00
Logan Fick
e9d007b942 Updated Redcarpet. 2018-01-26 17:45:59 -05:00
Logan Fick
37557f6684 Updated Capistrano version lock. 2018-01-26 16:52:45 -05:00
Logan Fick
b9ad336ba9 Fixed dependency version issues. 2018-01-26 16:46:03 -05:00
Logan Fick
27aad9a486 Updated multiple gems. 2018-01-26 16:19:50 -05:00
Logan Fick
6c59e08d21 Updated nokogiri. 2018-01-26 09:45:41 -05:00
Logan Fick
df84114af2 Fixed rare circumstances causing internal server error when trying to sign up. 2017-12-17 14:05:13 -05:00
Logan Fick
3d260f9de0 Merge pull request #49. 2017-12-10 16:20:13 -05:00
Logan Fick
b40f85fe51 Changed capitalization of atom feed title. 2017-12-10 13:15:05 -05:00
Minenash
39fdd402f0 Update show.atom.builder 2017-12-10 12:59:13 -05:00
Logan Fick
9ec0a40027 Lowered amount of threads shown on forums atom feed. 2017-11-24 22:17:05 -05:00
Logan Fick
8796b3a415 Made user profile page show hostname of user's IP address. 2017-11-24 22:01:37 -05:00
Logan Fick
12baf8d5d7 Merge pull request #48. 2017-11-19 16:04:25 -05:00
Logan Fick
777ebca7f2 Added atom feed to forums. 2017-11-11 21:11:59 -05:00
Logan Fick
34cb9e9dfc Fix issue #47. 2017-11-04 15:38:33 -04:00
Logan Fick
8fbbe1b1a5 Removed caching from user profile pages. 2017-11-03 19:29:21 -04:00
Logan Fick
52e32808b5 Merge pull request #41. 2017-10-31 22:19:34 -04:00
Logan Fick
7ed1c2ac57 Fixed syntax error. 2017-10-31 22:03:15 -04:00
Logan Fick
b9dcf0ac63 Fixed user profile page returning internal server error if JSON file is missing. 2017-10-31 21:59:01 -04:00
Logan Fick
0646747780 Fixed formatting error on privacy policy. 2017-10-31 21:23:36 -04:00
Logan Fick
553b373d5e Added privacy policy. 2017-10-31 20:53:56 -04:00
MrYummy
3fb5924318 trimmed UUIDs from banned-players.json 2017-10-31 15:44:18 -04:00
Logan Fick
d70df0deef Merge pull request #46. 2017-10-29 20:24:14 -04:00
Logan Fick
3c7bfa9338 Changed the invalid data format error message. 2017-10-29 20:22:00 -04:00
Logan Fick
2d9fdcd802 Added backward compatibility for old data format. 2017-10-29 19:44:52 -04:00
MrYummy
7d766c8cf2 Optimized @players collection from json 2017-10-29 17:47:18 -04:00
Logan Fick
5b3b0fe3ef Increased minimum title length for forum groups and forums. 2017-10-28 21:48:14 -04:00
Logan Fick
7520efb683 Added validation for length of forum title. 2017-10-28 21:06:48 -04:00
Logan Fick
82b4dd5280 Added validation for length of blogpost title and content. 2017-10-28 20:56:05 -04:00
Logan Fick
9aad746649 Added validation for length of thread title. 2017-10-28 20:46:56 -04:00
Logan Fick
32c72ca016 Changed Google+ social link to Mastodon social link in emails. 2017-10-28 20:27:25 -04:00
Logan Fick
ea4799fc28 Made Who's Playing page hide vanished users from non-staff ranks. 2017-10-28 15:25:39 -04:00
Logan Fick
0093daedd9 Fixed name reuse check sometimes using wrong account to compare against. 2017-10-28 14:23:34 -04:00
Logan Fick
b1f739f6f8 Fixed the inability to update profile when not changing name. 2017-10-28 13:49:36 -04:00
MrYummy
2223f88d7b minor edits 2017-10-26 22:21:00 +02:00
Logan Fick
577961d122 Made use of jomo's patch to mail-gpg. 2017-10-25 22:59:01 -04:00
Logan Fick
ff61be48f7 Fixed Gemfile.lock not including mail-gpg. 2017-10-25 22:02:16 -04:00
Logan Fick
f66d6e9f13 Fixed the who's playing page error message staying for an extra request. 2017-10-22 16:40:06 -04:00
Logan Fick
61c1f36b50 Merge pull request #44. 2017-10-18 18:55:52 -04:00
Logan Fick
5ab615e18f Added public key validation. 2017-10-18 17:30:42 -04:00
Logan Fick
d2d64d20f0 Changed the public key usage informational text. 2017-10-18 17:17:08 -04:00
Logan Fick
91d6082d37 Fixed schema version number. 2017-10-18 17:06:41 -04:00
Logan Fick
1ec1c09490 Fixed schema version number. 2017-10-15 20:01:56 -04:00
Logan Fick
29ef493a1b Added title to donate page. 2017-10-15 15:58:06 -04:00
Logan Fick
8c99e9631b Added Mastodon and onion service links to footer. 2017-10-15 15:33:22 -04:00
Logan Fick
751462bbed Added public_key to schema. 2017-10-13 23:28:08 -04:00
Logan Fick
a6148790da Made notification emails get encrypted for accounts with a public key. 2017-10-13 22:49:54 -04:00
Logan Fick
3e7a0e550f Added ability to add public key to account. 2017-10-12 20:46:23 -04:00
Logan Fick
da2e66d0b8 Removed skype_public from schema and seeds. 2017-10-12 20:18:09 -04:00
Logan Fick
611c52223a Fixed who's playing page returning internal server error when server is offline. 2017-10-12 18:52:53 -04:00
Logan Fick
adf1966b97 Merge pull request #38. 2017-10-12 18:20:46 -04:00
Logan Fick
fd40ac82ff Merge pull request #34. 2017-10-12 18:04:31 -04:00
Logan Fick
a323613b9a Undid schema change. 2017-10-12 17:40:32 -04:00
Logan Fick
908e67482c Fixed the ability to receive reply emails on threads a user can no longer read. 2017-10-12 17:22:02 -04:00
Logan Fick
170f7bad54 Merge pull request #42. 2017-10-11 21:58:15 -04:00
Logan Fick
291c4fb568 Fixed grammar error. 2017-10-11 21:50:52 -04:00
Logan Fick
3f0bddeda3 Merge pull request #40. 2017-10-11 21:02:06 -04:00
Pepich
adf7108941 Merge pull request #43 from LogalDeveloper/whos-playing-path-patch
Changed the who's playing JSON file path.
2017-09-21 15:17:25 +02:00
Logan Fick
07b96a0c2d Changed the who's playing JSON file path. 2017-08-22 16:11:43 -04:00
Minenash
563aa376e3 Update donate.html.erb 2017-08-07 18:19:47 -04:00
MrYummy
bd85a2c3ae fixed spelling error 2017-08-06 13:32:21 +02:00
Logan Fick
e5e8caf38e Fixed staff link in emails going to wrong URL. 2017-07-31 19:24:39 -04:00
Logan Fick
faeba0ec70 Fixed grammar error. 2017-07-31 16:04:23 -04:00
Logan Fick
6aee102114 Fixed list of donators link not including donorplus badge. 2017-07-31 15:41:37 -04:00
MrYummy
5f17385343 Fixed error when a user sets their name to that of another 2017-07-11 03:59:19 +02:00
MrYummy
767084cc2f removed skype_public column from users 2017-07-08 03:53:56 +02:00
MrYummy
2819989b72 Added total_count to thread result number (pt. 2) 2017-07-06 20:08:48 -04:00
jomo
8c6eb8ac17 more fixes for order of threadreplies 2017-07-07 02:05:04 +02:00
jomo
72a6dcc54a order by id instead of created_at
id is indexed while created_at is not
2017-07-07 01:57:30 +02:00
MrYummy
4e1b6b430b limited params in params_list to the 6 queries 2017-07-04 22:57:31 +02:00
MrYummy
f90257fe73 Explicitly stated order of threadreplies 2017-07-04 09:23:01 -04:00
MrYummy
9b64c2c6d9 Thread index now counts all threads on all pages 2017-07-02 23:23:24 -04:00
MrYummy
170fba42db Added "All staff" as title when doing user filter 2017-07-02 21:21:19 -04:00
jomo
12fb7584bc allow staff search with empty parameter value 2017-07-03 03:17:27 +02:00
MrYummy
a8ffba8f8b fixed issue with ?staff part 2 2017-07-02 21:15:55 -04:00
MrYummy
fcdcbe2514 fixed issue with ?staff 2017-07-02 21:13:43 -04:00
jomo
496e08393a fix user search 2017-07-03 03:05:10 +02:00
jomo
b225dc57b2 add index forumthread_id on threadreplies 2017-07-03 02:47:51 +02:00
jomo
b84db2bc87 fix typo 2017-07-03 02:03:55 +02:00
jomo
43cee7d2e0 only link to badge if badge exists 2017-07-03 02:03:16 +02:00
MrYummy
1ec464a4fc utilized @user variable 2017-06-21 01:19:02 +02:00
MrYummy
8dc051ea46 Added ban reason and expiration date to user pages 2017-06-20 16:22:56 +02:00
MrYummy
bcc1f192f5 Added warning for replies on closed threads 2017-06-18 22:44:03 +02:00
MrYummy
5e4e6583bb Added action_caching gem to Gemfile.lock 2017-06-18 13:11:36 -04:00
MrYummy
6d70fd3309 made some small aesthetic changes 2017-06-18 13:11:36 -04:00
MrYummy
b73ba5d739 removed user 'donor?' method and changed default badge_id from 0 to 1 2017-06-18 13:11:36 -04:00
MrYummy
91169ab103 removed '#forumthreads_controller.rb#' 2017-06-18 13:11:36 -04:00
MrYummy
65f7c3c97f Made the default badge of 'create_admin_user' none 2017-06-18 13:11:36 -04:00
MrYummy
1e267a64fb Addded default badge 'none' and enforced badges 2017-06-18 13:11:36 -04:00
MrYummy
9837f12b59 allowed role and badge filtering, made User.search take Role and Badge as params 2017-06-18 13:11:36 -04:00
MrYummy
d2de01100a moved all search styling to CSS, removed friendly (but slow) URLs, moved WHERE strings into an array 2017-06-18 13:11:36 -04:00
MrYummy
4619306744 Added Donator+ perk (/lol id) to the 'Donate' page and fixed spelling error on signup page ('singing' => 'signing') 2017-06-18 13:11:36 -04:00
MrYummy
1b8744abdb Changed 'Who's Playing' code to handle revised JSON format 2017-06-18 13:11:36 -04:00
MrYummy
617890c209 badge migration now contains default badges and creation of badge table 2017-06-18 13:11:36 -04:00
MrYummy
79ad8b201e Changed 'no badge' check to be more reliable, added rake task for creating superadmin users 2017-06-18 13:11:36 -04:00
MrYummy
b99e62b7e7 Removed all trace of search_redirect, included blanks for forum and label filters 2017-06-18 13:11:36 -04:00
MrYummy
0c939f044c removed passing of useless params, updated placeholder for user textcomplete 2017-06-18 13:11:36 -04:00
MrYummy
deba1b76e3 Updated find_by methods 2017-06-18 13:11:36 -04:00
MrYummy
e2a16f3ae6 ordered searching to match SQL clauses, moved role&badge filtering to User.search 2017-06-18 13:11:36 -04:00
MrYummy
a250c411eb Added CSS for index search fields and revised regex for author search 2017-06-18 13:11:36 -04:00
MrYummy
4105f1c61f fixed action caching 2017-06-18 13:11:36 -04:00
MrYummy
1316d7ca03 Added Searching Features
* Added Thread Search Feature

* Added User Search Feature

* Re-organized searching, added @mention support to author search
2017-06-18 13:11:36 -04:00
MrYummy
e7463524af Added Who's Playing? screen 2017-06-18 13:11:36 -04:00
MrYummy
a24d26dd7c Added Website Settings 2017-06-18 13:11:36 -04:00
MrYummy
db3aea185b Added Reply Reversal And Toggle 2017-06-18 13:11:36 -04:00
MrYummy
2c02a797b8 Added Necropost Warning 2017-06-18 13:11:36 -04:00
MrYummy
1b4a270038 Added badge system 2017-06-18 13:11:36 -04:00
103 changed files with 1499 additions and 439 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
public/* linguist-vendored

View File

@@ -7,14 +7,17 @@ gem 'jquery-rails'
gem 'bcrypt' # To use ActiveModel's has_secure_password
gem 'sanitize'
gem 'strip_attributes'
gem 'redcarpet', '~> 3.2.3'
gem 'redcarpet'
gem 'hirb' # pretty console output
gem 'rb-readline'
gem 'rest-client'
gem 'activerecord-session_store'
gem 'highlight_js-rails', github: 'RedstonerServer/highlight_js-rails'
gem 'kaminari', github: 'jomo/kaminari', branch: 'patch-2' # pagination
gem 'jquery-textcomplete-rails', github: 'RedstonerServer/jquery-textcomplete-rails' # @mentions
gem 'jquery-textcomplete-rails' # @mentions
gem 'actionpack-action_caching', github: 'antulik/actionpack-action_caching', ref: '8c6e52c69315d67437f480da5dce4b7c8737fb32'
gem 'mail-gpg', github: 'jomo/mail-gpg', ref: 'a666b48ee866dfa3eaa700f9c5edf4d195d0f8c9'
gem 'totp'
# Gems used only for assets and not required
# in production environments by default.

View File

@@ -6,13 +6,12 @@ GIT
rails (>= 3.1.1)
GIT
remote: git://github.com/RedstonerServer/jquery-textcomplete-rails.git
revision: 8bf23af2d8fa1c5226c2b6889c7796adfe1f8772
remote: git://github.com/antulik/actionpack-action_caching.git
revision: 8c6e52c69315d67437f480da5dce4b7c8737fb32
ref: 8c6e52c69315d67437f480da5dce4b7c8737fb32
specs:
jquery-textcomplete-rails (0.1.4)
coffee-rails (>= 3.2.0)
railties (>= 3.2.0)
sass-rails (>= 3.2.0)
actionpack-action_caching (1.2.0)
actionpack (>= 4.0.0, < 6)
GIT
remote: git://github.com/jomo/kaminari.git
@@ -23,206 +22,241 @@ GIT
actionpack (>= 3.0.0)
activesupport (>= 3.0.0)
GIT
remote: git://github.com/jomo/mail-gpg.git
revision: a666b48ee866dfa3eaa700f9c5edf4d195d0f8c9
ref: a666b48ee866dfa3eaa700f9c5edf4d195d0f8c9
specs:
mail-gpg (0.3.1)
gpgme (~> 2.0, >= 2.0.2)
mail (~> 2.5, >= 2.5.3)
GIT
remote: git://github.com/rails/rails.git
revision: 2c8f567e53580872d8c6dfe61201e58793ca131e
revision: 22aec58a2565a76e0f55d05d045b7a45715c5bb9
branch: 4-2-stable
specs:
actionmailer (4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
actionmailer (4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5)
actionpack (4.2.5.1)
actionview (= 4.2.5.1)
activesupport (= 4.2.5.1)
actionpack (4.2.10)
actionview (= 4.2.10)
activesupport (= 4.2.10)
rack (~> 1.6)
rack-test (~> 0.6.2)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.1)
activesupport (= 4.2.5.1)
actionview (4.2.10)
activesupport (= 4.2.10)
builder (~> 3.1)
erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5)
rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5.1)
activesupport (= 4.2.5.1)
rails-html-sanitizer (~> 1.0, >= 1.0.3)
activejob (4.2.10)
activesupport (= 4.2.10)
globalid (>= 0.3.0)
activemodel (4.2.5.1)
activesupport (= 4.2.5.1)
activemodel (4.2.10)
activesupport (= 4.2.10)
builder (~> 3.1)
activerecord (4.2.5.1)
activemodel (= 4.2.5.1)
activesupport (= 4.2.5.1)
activerecord (4.2.10)
activemodel (= 4.2.10)
activesupport (= 4.2.10)
arel (~> 6.0)
activesupport (4.2.5.1)
activesupport (4.2.10)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
rails (4.2.5.1)
actionmailer (= 4.2.5.1)
actionpack (= 4.2.5.1)
actionview (= 4.2.5.1)
activejob (= 4.2.5.1)
activemodel (= 4.2.5.1)
activerecord (= 4.2.5.1)
activesupport (= 4.2.5.1)
rails (4.2.10)
actionmailer (= 4.2.10)
actionpack (= 4.2.10)
actionview (= 4.2.10)
activejob (= 4.2.10)
activemodel (= 4.2.10)
activerecord (= 4.2.10)
activesupport (= 4.2.10)
bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.1)
railties (= 4.2.10)
sprockets-rails
railties (4.2.5.1)
actionpack (= 4.2.5.1)
activesupport (= 4.2.5.1)
railties (4.2.10)
actionpack (= 4.2.10)
activesupport (= 4.2.10)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
GEM
remote: https://rubygems.org/
specs:
activerecord-session_store (0.1.2)
actionpack (>= 4.0.0, < 5)
activerecord (>= 4.0.0, < 5)
railties (>= 4.0.0, < 5)
arel (6.0.3)
bcrypt (3.1.10)
better_errors (2.1.1)
activerecord-session_store (1.1.1)
actionpack (>= 4.0)
activerecord (>= 4.0)
multi_json (~> 1.11, >= 1.11.2)
rack (>= 1.5.2, < 3)
railties (>= 4.0)
airbrussh (1.3.1)
sshkit (>= 1.6.1, != 1.7.0)
arel (6.0.4)
base32 (0.3.2)
bcrypt (3.1.12)
better_errors (2.5.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
erubi (>= 1.0.0)
rack (>= 0.9.0)
binding_of_caller (0.7.2)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
builder (3.2.2)
capistrano (3.4.0)
builder (3.2.3)
capistrano (3.11.0)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (~> 1.3)
sshkit (>= 1.9.0)
capistrano-bundler (1.1.4)
capistrano (~> 3.1)
sshkit (~> 1.2)
capistrano-rails (1.1.6)
capistrano-rails (1.1.8)
capistrano (~> 3.1)
capistrano-bundler (~> 1.1)
capistrano-rbenv (2.0.4)
capistrano-rbenv (2.1.4)
capistrano (~> 3.1)
sshkit (~> 1.3)
choice (0.2.0)
coderay (1.1.0)
coffee-rails (4.1.1)
coderay (1.1.2)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.1.x)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.0)
crass (1.0.2)
debug_inspector (0.0.2)
domain_name (0.5.25)
coffee-script-source (1.12.2)
concurrent-ruby (1.1.3)
crass (1.0.4)
debug_inspector (0.0.3)
domain_name (0.5.20180417)
unf (>= 0.0.5, < 1.0.0)
erubi (1.7.1)
erubis (2.7.0)
execjs (2.6.0)
globalid (0.3.6)
activesupport (>= 4.1.0)
execjs (2.7.0)
ffi (1.9.25)
globalid (0.4.1)
activesupport (>= 4.2.0)
gpgme (2.0.16)
mini_portile2 (~> 2.3)
hirb (0.7.3)
http-cookie (1.0.2)
http-cookie (1.0.3)
domain_name (~> 0.5)
i18n (0.7.0)
jquery-rails (4.1.0)
rails-dom-testing (~> 1.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jquery-rails (4.3.3)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
kgio (2.10.0)
loofah (2.0.3)
jquery-textcomplete-rails (0.1.5)
coffee-rails (>= 3.2.0)
railties (>= 3.2.0)
sass-rails (>= 3.2.0)
kgio (2.11.2)
loofah (2.2.3)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.6.3)
mime-types (>= 1.16, < 3)
mime-types (2.99)
mini_portile2 (2.0.0)
minitest (5.8.4)
mysql2 (0.4.2)
mail (2.7.1)
mini_mime (>= 0.1.1)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2018.0812)
mini_mime (1.0.1)
mini_portile2 (2.3.0)
minitest (5.11.3)
multi_json (1.13.1)
mysql2 (0.5.2)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.0.2)
net-ssh (5.0.2)
netrc (0.11.0)
nokogiri (1.6.7.2)
mini_portile2 (~> 2.0.0.rc2)
nokogumbo (1.4.7)
nokogiri
rack (1.6.4)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
nokogumbo (2.0.1)
nokogiri (~> 1.8, >= 1.8.4)
rack (1.6.11)
rack-test (0.6.3)
rack (>= 1.0)
rails-deprecated_sanitizer (1.0.3)
activesupport (>= 4.2.0.alpha)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0)
rails-dom-testing (1.0.9)
activesupport (>= 4.2.0, < 5.0)
nokogiri (~> 1.6)
rails-deprecated_sanitizer (>= 1.0.1)
rails-erd (1.4.5)
rails-erd (1.5.2)
activerecord (>= 3.2)
activesupport (>= 3.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.0.3)
loofah (~> 2.0)
raindrops (0.15.0)
rake (10.5.0)
rb-readline (0.5.3)
redcarpet (3.2.3)
rest-client (1.8.0)
rails-html-sanitizer (1.0.4)
loofah (~> 2.2, >= 2.2.2)
raindrops (0.19.0)
rake (12.3.2)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rb-readline (0.5.5)
redcarpet (3.4.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2, < 2.0)
mime-types (>= 1.16, < 3.0)
netrc (~> 0.7)
ruby-graphviz (1.2.2)
sanitize (4.0.1)
mime-types (>= 1.16, < 4.0)
netrc (~> 0.8)
ruby-graphviz (1.2.4)
sanitize (5.0.0)
crass (~> 1.0.2)
nokogiri (>= 1.4.4)
nokogumbo (~> 1.4.1)
sass (3.4.21)
sass-rails (5.0.4)
railties (>= 4.0.0, < 5.0)
nokogiri (>= 1.8.0)
nokogumbo (~> 2.0)
sass (3.7.2)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0, < 6)
sass (~> 3.1)
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
sprockets (3.5.2)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.0.0)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sqlite3 (1.3.11)
sshkit (1.8.1)
sqlite3 (1.3.13)
sshkit (1.18.0)
net-scp (>= 1.1.2)
net-ssh (>= 2.8.0)
strip_attributes (1.7.1)
activemodel (>= 3.0, < 5.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.2)
tzinfo (1.2.2)
strip_attributes (1.8.0)
activemodel (>= 3.0, < 6.0)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.8)
totp (1.0.0)
base32
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (2.7.2)
execjs (>= 0.3.0)
json (>= 1.8.0)
uglifier (4.1.20)
execjs (>= 0.3.0, < 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.1)
unicorn (5.0.1)
unf_ext (0.0.7.5)
unicorn (5.4.1)
kgio (~> 2.6)
rack
raindrops (~> 0.7)
webrick (1.3.1)
webrick (1.4.2)
PLATFORMS
ruby
DEPENDENCIES
actionpack-action_caching!
activerecord-session_store
bcrypt
better_errors
@@ -233,22 +267,24 @@ DEPENDENCIES
highlight_js-rails!
hirb
jquery-rails
jquery-textcomplete-rails!
jquery-textcomplete-rails
kaminari!
mail-gpg!
mysql2
rails!
rails-erd
rb-readline
redcarpet (~> 3.2.3)
redcarpet
rest-client
sanitize
sass-rails
sqlite3
strip_attributes
totp
tzinfo-data
uglifier
unicorn
webrick
BUNDLED WITH
1.11.2
1.17.3

116
LICENSE.txt Normal file
View File

@@ -0,0 +1,116 @@
CC0 1.0 Universal
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator and
subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for the
purpose of contributing to a commons of creative, cultural and scientific
works ("Commons") that the public can reliably and without fear of later
claims of infringement build upon, modify, incorporate in other works, reuse
and redistribute as freely as possible in any form whatsoever and for any
purposes, including without limitation commercial purposes. These owners may
contribute to the Commons to promote the ideal of a free culture and the
further production of creative, cultural and scientific works, or to gain
reputation or greater distribution for their Work in part through the use and
efforts of others.
For these and/or other purposes and motivations, and without any expectation
of additional consideration or compensation, the person associating CC0 with a
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
and publicly distribute the Work under its terms, with knowledge of his or her
Copyright and Related Rights in the Work and the meaning and intended legal
effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not limited
to, the following:
i. the right to reproduce, adapt, distribute, perform, display, communicate,
and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or likeness
depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data in
a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation thereof,
including any amended or successor version of such directive); and
vii. other similar, equivalent or corresponding rights throughout the world
based on applicable law or treaty, and any national implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention of,
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
and Related Rights and associated claims and causes of action, whether now
known or unknown (including existing as well as future claims and causes of
action), in the Work (i) in all territories worldwide, (ii) for the maximum
duration provided by applicable law or treaty (including future time
extensions), (iii) in any current or future medium and for any number of
copies, and (iv) for any purpose whatsoever, including without limitation
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
the Waiver for the benefit of each member of the public at large and to the
detriment of Affirmer's heirs and successors, fully intending that such Waiver
shall not be subject to revocation, rescission, cancellation, termination, or
any other legal or equitable action to disrupt the quiet enjoyment of the Work
by the public as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason be
judged legally invalid or ineffective under applicable law, then the Waiver
shall be preserved to the maximum extent permitted taking into account
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
is so judged Affirmer hereby grants to each affected person a royalty-free,
non transferable, non sublicensable, non exclusive, irrevocable and
unconditional license to exercise Affirmer's Copyright and Related Rights in
the Work (i) in all territories worldwide, (ii) for the maximum duration
provided by applicable law or treaty (including future time extensions), (iii)
in any current or future medium and for any number of copies, and (iv) for any
purpose whatsoever, including without limitation commercial, advertising or
promotional purposes (the "License"). The License shall be deemed effective as
of the date CC0 was applied by Affirmer to the Work. Should any part of the
License for any reason be judged legally invalid or ineffective under
applicable law, such partial invalidity or ineffectiveness shall not
invalidate the remainder of the License, and in such case Affirmer hereby
affirms that he or she will not (i) exercise any of his or her remaining
Copyright and Related Rights in the Work or (ii) assert any associated claims
and causes of action with respect to the Work, in either case contrary to
Affirmer's express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or warranties
of any kind concerning the Work, express, implied, statutory or otherwise,
including without limitation warranties of title, merchantability, fitness
for a particular purpose, non infringement, or the absence of latent or
other defects, accuracy, or the present or absence of errors, whether or not
discoverable, all to the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without limitation
any person's Copyright and Related Rights in the Work. Further, Affirmer
disclaims responsibility for obtaining any necessary consents, permissions
or other rights required for any use of the Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to this
CC0 or use of the Work.
For more information, please see
<http://creativecommons.org/publicdomain/zero/1.0/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 315 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

BIN
app/assets/images/tor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 581 B

View File

@@ -88,5 +88,45 @@ $(function() {
}], {
debounce: 300
});
$('.md_editor .field_container_user .editor_field').textcomplete([{
// match up to 2 words (everything except some special characters)
// each word can have up to 16 characters (up to 32 total)
// words must be separated by a single space
match: /(^|\s)([^!"§$%&\/()=?.,;+*@\s]{1,16})$/,
search: function (text, callback, match) {
console.log("Searching " + text);
text = text.toLowerCase();
$.ajax("/users/suggestions", {
type: "post",
data: {name: text},
dataType: "json",
headers: {
"X-CSRF-Token": $('meta[name="csrf-token"]').attr("content")
},
success: function(data) {
callback(data);
},
error: function(xhr, status, err) {
console.error(err);
callback([]);
}
});
},
template: function(user) {
var name = user[0];
var ign = user[1];
if (name != ign) {
return name + " <small>(" + ign + ")</small>";
} else {
return ign;
}
},
cache: true,
replace: function (word) {
return "$1" + word[1] + " ";
}
}], {
debounce: 300
});
});

View File

@@ -0,0 +1,105 @@
body {
background-color:rgb(50, 50, 50);
text-shadow:none !important;
color:rgb(190, 190, 190) !important;
}
::selection {
background-color:rgb(100, 150, 255);
}
a {
color:rgb(203, 75, 22);
border-color:black !important;
}
a:hover {
color:rgb(215, 100, 40);
}
#main-content {
border-color:black !important;
padding:30px 100px;
box-shadow:none;
}
#main-content-scroll {
padding: 131px 100px;
border: 1px solid #000;
box-shadow: 0 0 5px #000;
}
hr {
background-color:black !important;
border-color:black !important;
}
code {
background-color:rgb(30, 30, 30) !important;
border-color:black !important;
color:white !important;
}
#head_top {
width:100%;
z-index:100;
}
#head_scroll {
@extend #head_top;
position: fixed;
width: 100%;
z-index: 1;
}
div#userbar {
background-color:rgb(90, 90, 90) !important;
border-color:black !important;
color:white !important;
text-shadow:none !important;
}
#head a {
text-shadow:none !important;
color:white !important;
}
#head a:hover {
color:rgb(190, 190, 190) !important;
}
.header {
background-color:rgb(0, 0, 0);
border:none !important;
}
input[type="email"], input[type="text"], input[type="password"] {
background-color:rgb(110, 110, 110) !important;
color:white !important;
}
::placeholder {
color:lightgray;
}
.item {
background-color:rgb(40, 40, 40) !important;
border-color:black !important;
}
.item-group {
border-color:black !important;
}
div.header {
background-color:rgb(20, 20, 20) !important;
}
.avatar {
border-color:black !important;
}
.items {
border-color:black !important;
}
.markdown-help {
background-color:rgb(90, 90, 90);
color:white;
border-color:black;
}
textarea {
background-color:rgb(100, 100, 100);
color:white;
}
.headline {
border-color:black !important;
}
.role {
opacity:0.7 !important;
}
.label {
opacity:0.7 !important;
}
.notice {
color:white;
}

View File

@@ -4,12 +4,12 @@
th, td {
// force tables into line-mode
// it's a bit ugly, but probably the best
// it''s a bit ugly, but probably the best
// solution for small screens
display: block;
}
#head {
#head_top {
#menu {
#logo {
display: none;
@@ -17,10 +17,19 @@
}
}
#head_scroll {
@extend #head_top;
position: fixed;
}
#main-content {
padding: 30px 5px;
}
#main-content-scroll {
padding: 181px 5px;
}
.front-page {
h1 {
font-size: 2em !important;

View File

@@ -80,7 +80,7 @@ a {
}
}
#head {
#head_top {
background: #3f3f3f;
#menu {
@@ -181,6 +181,13 @@ a {
}
}
#head_scroll {
@extend #head_top;
position: fixed;
width: 100%;
z-index: 1;
}
.front-page {
margin: auto;
text-align: center;
@@ -260,6 +267,11 @@ span.no-about {
}
}
#main-content-scroll {
@extend #main-content;
padding: 131px 100px;
}
#user-info {
.user-avatar {
margin-bottom: 30px;
@@ -437,18 +449,14 @@ blockquote p {
color: #ddd !important;
}
}
.donor {
color: #fff;
background: #f60 !important;
margin-left: 2px !important;
}
.ign {
display: block;
color: #000;
font-style: italic;
}
.badge {
margin-left: 2px !important;
}
}
#online-users {
@@ -458,6 +466,7 @@ blockquote p {
}
.md_editor {
.field_container {
position: relative;
@@ -465,7 +474,7 @@ blockquote p {
position: absolute;
top: 1em;
left: 1em;
z-index: 10;
z-index: 0;
}
.editor_field {
@@ -480,6 +489,10 @@ blockquote p {
padding: 4em 1em 1em;
}
}
.field_container_user {
.editor_field {
}
}
}
ul.dropdown-menu {
@@ -675,6 +688,13 @@ tr.spacer {
color: #ddd;
}
&.variable-size {
background: #4096ee;
@media only screen and (max-width: 500px) {
font-size: 9px;
}
}
&.blue {
background: #4096ee;
@@ -1027,3 +1047,19 @@ nav.pagination {
border-radius: 0.2em;
text-shadow: none;
}
.searchfield {
height:40px;
display: inline-block;
&.field {
width: 300px;
}
&.btn {
margin: 4px 1px 0 0;
cursor: default;
color: #fff;
font-size: 12px;
background: #4096ee;
width: 40px;
}
}

View File

@@ -1,6 +1,6 @@
class ApplicationController < ActionController::Base
protect_from_forgery
before_filter :update_ip, :update_seen, :check_banned
before_filter :update_ip, :update_seen, :check_banned, :check_2fa
# TODO: use SSL
@@ -41,6 +41,14 @@ class ApplicationController < ActionController::Base
end
end
def check_2fa
# Over complicated way of asking if the user is logged in as a mod without TOTP enabled while they are not on their login settings screen, logging out, or updating their login settings.
if current_user && current_user.mod? && !current_user.totp_enabled? && !(controller_name == "users" && action_name == "edit_login") && !(controller_name == "sessions" && action_name == "destroy") && !(controller_name == "users" && action_name == "update_login")
flash[:alert] = "Due to your staff rank, you are required to enable 2FA."
redirect_to :controller => "users", :action => "edit_login", :id => current_user.id
end
end
#roles
def disabled?

View File

@@ -4,7 +4,7 @@ class BlogpostsController < ApplicationController
before_filter :auth, except: [:index, :show]
def index
@posts = Blogpost.order("created_at desc").page(params[:page]).per(10)
@posts = Blogpost.order(id: :desc).page(params[:page]).per(10)
end
def show

View File

@@ -1,4 +1,5 @@
class ForumsController < ApplicationController
before_filter :check_permission, only: [:show, :edit, :update, :destroy]
def index
@@ -10,7 +11,7 @@ class ForumsController < ApplicationController
@threads = @forum.forumthreads.select {|f| f.can_read?(current_user) }.to_a
@threads.sort_by! do |t|
# sticky goes first, then sort by last activity (new replies)
[t.sticky ? 0 : 1, -(t.replies.last.try(:created_at) || t.created_at).to_i]
[t.sticky ? 0 : 1, -(t.replies.order(:id).last.try(:created_at) || t.created_at).to_i]
end
@threads = Kaminari.paginate_array(@threads).page(params[:page])
end
@@ -77,7 +78,6 @@ class ForumsController < ApplicationController
redirect_to forums_path
end
private
def check_permission
@@ -89,7 +89,7 @@ class ForumsController < ApplicationController
end
def forum_params(add = [])
a = [:name, :position, :role_read_id, :role_write_id] + add
a = [:name, :position, :role_read_id, :role_write_id, :necro_length, :disable_deletion] + add
params.require(:forum).permit(a)
end
end

View File

@@ -3,11 +3,20 @@ class ForumthreadsController < ApplicationController
before_filter :check_permission, only: [:show, :edit, :update, :destroy]
def index
redirect_to forum_path(@thread.forum.forumgroup, f)
params[:forum] = nil if params[:forum] && !Forum.find_by(id: params[:forum])
params.delete_if{|k,v| v.blank?}
@threads = Forumthread.filter(current_user, params[:title].try(:slice, 0..255), params[:content].try(:slice, 0..255), params[:reply].try(:slice, 0..255), params[:label], User.find_by(ign: params[:author].to_s.strip) || params[:author], params[:query].try(:slice, 0..255), Forum.find_by(id: params[:forum]))
.page(params[:page]).per(30)
end
def show
@replies = @thread.replies.page(params[:page])
if params[:reverse] == "true"
@replies = @thread.replies.order(id: :desc).page(params[:page])
else
@replies = @thread.replies.order(:id).page(params[:page])
end
end
def edit
@@ -64,7 +73,7 @@ class ForumthreadsController < ApplicationController
end
def destroy
if mod? || @thread.author.is?(current_user)
if mod? || (@thread.author.is?(current_user) && !@thread.forum.disable_deletion)
if @thread.destroy
flash[:notice] = "Thread deleted!"
else
@@ -76,6 +85,9 @@ class ForumthreadsController < ApplicationController
redirect_to @thread.forum
end
def search
end
private
def check_permission

View File

@@ -21,6 +21,10 @@ class SessionsController < ApplicationController
flash[:alert] = "Your account has been disabled!"
elsif user.banned?
flash[:alert] = "You are banned!"
elsif user.totp_enabled && !TOTP.valid?(user.totp_secret, params[:totp_code].to_i)
flash[:alert] = "You're doing it wrong!"
render action: 'new'
return
else
session[:user_id] = user.id
flash[:notice] = "Logged in!"

View File

@@ -1,5 +1,7 @@
class StaticsController < ApplicationController
caches_action :online, expires_in: 10.seconds, layout: false
def index
if current_user
redirect_to blogposts_path
@@ -14,4 +16,30 @@ class StaticsController < ApplicationController
def donate
end
def online
@players = []
@count = 0
begin
json = JSON.parse(File.read("/etc/minecraft/info/players.json"))
rescue
flash.now[:alert] = "The server is currently offline."
else
case json["dataFormat"]
when "v1"
@players = json["players"].collect!{ |p| User.find_by(uuid: p["UUID"].tr("-", "")) or User.new(name: p["name"], ign: p["name"], uuid: p["UUID"].tr("-", ""), role: Role.get("normal"), badge: Badge.get("none"), confirmed: true) }
@count = json["amount"]
when "v2"
json["players"].reject{|p| !mod? && p["vanished"] == "true"}.each do |p|
@players.push(User.find_by(uuid: p["UUID"].tr("-", "")) || User.new(name: p["name"], ign: p["name"], uuid: p["UUID"].tr("-", ""), role: Role.get("normal"), badge: Badge.get("none"), confirmed: true))
end
@count = @players.count
else
flash.now[:alert] = "The server is using an incompatible data format. We are aware of this issue and are most likely already working on it."
end
@players.sort_by!(&:role).reverse!
end
end
def privacy
end
end

View File

@@ -37,7 +37,7 @@ class ThreadrepliesController < ApplicationController
if @reply.update_attributes(reply_params)
@reply.send_new_reply_mail(old_content)
flash[:notice] = "Reply updated!"
position = @reply.thread.replies.index(@reply)
position = @reply.thread.replies.order(:id).index(@reply)
page = position / Kaminari.config.default_per_page + 1
redirect_to forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}"
else

View File

@@ -7,29 +7,21 @@ class UsersController < ApplicationController
before_filter :set_user, except: [:index, :new, :create, :lost_password, :reset_password, :suggestions]
def index
if params[:role]
if params[:role].downcase == "staff"
@users = User.joins(:role).where("roles.value >= ?", Role.get(:mod).to_i)
elsif params[:role].downcase == "donor"
@users = User.joins(:role).where(donor: true)
else
if role = Role.get(params[:role])
@users = User.joins(:role).where(role: role)
else
flash[:alert] = "role '#{params[:role]}' does not exist!"
redirect_to users_path
return
end
end
else
@users = User.joins(:role).where.not(id: User.first.id) #Remove first user
end
@users = @users.order("roles.value desc", "confirmed desc", :name)
role = Role.find_by(name: params[:role])
badge = Badge.find_by(name: params[:badge])
@users = User.search(params[:search], role, badge, params.include?(:staff), params.include?(:donor))
@count = @users.size
@users = @users.page(params[:page]).per(100)
end
def show
begin
@ban_json = JSON.parse(File.read("/etc/minecraft/info/banned-players.json")).detect {|u| u["uuid"].tr("-", "") == @user.uuid}
rescue
flash.now[:alert] = "An error occured while checking if this user is banned from the server!"
@ban_json = nil
end
end
# SIGNUP
@@ -95,6 +87,12 @@ class UsersController < ApplicationController
@user.uuid = user_profile["id"]
@user.ign = user_profile["name"] # correct case
if User.find_by(uuid: @user.uuid)
flash[:alert] = "You already have a Redstoner account associated with this Minecraft account. Please log in instead."
redirect_to login_path
return
end
if validate_token(@user.uuid, @user.email, params[:registration_token])
destroy_token(params[:email])
@user.last_ip = request.remote_ip # showing in mail
@@ -151,9 +149,14 @@ class UsersController < ApplicationController
def update
if (mod? && current_user.role >= @user.role ) || (@user.is?(current_user) && confirmed?)
if mod?
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about, :role, :confirmed, :donor])
userdata = user_params([:name, :discord, :youtube, :twitter, :about, :role, :badge, :confirmed, :header_scroll, :utc_time, :dark])
else
userdata = user_params([:name, :skype, :skype_public, :youtube, :twitter, :about])
userdata = user_params([:name, :discord, :youtube, :twitter, :about, :header_scroll, :utc_time, :dark])
end
if User.find_by(name: userdata[:name]) && User.find_by(name: userdata[:name]) != @user
flash[:alert] = "You have entered a name that belongs to someone else. Please try another."
redirect_to edit_user_path(@user)
return
end
if userdata[:role]
role = Role.get(userdata[:role])
@@ -164,6 +167,9 @@ class UsersController < ApplicationController
userdata.delete(:role)
end
end
if userdata[:badge]
userdata[:badge] = Badge.get(userdata[:badge])
end
if @user.youtube != userdata[:youtube]
youtube = get_youtube(userdata[:youtube])
userdata[:youtube] = youtube[:channel]
@@ -229,6 +235,18 @@ class UsersController < ApplicationController
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
flash[:alert] = "You are not allowed to edit this user's login details!"
redirect_to @user
return
end
if !@user.totp_enabled
@user.update(totp_secret: TOTP.secret)
end
end
def edit_website_settings
unless @user.is?(current_user) || admin? && current_user.role > @user.role || superadmin?
flash[:alert] = "You are not allowed to edit this user's website settings!"
redirect_to @user
end
end
@@ -244,6 +262,18 @@ class UsersController < ApplicationController
@user.email_token = SecureRandom.hex(16) if mail_changed
@user.confirmed = !mail_changed
if params[:user][:totp_enabled] == "1" && !@user.totp_enabled
if TOTP.valid?(@user.totp_secret, params[:totp_code].to_i)
@user.totp_enabled = true
else
flash[:alert] = "Wrong TOTP code!"
render action: "edit_login"
return
end
elsif params[:user][:totp_enabled] == "0" && @user.totp_enabled
@user.totp_enabled = false
end
# checking here for password so we can send back changes to the view
if authenticated
if @user.save
@@ -351,7 +381,7 @@ class UsersController < ApplicationController
end
def user_params(add = [])
a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention] + add
a = [:ign, :email, :password, :password_confirmation, :mail_own_thread_reply, :mail_other_thread_reply, :mail_own_blogpost_comment, :mail_other_blogpost_comment, :mail_mention, :public_key, :totp_code] + add
params.require(:user).permit(a)
end
end

View File

@@ -11,10 +11,12 @@ module ApplicationHelper
end
def ago(tm)
if tm
if tm && current_user.try(:utc_time) != true
content_tag :time, title: tm.strftime("%e %b %Y, %H:%M %Z"), datetime: tm.to_datetime.rfc3339 do
tm.strftime("%e %b %Y, %H:%M")
end
else
tm
end
end

View File

@@ -51,5 +51,4 @@ module UsersHelper
return nil
end
end
end

View File

@@ -1,8 +1,8 @@
class RedstonerMailer < ActionMailer::Base
add_template_helper(ApplicationHelper)
default from: "info@redstoner.com"
default reply_to: "redstonerserver+website@gmail.com"
default from: "\"Redstoner\" <noreply@redstoner.com>"
default reply_to: "staff@redstoner.com"
def register_mail(user, uses_mc_pass)
@user = user
@@ -19,29 +19,49 @@ class RedstonerMailer < ActionMailer::Base
def new_thread_mention_mail(user, thread)
@user = user
@thread = thread
mail(to: @user.email, subject: "#{thread.author.name} mentioned you in '#{thread.title}' on Redstoner")
if @user.public_key?
mail(to: @user.email, subject: "Encrypted Notification from Redstoner", gpg: {encrypt: true, keys: {@user.email => @user.public_key}})
else
mail(to: @user.email, subject: "#{thread.author.name} mentioned you in '#{thread.title}' on Redstoner")
end
end
def new_thread_reply_mail(user, reply)
@user = user
@reply = reply
mail(to: @user.email, subject: "#{reply.author.name} replied to '#{reply.thread.title}' on Redstoner")
if @user.public_key?
mail(to: @user.email, subject: "Encrypted Notification from Redstoner", gpg: {encrypt: true, keys: {@user.email => @user.public_key}})
else
mail(to: @user.email, subject: "#{reply.author.name} replied to '#{reply.thread.title}' on Redstoner")
end
end
def new_post_mention_mail(user, post)
@user = user
@post = post
mail(to: @user.email, subject: "#{post.author.name} mentioned you in '#{post.title}' on Redstoner")
if @user.public_key?
mail(to: @user.email, subject: "Encrypted Notification from Redstoner", gpg: {encrypt: true, keys: {@user.email => @user.public_key}})
else
mail(to: @user.email, subject: "#{post.author.name} mentioned you in '#{post.title}' on Redstoner")
end
end
def new_post_comment_mail(user, comment)
@user = user
@comment = comment
mail(to: @user.email, subject: "#{comment.author.name} replied to '#{comment.blogpost.title}' on Redstoner")
if @user.public_key?
mail(to: @user.email, subject: "Encrypted Notification from Redstoner", gpg: {encrypt: true, keys: {@user.email => @user.public_key}})
else
mail(to: @user.email, subject: "#{comment.author.name} replied to '#{comment.blogpost.title}' on Redstoner")
end
end
def email_change_confirm_mail(user)
@user = user
mail(to: @user.email, subject: "Email change on Redstoner.com")
if @user.public_key?
mail(to: @user.email, subject: "Encrypted Notification from Redstoner", gpg: {encrypt: true, keys: {@user.email => @user.public_key}})
else
mail(to: @user.email, subject: "Email change on Redstoner.com")
end
end
end

18
app/models/badge.rb Normal file
View File

@@ -0,0 +1,18 @@
class Badge < ActiveRecord::Base
include Comparable
has_many :users
def self.get (input)
if input.is_a?(String) || input.is_a?(Symbol)
Badge.find_by(name: input)
elsif input.is_a?(Fixnum)
Badge.find_by(id: input)
elsif input.is_a?(Badge)
return input
end
end
def to_s
self.name
end
end

View File

@@ -8,6 +8,8 @@ class Blogpost < ActiveRecord::Base
belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id"
has_many :comments, :dependent => :destroy
accepts_nested_attributes_for :comments
validates_length_of :title, in: 5..255
validates_length_of :content, in: 5..20000
def author
@author ||= if self.user_author.present?

View File

@@ -4,6 +4,7 @@ class Forum < ActiveRecord::Base
belongs_to :role_read, class_name: "Role", foreign_key: "role_read_id"
belongs_to :role_write, class_name: "Role", foreign_key: "role_write_id"
has_and_belongs_to_many :labels
validates_length_of :name, in: 4..30
def to_s
name

View File

@@ -7,7 +7,7 @@ class Forumgroup < ActiveRecord::Base
validates_presence_of :name, :position
validates_length_of :name, in: 2..20
validates_length_of :name, in: 4..20
def to_s
name

View File

@@ -11,6 +11,7 @@ class Forumthread < ActiveRecord::Base
validates_presence_of :title, :author, :forum
validates_presence_of :content
validates_length_of :title, in: 5..255
validates_length_of :content, in: 5..20000
accepts_nested_attributes_for :threadreplies
@@ -65,4 +66,49 @@ class Forumthread < ActiveRecord::Base
def to_param
[id, to_s.parameterize].join("-")
end
def self.filter (user, title, content, reply, label, author, query, forum)
order_phrase = query || [title, content, reply].select(&:present?).join(" ")
user_id = user.try(:id).to_i
role_value = user.try(:role).to_i
can_read = "COALESCE(forum_role_read.value, 0) <= ? AND COALESCE(forumgroup_role_read.value, 0) <= ?"
# A user can view sticky threads in write-only forums without read permissions.
sticky_can_write = "sticky = true AND (COALESCE(forum_role_write.value, 0) <= ? AND COALESCE(forumgroup_role_write.value, 0) <= ?)"
match = ["MATCH (title, forumthreads.content) AGAINST (#{Forumthread.sanitize(order_phrase)})", "MATCH (threadreplies.content) AGAINST (#{Forumthread.sanitize(order_phrase)})", "MATCH (title, forumthreads.content) AGAINST (?) OR MATCH (threadreplies.content) AGAINST (?)", "MATCH (title) AGAINST (?)", "MATCH (forumthreads.content) AGAINST (?)", "MATCH (threadreplies.content) AGAINST (?)"]
threads = forum.try(:forumthreads) || Forumthread
threads = threads.select("forumthreads.*", "#{match[0]} AS relevance", "#{match[1]} AS reply_rel")
threads = threads.joins(forum: :forumgroup)
.joins("LEFT JOIN threadreplies ON forumthreads.id = threadreplies.forumthread_id")
.joins("LEFT JOIN roles as forum_role_read ON forums.role_read_id = forum_role_read.id")
.joins("LEFT JOIN roles as forum_role_write ON forums.role_write_id = forum_role_write.id")
.joins("LEFT JOIN roles as forumgroup_role_read ON forumgroups.role_read_id = forumgroup_role_read.id")
.joins("LEFT JOIN roles as forumgroup_role_write ON forumgroups.role_write_id = forumgroup_role_write.id")
threads = threads.where("forumthreads.user_author_id = ? OR (#{can_read}) OR (#{sticky_can_write})", user_id, role_value, role_value, role_value, role_value)
if query
threads = threads.where("#{match[2]}", query[0..99], query[0..99])
elsif [title, content, reply].any?
threads = threads.where("#{match[3]}", title[0..99]) if title
threads = threads.where("#{match[4]}", content[0..99]) if content
threads = threads.where("#{match[5]}", reply[0..99]) if reply
end
if label.try(:downcase) == "no label"
threads = threads.where(label: nil)
elsif label && l = Label.find_by(name: label)
threads = threads.where(label: l)
end
threads = threads.where(user_author: author) if author
threads = threads.group("forumthreads.id")
if order_phrase.present?
threads = threads.order("GREATEST(relevance, reply_rel) DESC")
else
threads = threads.order("sticky DESC", "threadreplies.id DESC", "forumthreads.id DESC")
end
threads
end
end

View File

@@ -14,14 +14,14 @@ class Role < ActiveRecord::Base
end
def is? (name)
!!(Role.find_by_name(name) == self)
!!(Role.find_by(name: name) == self)
end
def self.get (input)
if input.is_a?(String) || input.is_a?(Symbol)
Role.find_by_name(input)
Role.find_by(name: input)
elsif input.is_a?(Fixnum)
Role.find_by_id(input)
Role.find_by(id: input)
elsif input.is_a?(Role)
return input
end
@@ -31,7 +31,7 @@ class Role < ActiveRecord::Base
if role.is_a?(Role)
self.value - role.value
elsif role.is_a?(Symbol)
self <=> Role.find_by_name(role)
self <=> Role.find_by(name: role)
else
self.to_i <=> role
end

View File

@@ -43,7 +43,7 @@ class Threadreply < ActiveRecord::Base
unless old_content.present?
posts.each do |post|
# don't send mail to the author of this reply, don't send to banned/disabled users
if post.author != author && post.author.normal? && post.author.confirmed? # &&
if post.author != author && post.author.normal? && post.author.confirmed? && thread.can_read?(post.author)
users << post.author if post.author.mail_other_thread_reply?
end
end

View File

@@ -5,10 +5,11 @@ class User < ActiveRecord::Base
strip_attributes
belongs_to :role
belongs_to :badge
has_secure_password
before_validation :strip_whitespaces, :set_uuid, :set_name, :set_email_token, :set_role
before_validation :strip_whitespaces, :set_uuid, :set_name, :set_email_token, :set_role, :set_badge
validates_presence_of :password, :password_confirmation, :email_token, on: :create
validates_presence_of :name, :email, :ign
@@ -20,6 +21,9 @@ class User < ActiveRecord::Base
validates :email, uniqueness: {case_sensitive: false}, format: {with: /\A.+@(.+\..{2,}|\[(IPv6)?[0-9a-f:.]+\])\z/i, message: "That doesn't look like an email address."}
validates :ign, uniqueness: {case_sensitive: false}, format: {with: /\A[a-z\d_]+\z/i, message: "Username is invalid (a-z, 0-9, _)."}
validates :discord, uniqueness: {case_sensitive: false}, format: {with: /\A^(?!everyone|here|discordtag|.*```.*)([^@#:]{2,32}#[0-9]{4})$\z/i, message: "Discord name is invalid."}, allow_blank: true
validates :public_key, format: {with: /\A(-----BEGIN PGP PUBLIC KEY BLOCK-----((.|\n)*?)-----END PGP PUBLIC KEY BLOCK-----)?\z/i, message: "That doesn't look like a PGP formatted public key."}
has_many :blogposts
has_many :comments
@@ -29,10 +33,6 @@ class User < ActiveRecord::Base
self == user
end
def donor?
!!self.donor
end
def confirmed?
!!self.confirmed
end
@@ -150,6 +150,10 @@ class User < ActiveRecord::Base
self.role ||= Role.get(:normal)
end
def set_badge
self.badge ||= Badge.get(:none)
end
def set_uuid
if !self.uuid.present?
# idk
@@ -165,7 +169,7 @@ class User < ActiveRecord::Base
self.ign.strip! if self.ign
self.email.strip! if self.email
self.about.strip! if self.about
self.skype.strip! if self.skype
self.discord.strip! if self.discord
self.youtube.strip! if self.youtube
self.twitter.strip! if self.twitter
end
@@ -173,4 +177,23 @@ class User < ActiveRecord::Base
def set_email_token
self.email_token ||= SecureRandom.hex(16)
end
def self.search (search, role, badge, staff, donor)
users = User.joins(:role)
if role
users = users.where(role: role)
elsif staff
users = users.where("roles.value >= ?", Role.get(:mod).to_i)
elsif donor
users = users.where("badge_id = ? OR badge_id = ?", Badge.get(:donor), Badge.get(:donorplus))
end
users = users.where(badge: badge) if badge
if search
search_san = User.send(:sanitize_sql_like, search.to_s)
users = users.where("users.name like ? OR ign like ?", "%#{search_san}%", "%#{search_san}%")
end
users = users.where.not(id: User.first.id) unless [search, role, badge].any?
users = users.order("roles.value desc", "confirmed desc", :name)
users
end
end

View File

@@ -0,0 +1,8 @@
<div class="md_editor">
<div class="field_container_user">
<% options = (defined?(options) && options || {}) %>
<% options[:class] = "#{options[:class]} editor_field" %>
<% options[:placeholder] ||= "Enter user's name." %>
<%= text_field_tag name, content, options %>
</div>
</div>

View File

@@ -1,10 +1,10 @@
<% title "Edit News: #{@post.title}" %>
<% title "Edit Post: #{@post.title}" %>
<h1>Edit post</h1>
<h1>Edit Post: #{@post.title}</h1>
<%= form_for @post do |f|%>
<%= f.text_field :title %>
<%= render partial: "md_editor", locals: {name: "blogpost[content]", content: @post.content} %>
<p><%= f.submit "Update Post", class: "btn blue left" %></p>
<% end %>
<p><%= button_to "Delete post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %></p>
<p><%= button_to "Delete Post", @post, method: "delete", data: {confirm: "Delete post & comments forever?"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -1,7 +1,7 @@
<% title "News" %>
<h1>News</h1>
<%= link_to 'Make new Post', new_blogpost_path, class: "btn blue" if mod? %>
<%= link_to 'New Post', new_blogpost_path, class: "btn blue" if mod? %>
<div id="posts">
<% @posts.each do |p| %>
<div class="item-group with-avatar" id="post-<%= p.id %>">

View File

@@ -1,4 +1,4 @@
<h3>New comment</h3>
<h3>New Comment</h3>
<%= form_for [@post, @comment] do |f| %>
<%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content} %>
<p><%= f.submit class: "btn blue" %></p>

View File

@@ -1,10 +1,10 @@
<% title "Edit Comment: #{@comment.blogpost.title}" %>
<h1>Edit comment</h1>
<h1>Edit Comment</h1>
<%= form_for [@comment.blogpost, @comment] do |f| %>
<%= render partial: "md_editor", locals: {name: "comment[content]", content: @comment.content} %>
<p><%= f.submit "Update Comment", class: "btn blue left" %></p>
<% end %>
<p><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %></p>
<p><%= button_to "Delete Comment", [@comment.blogpost, @comment] , method: "delete", data: {confirm: "Delete comment forever?"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -34,7 +34,7 @@
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<p><%= f.submit "Update group", class: "btn blue left" %></p>
<p><%= f.submit "Update Group", class: "btn blue left" %></p>
<% end %>
<p><%= button_to "Delete group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right" %></p>
<p><%= button_to "Delete Group", @group, :method => "delete", data: {confirm: "Delete group?\nForums + Threads will not be accessible!"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -1,6 +1,6 @@
<% title "New Forum: #{@group.name}" %>
<h1>New forum group</h1>
<h1>New Forum Group</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @group do |f|%>
<table>
@@ -21,6 +21,6 @@
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<p><%= f.submit "Create group", class: "btn blue left" %></p>
<p><%= f.submit "Create Group", class: "btn blue left" %></p>
<div class="clear"></div>
<% end %>

View File

@@ -21,8 +21,16 @@
<td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
<tr>
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
</tr>
<tr>
<td><%= f.label :disable_deletion, "Disable deletion of threads for non-staff" %></td>
<td><%= f.check_box :disable_deletion %></td>
</tr>
</table>
<p><%= f.submit "Update forum", class: "btn blue left" %></p>
<p><%= f.submit "Update Forum", class: "btn blue left" %></p>
<% end %>
<p><%= button_to "Delete forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p>
<p><%= button_to "Delete Forum", @forum, method: "delete", data: {confirm: "Delete forum forever?\nThreads won't be accessible!"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -1,5 +1,7 @@
<% title "Forums" %>
<%= link_to "Search All Threads", forumthreads_path, class: "btn blue right" %>
<br>
<div id="forum_groups">
<% @groups.each do |group| %>
<div class="item-group" id="group-<%= group.id %>">
@@ -16,7 +18,7 @@
<%= link_to f.name, f, id: "forum-#{f.id}"%>
<div class="item-info">
<% if last_thread = f.threads.last %>
<% last_reply = Threadreply.where(forumthread: f.threads).order(:created_at).last %>
<% last_reply = Threadreply.where(forumthread: f.threads).order(:id).last %>
<% if last_reply && last_reply.created_at > last_thread.created_at %>
<% if last_reply.thread.can_read?(current_user) %>
<%= last_reply.author.name %>

View File

@@ -21,8 +21,16 @@
<td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
<tr>
<td><%= f.label :necro_length, "Necropost warning delay (in days)" %></td>
<td><%= f.number_field :necro_length, placeholder: "Warning Delay (leave blank for no warning)" %></td>
</tr>
<tr>
<td><%= f.label :disable_deletion %></td>
<td><%= f.check_box :disable_deletion %></td>
</tr>
</table>
<%= f.hidden_field :forumgroup_id %>
<p><%= f.submit "Create forum", class: "btn blue left" %></p>
<p><%= f.submit "Create Forum", class: "btn blue left" %></p>
<div class="clear"></div>
<% end %>

View File

@@ -0,0 +1,19 @@
atom_feed do |feed|
feed.title @forum.name + "'s Latest Threads"
feed.updated Time.now
@threads.limit(10).each do |thread|
unless thread.sticky?
feed.entry thread do |entry|
entry.updated thread.updated_at
entry.author do |a|
a.name thread.author.name
a.uri user_url(thread.author)
end
entry.url forumthread_url(thread)
entry.title thread.title
entry.content render_md(thread.content).html_safe, :type => 'html'
end
end
end
end

View File

@@ -1,8 +1,13 @@
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= @forum %>
<h1><%= title @forum %></h1>
<h1>
<%= title @forum %>
<%= link_to "Search Threads", forumthreads_path(forum: @forum.id), class: "btn blue right" %>
</h1>
<% if @forum.can_write?(current_user) %>
<p><%= link_to "New thread", new_forumthread_path(forum: @forum), class: "btn blue" %></p>
<p>
<%= link_to "New Thread", new_forumthread_path(forum: @forum), class: "btn blue" %>
</p>
<% end %>
<% if @forum.role_read && @forum.role_write && @forum.role_write < @forum.role_read %>
@@ -33,7 +38,7 @@
<div class="item <%= "#{"locked" if thread.locked}#{"sticky" if thread.sticky}" %>">
<%= render partial: "labels/label", locals: {label: thread.label} %><%= link_to truncate(thread.title, length: 60, omission: " …"), forumthread_path(thread), title: thread.title %>
<div class="item-info">
<% if rpl = thread.replies.last %>
<% if rpl = thread.replies.order(:id).last %>
<%= rpl.author.name %>
<%
position = thread.replies.count - 1

View File

@@ -11,7 +11,9 @@
end
%>
<h1>Edit thread</h1>
<% forum = Forum.find(@thread.forum_id) %>
<h1>Edit Thread</h1>
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%= link_to @thread, @thread %> → Edit thread
<%= form_for @thread do |f|%>
<table>
@@ -35,7 +37,9 @@
<%= f.text_field :title, placeholder: "Title" %>
</div>
<%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %>
<p><%= f.submit "Update thread", class: "btn blue left" %></p>
<p><%= f.submit "Update Thread", class: "btn blue left" %></p>
<% end %>
<% if mod? || !forum.disable_deletion %>
<%= button_to "Delete Thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %>
<% end %>
<%= button_to "Delete thread", @thread, :method => "delete", data: {confirm: "Delete thread & comments forever?"}, class: "btn red right" %>
<div class="clear"></div>

View File

@@ -0,0 +1,85 @@
<%= link_to "Forums", forums_path %> →
<% params_list = params.slice(:query, :title, :content, :author, :label, :reply) %>
<% if params_list.any? %>
<%= link_to "All Threads", forumthreads_path %> → Search Results
<% else %>
<%= "All Threads" %>
<% end %>
<h1>
<%
if params[:forum]
text = "forum '#{Forum.find(params[:forum]).name}'"
if params_list.except(:forum).any?
text = "Search Results in #{text} (#{@threads.total_count})"
else
text = text.capitalize
end
elsif params_list.any?
text = "Search Results (#{@threads.total_count})"
else
text = "All Threads"
end
%>
<%= title text %>
</h1>
<br>
<%= form_tag(forumthreads_path, method: :get) do %>
<%= text_field_tag "query", params[:query], placeholder: "Search...", class: "searchfield field" %>
<%= submit_tag "Go", class: "searchfield btn" %>
<%= link_to "Advanced Search", search_forumthreads_path(params_list), class: "btn right blue" %>
<% if params_list.any? %>
<% if params[:forum] %>
<%= link_to "Show All Threads", forumthreads_path(params_list.except("forum")), class: "btn right blue" %>
<% elsif params_list.except(:controller, :action).any? %>
<%= link_to "Show All Threads", forumthreads_path, class: "btn right blue" %>
<% end %>
<% end %>
<% if params[:forum] %>
<%= link_to "Go to Forum", forum_path(params[:forum]), class: "btn right blue" %>
<% end %>
<% params.slice(:forum, :title, :content, :reply, :label, :author).each do |key, value| %>
<%= hidden_field_tag key, params[key] %>
<% end %>
<% end %>
<div id="forum_groups">
<% @threads.each do |thread| %>
<div class="item-group with-avatar" id="thread-<%= thread.id %>">
<div class="header">
<%= link_to(thread.author.avatar(64), thread.author, title: thread.author.ign) %>
<%= render partial: "users/username", locals: { user: thread.author } %>
<%= link_to thread do %>
<%= ago thread.created_at %>
<% end %>
<span class="comment-counter">
<%= link_to pluralize(thread.replies.count, "Reply"), thread %>
</span>
<div class="clear-right"></div>
</div>
<div class="items bold">
<div class="item <%= "#{"locked" if thread.locked}#{"sticky" if thread.sticky}" %>">
<%= render partial: "labels/label", locals: {label: thread.label} %><%= link_to truncate(thread.title, length: 60, omission: " …"), forumthread_path(thread), title: thread.title %>
<div class="item-info">
<% if rpl = thread.replies.order(:id).last %>
<%= rpl.author.name %>
<%
position = thread.replies.count - 1
page = position / Kaminari.config.default_per_page + 1
%>
<%= link_to "replied", forumthread_path(thread, page: page) + "#reply-#{rpl.id}" %>
<%= ago rpl.created_at %>.
<% else %>
No replies yet.
<% end %>
</div>
<div class="clear"></div>
</div>
</div>
</div>
<% end %>
<% if @threads.empty? %>
<br>
<h3>No results found</h3>
<% end %>
<%= paginate @threads %>
</div>

View File

@@ -8,7 +8,7 @@
%>
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → New thread
<h1>New thread</h1>
<h1>New Thread</h1>
<%= form_for @thread do |f|%>
<table>
<% if mod? %>
@@ -30,6 +30,6 @@
</div>
<%= render partial: "md_editor", locals: {name: "forumthread[content]", content: @thread.content} %>
<%= f.hidden_field :forum_id %>
<p><%= f.submit "Create thread", class: "btn blue left" %></p>
<p><%= f.submit "Create Thread", class: "btn blue left" %></p>
<div class="clear"></div>
<% end %>

View File

@@ -0,0 +1,54 @@
<% title "Thread Search" %>
<h1>Thread Search</h1>
<h3>Leave a field blank to ignore that search aspect.</h3>
<% label = Label.where(name: params[:label]).first %>
<table>
<tbody>
<%= form_tag(forumthreads_path, method: :get) do %>
<%
forums = []
Forum.select{|f| f.can_read?(current_user)}.sort_by{ |f| f.forumgroup && f.forumgroup.position || 0 }.each do |f|
forums << ["#{f.forumgroup.name} → #{f.name}", f.id] if f.forumgroup
end
%>
<% label_list = Label.pluck(:name).prepend("No Label") %>
<tr>
<td>Forum</td>
<td><%= select_tag "forum", options_for_select(forums, params[:forum]), include_blank: "Search All Threads" %></td>
</tr>
<tr>
<td>Label</td>
<td>
<%= select_tag "label", options_for_select(label_list, params[:label]), include_blank: "Label" %>
</td>
</tr>
<tr>
<td>Title</td>
<td>
<%= text_field_tag "title", params[:title], placeholder: "Search Titles" %>
</td>
</tr>
<tr>
<td>Content</td>
<td>
<%= text_field_tag "content", params[:content], placeholder: "Search Contents" %>
</td>
<tr>
<td>Author</td>
<td>
<%= render partial: "md_editor_user", locals: {name: "author", content: params[:author]} %>
</td>
</tr>
<td>Replies</td>
<td>
<%= text_field_tag "reply", params[:reply], placeholder: "Search Replies" %>
</td>
</tr>
<tr>
<td>
<%= submit_tag "Go", class: "btn blue", style: "width:50px", name: nil %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -1,6 +1,8 @@
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%=truncate(@thread.title, length: 60, omission: " …") %>
<h1><%= render partial: "labels/label", locals: {label: @thread.label} %><%= title @thread.title %></h1>
<h1>
<%= render partial: "labels/label", locals: {label: @thread.label} %><%= title @thread.title %>
<%= link_to "Reverse Replies", forumthread_path(@thread, reverse: params[:reverse] != "true"), class: "btn right blue" %>
</h1>
<div class="item-group thread with-avatar" id="thread-<%= @thread.id %>">
<div class="header">
<%= link_to(@thread.author.avatar(64), @thread.author, title: @thread.author.ign) %>

View File

@@ -13,11 +13,12 @@
<% end %> |
<%= link_to "https://twitter.com/RedstonerServer", title: "Redstoner on Twitter" do %>
Twitter <%= image_tag("twitter.png") %>
<% end %>
<% if current_user %>
| <%= link_to "/slack/?" + {mail: current_user.try(:email)}.to_param do %>
Join us on <img src="/slack/badge.svg" alt="Slack">
<% end %>
<% end %> |
<%= link_to "https://mstdn.io/@RedstonerServer", title: "Redstoner on Mastodon" do %>
Mastodon <%= image_tag("mastodon.png") %>
<% end %> |
<%= link_to "https://discord.gg/QjfcPEJ", title: "Redstoner's Official Discord" do %>
Discord <%= image_tag("discord.png") %>
<% end %>
</div>
</div>

View File

@@ -1,4 +1,9 @@
<div id="head">
<% head = "head_top" %>
<% if current_user != nil && current_user.header_scroll == true %>
<% head = "head_scroll" %>
<% end %>
<div id="<%= head %>">
<div id="menu">
<%= link_to "", root_path, id: "logo" %>
<ul>
@@ -26,6 +31,9 @@
<li>
<%= link_to "Donate", donate_statics_path, class: ("active" if con == "statics" && params[:action] == "donate") %>
</li>
<li>
<%= link_to "Who's Playing?", online_statics_path, class: ("active" if con == "statics" && params[:action] == "online") %>
</li>
</ul>
</div>
<div id="userbar">

View File

@@ -5,16 +5,23 @@
<meta name="viewport" content="initial-scale=1,maximum-scale=1">
<meta name="description" content="Redstoner is a creative minecraft server made for redstoners">
<%= stylesheet_link_tag "application", :media => "all" %>
<% if current_user.try(:dark) == true %>
<%= stylesheet_link_tag "dark", :media => "all" %>
<% end %>
<%= csrf_meta_tags %>
<%= favicon_link_tag "favicon.ico" %>
<%= javascript_include_tag "https://cdn.rawgit.com/jomo/ago.js/v0.0.1/ago.min.js", crossorigin: :anonymous, integrity: "sha256-xw0JUUdbuZQCVO+QScoxrlEsD4nZGCjMRh9PP8GLhcY=" %>
<%= javascript_include_tag "https://cdn.jsdelivr.net/gh/jomo/ago.js@0.0.1/ago.min.js", crossorigin: :anonymous, integrity: "sha256-xw0JUUdbuZQCVO+QScoxrlEsD4nZGCjMRh9PP8GLhcY=" %>
<%= javascript_include_tag "application" %>
<link type="application/atom+xml" rel="alternate" href="<%= blogposts_path(:atom) %>">
<%= yield(:site_headers) %>
</head>
<body>
<%= render partial: "/layouts/head" %>
<div id="main-content" class="<%= yield(:main_class) %>">
<% content = "main-content" %>
<% if current_user.try(:header_scroll) == true %>
<% content = "main-content-scroll" %>
<% end %>
<div id="<%=content%>" class="<%=yield(:main_class) %>">
<% if alert %>
<div class='flash alert'><%= alert %></div>
<% end %>

View File

@@ -13,7 +13,7 @@
</div>
<p></p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game.</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(staff: ""), style: "text-decoration: none; color: #4096EE;" %> in-game.</p>
<p>Your Redstoner team</p>
</div>
@@ -25,8 +25,8 @@
<p>You can contact us via:
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %>
</p>
</div>
</div>

View File

@@ -14,7 +14,7 @@
%>
<p><%= link_to "Click here", blogpost_url(@comment.blogpost, page: page) + "#comment-#{@comment.id}", style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(staff: ""), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>Your Redstoner team</p>
</div>
@@ -24,8 +24,8 @@
<p>You can contact us via:
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %>
</p>
</div>
</div>

View File

@@ -10,7 +10,7 @@
<p><%= link_to "Click here", blogpost_url(@post), style: "text-decoration: none; color: #4096EE;" %> to view the blog post.</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(staff: ""), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>Your Redstoner team</p>
</div>
@@ -21,8 +21,8 @@
<p>You can contact us via:
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %>
</p>
</div>
</div>

View File

@@ -11,7 +11,7 @@
<p><%= link_to "Click here", forumthread_url(@thread), style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(staff: ""), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>Your Redstoner team</p>
</div>
@@ -23,8 +23,8 @@
<p>You can contact us via:
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %>
</p>
</div>
</div>

View File

@@ -15,7 +15,7 @@
%>
<p><%= link_to "Click here", forumthread_url(@reply.thread, page: page) + "#reply-#{@reply.id}", style: "text-decoration: none; color: #4096EE;" %> to view the thread.</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(staff: ""), style: "text-decoration: none; color: #4096EE;" %> in-game or on the forums!</p>
<p>Your Redstoner team</p>
</div>
@@ -26,8 +26,8 @@
<p>You can contact us via:
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %>
</p>
</div>
</div>

View File

@@ -25,7 +25,7 @@
</div>
<p></p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(role: "staff"), style: "text-decoration: none; color: #4096EE;" %> in-game.</p>
<p>If you have any questions or problems, just ask one of our <%= link_to "Staff", users_url(staff: ""), style: "text-decoration: none; color: #4096EE;" %> in-game.</p>
<p>Your Redstoner team</p>
</div>
@@ -37,8 +37,8 @@
<p>You can contact us via:
<%= link_to "Website", root_url, style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Twitter", "https://twitter.com/RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Google+", "https://google.com/+Redstoner", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:redstonerserver+website@gmail.com", style: "text-decoration: none; color: #4096EE;" %>
<%= link_to "Mastodon", "https://mstdn.io/@RedstonerServer", style: "text-decoration: none; color: #4096EE;" %> |
<%= link_to "Email", "mailto:staff@redstoner.com", style: "text-decoration: none; color: #4096EE;" %>
</p>
</div>
</div>

View File

@@ -1,6 +1,6 @@
<% title "Log in" %>
<% title "Log In" %>
<h1>Log in</h1>
<h1>Log In</h1>
<p>Not a member? <%= link_to "Join us", signup_path %>!</p>
<%= form_tag login_path do |f| %>
<table>
@@ -16,6 +16,14 @@
<td></td>
<td><%= link_to "Lost your password?", lost_password_users_path %></td>
</tr>
<tr>
<td><%= label_tag :totp_code %></td>
<td><%= text_field_tag :totp_code, nil, placeholder: "123456", required: false %></td>
</tr>
<tr>
<td></td>
<td>Leave this field blank if you do not have 2FA enabled.</td>
</tr>
</table>
<p><%= submit_tag "Log in", class: "btn blue" %></p>
<% end %>

View File

@@ -1,3 +1,4 @@
<% title "Donate" %>
<h1>Donate</h1>
<p>Running a server is really stressful and requires a lot of work.<br>
@@ -11,24 +12,26 @@
<li>Donator+ ($20 or more)
</ul>
<p>We also have <%= link_to "list of users who donated", users_path(role: "donor") %> already!</p>
<p>We also have a <%= link_to "list of users who donated", users_path(donor: "") %> already!</p>
<h3>Perks for you</h3>
<p>For <i>Donator</i> and <i>Donator+</i></p>
<ul>
<li>The warm feeling of donating for a good thing, plus a huge "<b>thank you</b>"!
<li>You can have a nickname. See <%= link_to "our nickname guidelines", info_path("12-nickname-guidelines") %>
<li>You can chat in <font color="red">color</font> in-game.</i>
<li>A "$" next to your name <i>(Including website)</i>
<li><i>Donator+</i> has access to the in-game command <code>/lol id</code></li>
</ul>
<hr>
<div class="donations">
<div class="donation">
<div class="left">
<img src="<%= image_url("anonymous_skin.png") %>" alt="sponsor's skin" class="body">
<img src="https://crafatar.com/renders/body/d2693e91-93e1-4e3f-929f-f38e1ce8df03?overlay=true&scale=3" alt="sponsor's skin" class="body">
</div>
<div>
<h1>Donate to our server sponsor</h1>
<h4>They pay for our server, but prefer to stay anonymous</h4>
<h4>Pepich1851 pays for the server hardware. You can help him by donating here.</h4>
<form target="_blank" method="post" action="https://www.paypal.com/cgi-bin/webscr">
<% if current_user %>
<input name="custom" type="hidden" placeholder="Your Minecraft name" value="<%= current_user.ign %>">

View File

@@ -0,0 +1,18 @@
<% title "Who's Playing?" %>
<h1>These players are currently playing on Redstoner (<%= @count %>):</h1>
<div id="userlist">
<% @players.each do |u| %>
<div class="list-user">
<%= link_to(u.avatar(64), u) %>
<div class="detail">
<%= render partial: "users/username", locals: { user: u } %><br>
<% if u.id %>
<i><%= u.ign %></i>
<% else %>
<i>(Not signed up)</i>
<% end %>
</div>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,41 @@
<% title "Privacy Policy" %>
<h1>Privacy Policy</h1>
<p>Please note that this privacy policy is not legally binding. It is simply a reference intended to inform you about what is done with your information. Also, this privacy policy only applies to the Redstoner website and forums. The Minecraft server will have its own privacy policy at some point.</p>
<h2>How your information is stored and protected</h2>
<p>Everything on the website is stored in a database, to which access is strictly limited. Only users of the administrator rank or former administrators who are well known and are trusted by the rest of the current administrators may access the database. Offsite backups of this data are made daily only to the network and servers of at least one current administrator via an encrypted SSH connection.</p>
<p>Passwords are stored using the bcrypt algorithm. Plaintext passwords are never logged or stored anywhere.</p>
<p>The website code is <%= link_to "open source", "https://github.com/RedstonerServer/redstoner.com" %> and undergoes heavy testing and review before it is deployed to ensure no exploitable bugs or backdoors make it onto the production server.</p>
<p>All connections to our website are automatically forced to be made over HTTPS to ensure your data is protected while in transit. We maintain <%= link_to "good TLS paramters", "https://www.ssllabs.com/ssltest/analyze.html?d=redstoner.com" %> and also employ other techniques to ensure secure connections such as <%= link_to "being on the HSTS preload list", "https://hstspreload.org/?domain=redstoner.com" %> and OCSP stapling.</p>
<h2>Information we collect</h2>
<p>This information is needed in order for your account to be created:</p>
<ul>
<li>Your Minecraft account's IGN and UUID.</li>
<li>Your email address.</li>
<li>A unique password.</li>
</ul>
<p>This information is optional and is obtained only if you provide it:</p>
<ul>
<li>Your Skype username.</li>
<li>Your YouTube channel ID.</li>
<li>Your Twitter username.</li>
</ul>
<p>This information is also collected, however does not affect your Redstoner account directly:</p>
<ul>
<li>Your IP address.</li>
</ul>
<h2>How your information is used and who it is visible to</h2>
<ul>
<li><b>Minecraft account IGN and UUID</b> - This is used to link your Minecraft account with your Redstoner account. Anyone can see these.</li>
<li><b>Your email address</b> - This is used to send you email notifications about forums activity that you are involved in. These notifications can be disabled in your account settings. This is also used to perform a password reuse check, which is explained in more detail below. Only users of the moderator rank or higher can see your email address.</li>
<li><b>Your password</b> - This is used to authenticate you. This too is used to perform a password reuse check. The plaintext version is visible to no one, but the hashed version is visible only to users of the administrator rank or higher.</li>
<li><b>Your Skype username</b> - This is used to add a link to your profile that allows others to easily contact you over Skype. Anyone can see this.</li>
<li><b>Your YouTube channel</b> - This is used to add a link to your profile that allows others to easily find your YouTube channel. Anyone can see this.</li>
<li><b>Your Twitter username</b> - This is used to add a link to your profile that allows others to easily contact you over Twitter. Anyone can see this.</li>
<li><b>Your IP address</b> - This is used to help us identify and ban troublemakers from our forums. Only users of the moderator rank and above can see this.</li>
</ul>
<h2>Password reuse check</h2>
<p>When you first sign up on our website, we use your email address and password to check if you are reusing your password with your Mojang account. This is done by attempting to log into Mojang's server using this information. If it succeeds, then your confirmation email will contain a note warning you not to reuse your password. <b>The information used to perform this check is never used to actually take over your Minecraft account. In fact, we can't because your password is hashed after the check and is totally unusable to us. If you get this warning not to reuse your password, it is still highly recommended that you change your password for your Mojang account and also use a password manager.</b></p>
<h2>Who your information is shared with</h2>
<p>We do not share your information with any third parties. The only time we will release information is if we are legally required to.</p>
<hr>
<p><sup>This privacy policy was last revised October 31, 2017.</sup></p>

View File

@@ -1,4 +1,19 @@
<%= form_for [reply.thread, reply] do |f| %>
<%= render partial: "md_editor", locals: {name: "threadreply[content]", content: reply.content} %>
<p><%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue" %></p>
<% nec_msg = "" %>
<% forum = Forum.find(reply.thread.forum_id) %>
<% if forum.necro_length %>
<% if reply.thread.label.try(:name).try(:downcase) == "closed" %>
<% nec_msg = "This thread is closed. Are you sure you want to make this reply? If so, press 'Ok'" %>
<% elsif Threadreply.where(forumthread: reply.thread).any? %>
<% prevAgo = Threadreply.where(forumthread: reply.thread).order(:id).last.created_at %>
<% if prevAgo <= forum.necro_length.days.ago.utc %>
<% nec_msg = "You may be necroposting, as the last reply was made at least #{forum.necro_length} days ago. If you still wish to make this reply, press 'Ok'." %>
<% end %>
<% elsif reply.thread.created_at <= forum.necro_length.days.ago.utc %>
<% nec_msg = "You may be necroposting, as this thread was posted at least #{forum.necro_length} days ago. If you still wish to make this reply, press 'Ok'." %>
<% end %>
<% end %>
<p><%= f.submit "Reply#{ ' (Locked)' if reply.thread.locked? }", class: "btn blue", data: { confirm: nec_msg } %></p>
<% nec_msg = "" %>
<% end %>

View File

@@ -1,15 +1,15 @@
<% title "Edit Thread Reply: #{@reply.thread.title}" %>
<% title "Edit Reply: #{@reply.thread.title}" %>
<%
position = @reply.thread.replies.index(@reply)
position = @reply.thread.replies.order(:id).index(@reply)
page = position / Kaminari.config.default_per_page + 1
%>
<%= link_to @reply.thread.forum.group, forumgroup_path(@reply.thread.forum.group) %> → <%= link_to @reply.thread.forum, @reply.thread.forum %> → <%= link_to @reply.thread, forumthread_path(@reply.thread, page: page) + "#reply-#{@reply.id}" %> → Edit reply
<h1>Edit reply</h1>
<h1>Edit Reply</h1>
<%= form_for [@reply.thread, @reply] do |f| %>
<%= render partial: "md_editor", locals: {name: "threadreply[content]", content: @reply.content} %>
<p><%= f.submit "Reply", class: "btn blue left" %></p>
<% end %>
<p><%= button_to "Delete reply", [@reply.thread, @reply], method: "delete", data: {confirm: "Delete reply forever?"}, class: "btn red right" %></p>
<p><%= button_to "Delete Reply", [@reply.thread, @reply], method: "delete", data: {confirm: "Delete reply forever?"}, class: "btn red right" %></p>
<div class="clear"></div>

View File

@@ -1,4 +1,6 @@
<div class="user">
<%= link_to user.name, user, class: "role #{user.role.name} #{"banned" if user.banned?} #{"disabled" if user.disabled?} #{"unconfirmed" unless user.confirmed?}", title: "#{user.ign} #{user.role}", style: "color: #{fcolor(user.role.color)}; background-color: #{user.role.color}" %>
<%= link_to "$", donate_statics_path, class: "role donor", title: "Donator" if user.donor? %>
<% if user.badge %>
<%= link_to user.badge.symbol, users_path(badge: user.badge.name), class: "role badge", title: user.badge.name, style: "color: #{fcolor(user.badge.color)}; background-color: #{user.badge.color}" unless user.badge.symbol.blank? %>
<% end %>
</div>

View File

@@ -1,6 +1,6 @@
<% title "Change Password" %>
<h1>Change password</h1>
<h1>Change Password</h1>
<%= form_for @user do |f| %>
<%= f.text_field :current_password %>

View File

@@ -7,7 +7,7 @@
%>
<%= link_to @user.name, @user %> → Edit
<h1>Edit profile</h1>
<h1>Edit Profile</h1>
<%= form_for @user do |f| %>
<table>
@@ -27,29 +27,25 @@
<% end %>
</td>
</tr>
<tr>
<td>Badge</td>
<td>
<% if current_user.role >= Role.get(:mod) %>
<%= f.select :badge, Badge.all %>
<% end %>
</td>
</tr>
<tr>
<td>Confirmed email address</td>
<td>
<%= f.select :confirmed, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
</td>
</tr>
<tr>
<td>Donator</td>
<td>
<%= f.select :donor, [["No", false], ["Yes", true]], {}, { disabled: !can_edit? } %>
</td>
</tr>
<% end %>
<tr>
<td>Skype username</td>
<td>Discord username</td>
<td>
<%= f.text_field :skype, placeholder: "Skype username", disabled: !can_edit? %>
</td>
</tr>
<tr>
<td>Show Skype to</td>
<td>
<%= f.select :skype_public, [["Staff only", false], ["All users", true]], {}, { disabled: !can_edit? } %>
<%= f.text_field :discord, placeholder: "Discord username", disabled: !can_edit? %>
</td>
</tr>
<tr>
@@ -73,10 +69,11 @@
</tbody>
</table>
<p><%= f.submit "Save profile", class: "btn blue left", disabled: (!@user.confirmed? && @user.is?(current_user)) %></p>
<p><%= f.submit "Save Profile", class: "btn variable-size left", disabled: (!@user.confirmed? && @user.is?(current_user)) %></p>
<p>
<%= link_to "Edit login details", edit_login_user_path(@user), class: "btn blue right" %>
<%= link_to "Notification settings", edit_notifications_user_path(@user), class: "btn blue right" %>
<%= link_to "Login Settings", edit_login_user_path(@user), class: "btn variable-size right" %>
<%= link_to "Notification Settings", edit_notifications_user_path(@user), class: "btn variable-size right" %>
<%= link_to "Website Settings", edit_website_settings_user_path(@user), class: "btn variable-size right" %>
</p>
<div class="clear"></div>

View File

@@ -1,7 +1,7 @@
<% title "Edit Login Credentials: #{@user.name}" %>
<%= link_to @user.name, @user %> → Edit Login credentials
<h1>Edit Login credentials</h1>
<%= link_to @user.name, @user %> → Edit Login settings
<h1>Edit Login Settings</h1>
<%= form_for @user, url: update_login_user_path(@user), method: :put do |f| %>
@@ -25,14 +25,51 @@
<%= f.password_field :password_confirmation %>
</td>
</tr>
</tbody>
</table>
<hr>
<table>
<tbody>
<tr>
<td>2FA Enabled</td>
<td>
<%= f.check_box :totp_enabled %>
</td>
</tr>
<tr>
<td>TOTP Secret</td>
<td>
<% if !@user.totp_enabled? %>
<%= f.text_field :totp_secret, :readonly => true %>
<% else %>
<i>2FA is currently enabled. Disable 2FA to generate a new secret.</i>
<% end %>
</td>
</tr>
</tbody>
</table>
<hr>
<table>
<tbody>
<tr>
<td>Current password</td>
<td>
<%= password_field_tag :current_password, nil, disabled: !@user.is?(current_user) %>
</td>
</tr>
<% if !@user.totp_enabled? %>
<tr>
<td>TOTP Code</td>
<td>
<%= text_field_tag :totp_code, nil, disabled: !@user.is?(current_user) %>
</td>
</tr>
<tr>
<td></td>
<td><i>Leave this field blank if you are not enabling 2FA.</i></td>
<% end %>
</tbody>
</table>
<p><%= f.submit "Save changes", class: "btn blue left" %></p>
<p><%= f.submit "Save Changes", class: "btn blue left" %></p>
<div class="clear"></div>
<% end %>

View File

@@ -45,6 +45,9 @@
</tr>
</tbody>
</table>
<p><%= f.submit "Save changes", class: "btn blue left" %></p>
<h3>Public Key</h1>
<p>All notification emails will be encrypted with this key if you supply it.</p>
<%= f.text_area :public_key, placeholder: "-----BEGIN PGP PUBLIC KEY BLOCK-----" %>
<p><%= f.submit "Save Changes", class: "btn blue left" %></p>
<div class="clear"></div>
<% end %>

View File

@@ -0,0 +1,32 @@
<% title "Edit Website Settings: #{@user.name}" %>
<%= link_to @user.name, @user %> → Edit Website Settings
<h1>Edit Website Settings</h1>
<%= form_for @user do |f| %>
<table>
<tbody>
<tr>
<td>Header moves with scrolling</td>
<td>
<%= f.check_box :header_scroll %>
</td>
</tr>
<tr>
<td>Show exact UTC times</td>
<td>
<%= f.check_box :utc_time %>
</td>
</tr>
<tr>
<td>Dark theme</td>
<td>
<%= f.check_box :dark %>
</td>
</tr>
</tbody>
</table>
<p><%= f.submit "Save Changes", class: "btn blue left" %></p>
<div class="clear"></div>
<% end %>

View File

@@ -1,12 +1,34 @@
<%= form_tag(users_path, method: :get) do %>
<%= text_field_tag "search", params[:search], placeholder: "Search for a user", class: "searchfield field" %>
<%= submit_tag "Go", class: "searchfield btn", name: nil %>
<%= hidden_field_tag "role", params[:role] if params[:role] %>
<%= hidden_field_tag "badge", params[:badge] if params[:badge]%>
<% end %>
<h1>
<% if params[:role] %>
<%= title "All '#{params[:role]}' users" %>
<%
if params[:role] && !params[:badge]
text = "All '#{params[:role]}' users"
elsif params[:badge] && !params[:role]
text = "All '#{params[:badge]}' users"
elsif params[:role] && params[:badge]
text = "All '#{params[:role]}' and '#{params[:badge]}' users"
elsif params.include?(:staff)
text = "All staff"
elsif params.include?(:donor)
text = "All donors"
else
text = "All users"
end
text += " that contain '#{params[:search]}'" if params[:search]
%>
<%= title text %>
<% if params[:search] %>
(<%= @users.total_count %>)
<% else %>
<%= title "All Users" %>
(<%= @count %>)
<% end %>
(<%= @count %>)
</h1>
<%= link_to "show all", users_path if params[:role] %>
<%= link_to "show all", users_path if params[:role] || params[:badge] %>
<div id="userlist">
<% @users.each do |u| %>

View File

@@ -1,6 +1,6 @@
<% title "Reset password" %>
<% title "Reset Password" %>
<h1>Reset password</h1>
<h1>Reset Password</h1>
<p>You lost your password? Don't do that!</p>
<p>Luckily for you, you can reset your password. Please use the command <code>/gettoken &lt;your email address&gt;</code>, then fill in the form below:</p>
<%= form_tag reset_password_users_path do |f| %>
@@ -22,5 +22,5 @@
<td><%= password_field_tag :new_password, nil, placeholder: "secret", required: true, pattern: ".{8,}", title: "minimum 8 characters", "x-moz-errormessage" => "minimum 8 characters" %></td>
</tr>
</table>
<p><%= submit_tag "Reset password", class: "btn blue" %></p>
<p><%= submit_tag "Reset Password", class: "btn blue" %></p>
<% end %>

View File

@@ -1,6 +1,6 @@
<% title "Sign up" %>
<% title "Sign Up" %>
<h1>Sign up</h1>
<h1>Sign Up</h1>
<%= form_for @user do |f| %>
<table>
@@ -38,7 +38,7 @@
You can find more details in our info page about <a href="/info/15">tokens and website registration</a>.
</p>
<%= f.submit "Sign up", class: "btn blue" %>
<%= f.submit "Sign Up", class: "btn blue" %>
<p>Contact us ingame if you have problems singing up!</p>
<p>Contact us ingame if you have problems signing up!</p>
<% end %>

View File

@@ -15,15 +15,17 @@
<h1><%= @user.name %></h1>
<div class="clear"></div>
<% if @user.banned? %>
<span class="user-banned">This user is banned!</span>
<% if @ban_json && (@ban_json["expires"] == "forever" || !(DateTime.parse(@ban_json["expires"]) <= DateTime.now)) %>
<span class="user-banned">This user is banned on the server for "<%=@ban_json["reason"]%>"<%=" until #{@ban_json["expires"]}" unless @ban_json["expires"] == "forever"%></span>
<% end %>
<% if @user.banned? %>
<span class="user-banned">This user is banned on the website!</span>
<% end %>
<br>
<% if !@user.confirmed? %>
<% if @user.is?(current_user) || mod? %>
<span class="user-unconfirmed">Please confirm your email <u><%= @user.email %></u> !</span>
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn dark", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
<%= button_to "Resend the confirmation mail", resend_mail_user_path, class: "btn blue", form_class: "inline-block", data: {confirm: "Did you check your spam folder?"} %>
<% else %>
<span class="user-unconfirmed">This user hasn't confirmed their email yet!</span>
<% end %>
@@ -52,10 +54,10 @@
<td><b>Role</b></td>
<td><%= link_to @user.role, users_path(:role => @user.role.name) %></td>
</tr>
<% if current_user && !@user.skype.blank? && (@user.skype_public || current_user == @user || mod?) %>
<% if current_user && !@user.discord.blank? %>
<tr>
<td><b>Skype</b></td>
<td><%= link_to @user.skype, "skype:#{@user.skype}?chat", target: "_blank" %></a></td>
<td><b>Discord</b></td>
<td><%= @user.discord %></td>
</tr>
<% end %>
<% if !@user.youtube.blank? && !@user.youtube_channelname.blank? %>
@@ -80,6 +82,16 @@
<td><b>Joined</b></td>
<td><%= ago @user.created_at %></td>
</tr>
<tr>
<td><b>Last seen</b></td>
<td>
<% if @user.last_seen %>
<%= ago @user.last_seen %>
<% else %>
Never
<% end %>
</td>
</tr>
<% if mod? || @user.is?(current_user) %>
<tr>
<td><b>Last IP</b></td>
@@ -89,16 +101,6 @@
<td><b>Email</b></td>
<td><%= mail_to @user.email, @user.email, :subject => "Redstoner" %></td>
</tr>
<tr>
<td><b>Last seen</b></td>
<td>
<% if @user.last_seen %>
<%= ago @user.last_seen %>
<% else %>
Never
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>

View File

@@ -1,5 +1,5 @@
# config valid only for current version of Capistrano
lock '3.4.0'
lock '3.11.0'
set :repo_url, 'https://github.com/RedstonerServer/redstoner.com'
@@ -13,9 +13,9 @@ set :default_environment, {
set :keep_releases, 5
set :deploy_to, -> { "/home/www-data/apps/#{fetch(:application)}" }
set :deploy_to, -> { "/var/www/#{fetch(:application)}" }
set :rbenv_ruby, '2.0.0-p648'
set :rbenv_ruby, '2.5.0-dev'
set :bundle_without, %w{development test}.join(' ')

View File

@@ -6,6 +6,8 @@ Redstoner::Application.configure do
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.action_controller.perform_caching = true
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
@@ -35,12 +37,12 @@ Redstoner::Application.configure do
}
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "google.com",
authentication: "plain",
user_name: "redstonerserver@gmail.com",
password: ENV["GMAIL_PASSWORD"],
address: ENV["SMTP_ADDRESS"],
port: ENV["SMTP_PORT"],
domain: "redstoner.com",
authentication: ENV["SMTP_AUTH"],
user_name: ENV["SMTP_USERNAME"],
password: ENV["SMTP_PASSWORD"],
}
end

View File

@@ -71,12 +71,12 @@ Redstoner::Application.configure do
}
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "google.com",
authentication: "plain",
user_name: "redstonerserver@gmail.com",
password: ENV["GMAIL_PASSWORD"],
address: ENV["SMTP_ADDRESS"],
port: ENV["SMTP_PORT"],
domain: "redstoner.com",
authentication: ENV["SMTP_AUTH"],
user_name: ENV["SMTP_USERNAME"],
password: ENV["SMTP_PASSWORD"],
}
end

View File

@@ -0,0 +1 @@
Rails.application.config.assets.precompile += %w( dark.css )

View File

@@ -4,10 +4,12 @@ Redstoner::Application.routes.draw do
resources :comments
end
resources :statics, only: [:home, :donate], path: '/' do
resources :statics, only: [:home, :donate, :online], path: '/' do
collection do
get 'donate'
get 'home'
get 'online'
get 'privacy'
get 'index'
end
end
@@ -21,6 +23,7 @@ Redstoner::Application.routes.draw do
post 'resend_mail'
get 'edit_notifications'
put 'update_login'
get 'edit_website_settings'
end
collection do
get 'lost_password'
@@ -30,10 +33,13 @@ Redstoner::Application.routes.draw do
end
resources :forumgroups, path: '/forums/groups'
resources :forums, path: '/forums'
resources :forumthreads, path: '/forums/threads' do
resources :threadreplies, path: 'replies'
collection do
get 'search'
end
end
resources :forums, path: '/forums'
resources :tools do
collection do

View File

@@ -3,8 +3,8 @@ timeout 15
preload_app true
stderr_path "/home/www-data/apps/redstoner/shared/log/unicorn.stderr.log"
stdout_path "/home/www-data/apps/redstoner/shared/log/unicorn.stdout.log"
stderr_path "/var/www/redstoner/shared/log/unicorn.stderr.log"
stdout_path "/var/www/redstoner/shared/log/unicorn.stdout.log"
before_fork do |server, worker|
Signal.trap 'TERM' do

View File

@@ -0,0 +1,17 @@
class AddBadgeIdToUsers < ActiveRecord::Migration
def change
create_table "badges", force: :cascade do |t|
t.string "name"
t.string "symbol"
t.string "color"
end
Badge.create!({name: "none", symbol: "", color: "#000"})
dbadge = Badge.create!({name: "donor", symbol: "$", color: "#f60"})
add_column :users, :badge_id, :integer, default: 1
User.where(donor: true).update_all(badge_id: dbadge.id)
remove_column :users, :donor
end
end

View File

@@ -0,0 +1,5 @@
class AddUtcTimeToUsers < ActiveRecord::Migration
def change
add_column :users, :utc_time, :boolean, default: false
end
end

View File

@@ -0,0 +1,5 @@
class AddHeaderScrollToUsers < ActiveRecord::Migration
def change
add_column :users, :header_scroll, :boolean, default: false
end
end

View File

@@ -0,0 +1,5 @@
class AddNecroLengthToForums < ActiveRecord::Migration
def change
add_column :forums, :necro_length, :integer
end
end

View File

@@ -0,0 +1,5 @@
class AddDarkToUsers < ActiveRecord::Migration
def change
add_column :users, :dark, :boolean, default: false
end
end

View File

@@ -0,0 +1,8 @@
class AddSearchIndexes < ActiveRecord::Migration
def change
add_index :forumthreads, [:title, :content], type: :fulltext
add_index :forumthreads, :title, type: :fulltext
add_index :forumthreads, :content, type: :fulltext
add_index :threadreplies, :content, type: :fulltext
end
end

View File

@@ -0,0 +1,5 @@
class AddIndexForumthreadIdOnThreadreplies < ActiveRecord::Migration
def change
add_index :threadreplies, :forumthread_id
end
end

View File

@@ -0,0 +1,6 @@
class RemoveSkypeVisibilityFromUsers < ActiveRecord::Migration
def change
remove_column :users, :skype_public
User.update_all skype: nil
end
end

View File

@@ -0,0 +1,5 @@
class AddPublicKeyToUsers < ActiveRecord::Migration
def change
add_column :users, :public_key, :text
end
end

View File

@@ -0,0 +1,6 @@
class AddTotpToUsers < ActiveRecord::Migration
def change
add_column :users, :totp_secret, :string
add_column :users, :totp_enabled, :boolean, default: false
end
end

View File

@@ -0,0 +1,5 @@
class DropForumsLabels < ActiveRecord::Migration
def change
drop_table :forums_labels
end
end

View File

@@ -0,0 +1,6 @@
class RemoveSkypeAddDiscordFromUsers < ActiveRecord::Migration
def change
remove_column :users, :skype
add_column :users, :discord, :string
end
end

View File

@@ -0,0 +1,5 @@
class DisableDeletionForums < ActiveRecord::Migration
def change
add_column :forums, :disable_deletion, :boolean
end
end

View File

@@ -11,11 +11,18 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20160926220738) do
ActiveRecord::Schema.define(version: 20190224093907) do
create_table "badges", force: :cascade do |t|
t.string "name", limit: 191
t.string "symbol", limit: 191
t.string "color", limit: 191
t.integer "value", limit: 4
end
create_table "blogposts", force: :cascade do |t|
t.string "title"
t.text "content", limit: 65535
t.string "title", limit: 255
t.text "content", limit: 16777215
t.integer "user_author_id", limit: 4
t.integer "user_editor_id", limit: 4
t.datetime "created_at"
@@ -23,7 +30,7 @@ ActiveRecord::Schema.define(version: 20160926220738) do
end
create_table "comments", force: :cascade do |t|
t.text "content", limit: 65535
t.text "content", limit: 16777215
t.integer "user_author_id", limit: 4
t.integer "user_editor_id", limit: 4
t.integer "blogpost_id", limit: 4
@@ -32,30 +39,27 @@ ActiveRecord::Schema.define(version: 20160926220738) do
end
create_table "forumgroups", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.integer "position", limit: 4
t.integer "role_read_id", limit: 4
t.integer "role_write_id", limit: 4
end
create_table "forums", force: :cascade do |t|
t.string "name"
t.integer "position", limit: 4
t.integer "role_read_id", limit: 4
t.integer "role_write_id", limit: 4
t.integer "forumgroup_id", limit: 4
end
create_table "forums_labels", id: false, force: :cascade do |t|
t.integer "forum_id", limit: 4
t.integer "label_id", limit: 4
t.string "name", limit: 255
t.integer "position", limit: 4
t.integer "role_read_id", limit: 4
t.integer "role_write_id", limit: 4
t.integer "forumgroup_id", limit: 4
t.integer "necro_length", limit: 4
t.boolean "disable_deletion", default: false
end
create_table "forumthreads", force: :cascade do |t|
t.string "title"
t.text "content", limit: 65535
t.boolean "sticky", default: false
t.boolean "locked", default: false
t.string "title", limit: 255
t.text "content", limit: 16777215
t.boolean "sticky", default: false
t.boolean "locked", default: false
t.integer "user_author_id", limit: 4
t.integer "user_editor_id", limit: 4
t.integer "forum_id", limit: 4
@@ -64,44 +68,50 @@ ActiveRecord::Schema.define(version: 20160926220738) do
t.integer "label_id", limit: 4
end
add_index "forumthreads", ["content"], name: "index_forumthreads_on_content", type: :fulltext
add_index "forumthreads", ["title", "content"], name: "forumthreads_title_content", type: :fulltext
add_index "forumthreads", ["title", "content"], name: "index_forumthreads_on_title_and_content", type: :fulltext
add_index "forumthreads", ["title"], name: "index_forumthreads_on_title", type: :fulltext
create_table "info", force: :cascade do |t|
t.string "title"
t.text "content", limit: 65535
t.string "title", limit: 255
t.text "content", limit: 16777215
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "labels", force: :cascade do |t|
t.string "name"
t.string "color"
t.string "name", limit: 255
t.string "color", limit: 255
end
create_table "register_tokens", force: :cascade do |t|
t.string "uuid", null: false
t.string "token", null: false
t.string "email", null: false
t.string "uuid", limit: 32, null: false
t.string "token", limit: 6, null: false
t.string "email", limit: 191
end
add_index "register_tokens", ["email"], name: "index_register_tokens_on_email", unique: true, using: :btree
add_index "register_tokens", ["uuid"], name: "index_register_tokens_on_uuid", unique: true, using: :btree
create_table "roles", force: :cascade do |t|
t.string "name"
t.string "name", limit: 255
t.integer "value", limit: 4
t.string "color"
t.string "color", limit: 255
end
create_table "sessions", force: :cascade do |t|
t.string "session_id", null: false
t.text "data", limit: 65535
t.string "session_id", limit: 255, null: false
t.text "data", limit: 16777215
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", using: :btree
add_index "sessions", ["session_id"], name: "index_sessions_on_session_id", length: {"session_id"=>191}, using: :btree
add_index "sessions", ["updated_at"], name: "index_sessions_on_updated_at", using: :btree
create_table "threadreplies", force: :cascade do |t|
t.text "content", limit: 65535
t.text "content", limit: 16777215
t.integer "user_author_id", limit: 4
t.integer "user_editor_id", limit: 4
t.integer "forumthread_id", limit: 4
@@ -109,21 +119,21 @@ ActiveRecord::Schema.define(version: 20160926220738) do
t.datetime "updated_at"
end
add_index "threadreplies", ["content"], name: "index_threadreplies_on_content", type: :fulltext
add_index "threadreplies", ["forumthread_id"], name: "index_threadreplies_on_forumthread_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "uuid", null: false
t.string "name", null: false
t.string "password_digest", null: false
t.string "ign", null: false
t.string "email", null: false
t.string "uuid", limit: 255, null: false
t.string "name", limit: 191
t.string "password_digest", limit: 255, null: false
t.string "ign", limit: 255, null: false
t.string "email", limit: 191
t.text "about", limit: 65535
t.string "last_ip"
t.string "skype"
t.boolean "skype_public", default: false
t.string "youtube"
t.string "youtube_channelname"
t.string "twitter"
t.boolean "donor", default: false
t.string "email_token"
t.string "last_ip", limit: 255
t.string "youtube", limit: 255
t.string "youtube_channelname", limit: 255
t.string "twitter", limit: 255
t.string "email_token", limit: 255
t.boolean "confirmed", default: false
t.datetime "last_seen"
t.integer "role_id", limit: 4, null: false
@@ -134,12 +144,20 @@ ActiveRecord::Schema.define(version: 20160926220738) do
t.boolean "mail_own_blogpost_comment", default: true
t.boolean "mail_other_blogpost_comment", default: true
t.boolean "mail_mention", default: true
t.integer "badge_id", limit: 4, default: 0
t.boolean "utc_time", default: false
t.boolean "header_scroll", default: false
t.boolean "dark", default: false
t.text "public_key", limit: 65535
t.string "totp_secret", limit: 255
t.boolean "totp_enabled", default: false
t.string "discord", limit: 191
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["ign"], name: "index_users_on_ign", unique: true, using: :btree
add_index "users", ["name"], name: "index_users_on_name", unique: true, using: :btree
add_index "users", ["skype"], name: "index_users_on_skype", unique: true, using: :btree
add_index "users", ["discord"], name: "index_users_on_discord", unique: true, using: :btree
add_index "users", ["twitter"], name: "index_users_on_twitter", unique: true, using: :btree
add_index "users", ["uuid"], name: "index_users_on_uuid", unique: true, using: :btree
add_index "users", ["youtube"], name: "index_users_on_youtube", unique: true, using: :btree

View File

@@ -10,6 +10,14 @@ Role.create!([
{name: "superadmin", value: 500, color: "#d22"}
])
Badge.create!([
{name: "none", symbol: "", color: "#000"},
{name: "donor", symbol: "$", color: "#f60"},
{name: "developer", symbol: "D", color: "#a0a"},
{name: "retired", symbol: "R", color: "#0aa"},
{name: "lead", symbol: "L", color: "#a00"}
])
userpw = SecureRandom.hex(36)
@@ -23,19 +31,13 @@ deleted_user = User.create!(
password: userpw,
password_confirmation: userpw,
role: Role.get(:disabled),
skype: "echo123",
skype_public: true,
badge: Badge.get(:none),
discord: "echo123#9804",
last_ip: "0.0.0.0",
confirmed: true,
last_seen: Time.utc(0).to_datetime
last_seen: Time.utc(0).to_datetime,
header_scroll: false,
utc_time: false,
dark: false
)
deleted_user.update_attribute(:ign, "Steve")
User.create!(
uuid: "ae795aa86327408e92ab25c8a59f3ba1",
ign: "jomo",
email: "jomo@example.com",
password: "123456789", # high seructity!
password_confirmation: "123456789",
role: Role.get(:superadmin)
)

View File

@@ -0,0 +1,18 @@
desc "Creates a superadmin user. Usage: rake create:create_admin_user[uuid, ign, email, pass]"
namespace :create do
task :create_admin_user, [:uuid, :ign, :email, :pass] => :environment do |task, args|
User.create!(
uuid: args.uuid,
ign: args.ign,
email: args.email,
password: args.pass,
password_confirmation: args.pass,
role: Role.get(:superadmin),
header_scroll: false,
utc_time: false,
dark: false,
badge: Badge.get(:none),
confirmed: true
)
end
end