Commit 3e0e5506 authored by David Lucadou's avatar David Lucadou

Added more config file options, updated readme

I added more troubleshooting to the readme and more config file options
for TOTP issuer name, enabling/disabling image embeds (and their
maximum width), and HTML you can easily append to the footer.
Also, added some items to the gitignore so production servers won't show
tons of changes in git status.
parent a781da85
Pipeline #62282223 canceled with stage
......@@ -17,6 +17,12 @@
!/tmp/.keep
/config/config.yml
/config/secrets.yml
# Ignore logs in production mode using Nginx
/shared
# Artifacts generated by asset precompilation
/public/assets/*.css
/public/assets/*.gz
/public/assets/*.js
/node_modules
/yarn-error.log
......
......@@ -3,11 +3,13 @@ All notable changes to this project will be documented in this file.
## [0.8.8] - 2019-??-??
### Added
- Ability to enable image embeds and their max width in config file
- Help page for supported Markdown
- Three new themes - Minty, Midnight, and Whiteout
- Tests for the new themes
- Basic messaging system
- Help page for supported Markdown
- Basic messaging system (#81)
- Contact form for admins (#13)
- Markdown for messaging system
- Tests for chat log permissions
......@@ -16,7 +18,6 @@ All notable changes to this project will be documented in this file.
- Ability to update the TOS via admin console (#13)
- Admin console application settings panel (#13)
- Compact tables user preference (#58)
- Contact form for admins (#13)
- Default flash classes (#69)
- Display most recent edit date and justification for chat logs
- Display users a person has banned on their profile (#66)
......
......@@ -284,7 +284,7 @@ If anyone knows what causes this, please let me know, it might help track down t
I am using Puma with Nginx as a reverse proxy, as it allows for good performance and easy HTTPS setup. I'm basing these instructions off of [this guide](https://igotablog.com/using-puma-with-nginx/), but have changed it a fair amount since it was written in 2013, and is somewhat out of date.
These instructions you have already installed Nginx, opened the appropriate ports, and confirmed you can access the Nginx default webpage. These instructions also assume you have run the relevant `rake db` commands and `rake assets:precompile` (in production mode), and that you have confirmed the system runs in development mode.
These instructions you have already installed Nginx, opened the appropriate ports, and confirmed you can access the Nginx default webpage. These instructions also assume you have run the relevant `rake db` commands and `rake assets:precompile` (in production mode - set the `RAILS_ENV` environment variable beforehand), and that you have confirmed the system runs in development mode.
1. Open the file `/etc/nginx/sites-available/[your.domain.here]` (you'll probably need to open it with sudo to write to it) and add the following:
......@@ -538,6 +538,27 @@ Past this, I have not encountered any other causes of 504 errors. `less`-ing the
------
> There are weird CSS and JS errors that I can't reproduce in development mode.
This is usually caused by compiling assets without the `RAILS_ENV` environment variable being set. There are 2 ways to do this:
1. Set the environment varaible and re-compile your assets:
```bash
export RAILS_ENV="production"
bundler exec rake assets:precompile
```
2. Or preface the command with the variable:
```bash
RAILS_ENV="production" bundler exec rake assets:precompile
```
When it finishes, make sure to restart the application for the changes to take effect. The problems should be fixed. (I recommend setting the environment variable in your .bashrc or other RC file so you do not have to worry about this in the future.)
------
> Why did you make this?
I wanted an IRC log viewer that worked with a remote database because pgAdmin 4 is buggy and slow (and updating my IP in my AWS VPC security groups every time it changes is a bit annoying). I went looking around, and the few viewers I found that worked with remote databases were all old (and looked old) or they used some weird schemas I didn't feel like adapting. The rest of the viewers I found were programs for viewing your local mIRC, IRSSI, etc. logs.
......
......@@ -618,7 +618,7 @@ class RegistrationsController < Devise::RegistrationsController
end
def build_qr_code(type: :svg)
issuer = "IRC Log Viewer (Dev)"
issuer = Rails.configuration.application['users']['totp']['issuer_name']
uri = current_user.otp_provisioning_uri("#{issuer}:#{current_user.email}", issuer: issuer)
Base64.encode64(RQRCode::render_qrcode(uri, type, level: :m, unit: 3, fill: 'ffffff'))
# Fill color prevents the QR code from being unreadable with Solarized &
......
......@@ -49,7 +49,11 @@ module ApplicationHelper
end
def self.image_embeds_allowed
true
Rails.configuration.application['messages']['images']['embed_allowed']
end
def self.image_embed_max_size
Rails.configuration.application['messages']['images']['embed_max_width'] # Set by config variable
end
#def link(text, target, attributes = {})
......
......@@ -18,6 +18,13 @@ module RedcarpetHelper
"</code>"
end
def image(link, title, alt_text)
max_width = "style=\"max-width: #{ApplicationHelper.image_embed_max_size};\"" if ApplicationHelper.image_embed_max_size
"<img class=\"img-fluid\" src=\"#{link}\" title=\"#{title}\"" \
"alt=\"#{alt_text}\" #{max_width}" \
">"
end
def table(header, body)
"<table class=\"table table-striped table-bordered\">" \
"#{header}#{body}" \
......
......@@ -25,7 +25,7 @@
<br />
<br />
<div class="justify-content-center text-center">
<p>© 2019 <a href="https://dl.codes/">David Lucadou</a> | <a href="https://gitlab.com/dlucadou/irc-log-explorer">Source Code</a> | <%= link_to 'Terms of Service', policy_tos_path %></p>
<p>© 2019 <a href="https://dl.codes/">David Lucadou</a> | <a href="https://gitlab.com/dlucadou/irc-log-explorer">Source Code</a> | <%= link_to 'Terms of Service', policy_tos_path %><%= " | #{Rails.configuration.application['footer']['append']}" if Rails.configuration.application['footer']['append'].to_s.length > 0 %></p>
</div>
<br />
</div>
......
......@@ -214,7 +214,7 @@ It's not going to be what you expect.</pre>
<%= markdown("![Shopping cart turf war](https://i.redd.it/njgmk8xti1z21.jpg \"hmmm\")") %>
</li>
<li>You can also create links you can click on on images using the syntax <code>[![image alt-text](link/to/image "img title text")](link/when/clicked/on)</code>:
<pre class="codeblock-fenced">[![UNC Charlotte, viewed from the 10th floor of the library overlooking Woodward, CHHS, COED, and the Student Union](https://i.imgur.com/gjO7WLo.jpg "Picture of UNCC, photographer unknown")](https://www.uncc.edu/)</pre>
<pre class="codeblock-fenced">[![UNC Charlotte, viewed from the 10th floor of the library overlooking Woodward, CHHS, COED, and the Student Union](https://i.imgur.com/gjO7WLo.jpg "Picture of UNCC before the building of the Health and Wellness Center, date & photographer unknown")](https://www.uncc.edu/)</pre>
<%= markdown("[![UNC Charlotte, viewed from the 10th floor of the library overlooking Woodward, CHHS, COED, and the Student Union](https://i.imgur.com/gjO7WLo.jpg \"Picture of UNCC from the 10th floor of the library, photographer unknown\")](https://www.uncc.edu/)") %>
</li>
<li>Reference-style images are also supported using the syntax <code>![alt-text][Case Insensitive Reference]</code>, followed by <code>[case iNseNsitive reference]: link/to/image "title text"</code> on another line:
......@@ -338,6 +338,9 @@ column alignments | like this middle | column does</pre>
<li>The basic syntax for superscripts is just <code>a^b</code>:
<pre class="codeblock-fenced">a^b^c^d^e</pre>
<%= markdown("a^b^c^d^e") %>
<% if !ApplicationHelper.image_embeds_allowed %>
<li>Image embeds have been disabled by the administrator.</li>
<% end %>
</li>
<li>If you want to spread the superscript across multiple words, use parenthesis or raise each word to the appropriate superscript:
<pre class="codeblock-fenced">This^(uses parenthesis), but^this ^does ^^not</pre>
......
default: &default
footer:
append: 'Development Mode'
messages:
images:
embed_allowed: true
embed_max_width: '50% (you can use px, em, etc but % is recommended - smaller screen sizes might stretch the image if you use units besides %, or just set to null and it will expand until it fills the screen or reaches its actual size)'
users:
passwords:
min_length: 16
......@@ -14,6 +20,7 @@ default: &default
twitch_enabled: true
totp:
generate_png_qrcodes: true
issuer_name: 'IRC Log Viewer'
development:
<<: *default
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment