--- /dev/null
+# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
+
+# Ignore git directory.
+/.git/
+/.gitignore
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all default key files.
+/config/master.key
+/config/credentials/*.key
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/.keep
+
+# Ignore assets.
+/node_modules/
+/app/assets/builds/*
+!/app/assets/builds/.keep
+/public/assets
+
+# Ignore CI service files.
+/.github
+
+# Ignore development files
+/.devcontainer
+
+# Ignore Docker-related files
+/.dockerignore
+/Dockerfile*
--- /dev/null
+# See https://git-scm.com/docs/gitattributes for more about git attribute files.
+
+# Mark the database schema as having been generated.
+db/schema.rb linguist-generated
+
+# Mark any vendored files as having been vendored.
+vendor/* linguist-vendored
+config/credentials/*.yml.enc diff=rails_credentials
+config/credentials.yml.enc diff=rails_credentials
--- /dev/null
+version: 2
+updates:
+- package-ecosystem: bundler
+ directory: "/"
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 10
+- package-ecosystem: github-actions
+ directory: "/"
+ schedule:
+ interval: daily
+ open-pull-requests-limit: 10
--- /dev/null
+name: CI
+
+on:
+ pull_request:
+ push:
+ branches: [ main ]
+
+jobs:
+ scan_ruby:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: .ruby-version
+ bundler-cache: true
+
+ - name: Scan for common Rails security vulnerabilities using static analysis
+ run: bin/brakeman --no-pager
+
+ scan_js:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: .ruby-version
+ bundler-cache: true
+
+ - name: Scan for security vulnerabilities in JavaScript dependencies
+ run: bin/importmap audit
+
+ lint:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: .ruby-version
+ bundler-cache: true
+
+ - name: Lint code for consistent style
+ run: bin/rubocop -f github
+
+ test:
+ runs-on: ubuntu-latest
+
+ services:
+ mysql:
+ image: mysql
+ env:
+ MYSQL_ALLOW_EMPTY_PASSWORD: true
+ ports:
+ - 3306:3306
+ options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
+
+ # redis:
+ # image: redis
+ # ports:
+ # - 6379:6379
+ # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5
+
+ steps:
+ - name: Install packages
+ run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl default-mysql-client libjemalloc2 libvips
+
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+ with:
+ ruby-version: .ruby-version
+ bundler-cache: true
+
+ - name: Run tests
+ env:
+ RAILS_ENV: test
+ DATABASE_URL: mysql2://127.0.0.1:3306
+ # REDIS_URL: redis://localhost:6379/0
+ run: bin/rails db:test:prepare test test:system
+
+ - name: Keep screenshots from failed system tests
+ uses: actions/upload-artifact@v4
+ if: failure()
+ with:
+ name: screenshots
+ path: ${{ github.workspace }}/tmp/screenshots
+ if-no-files-found: ignore
--- /dev/null
+# See https://help.github.com/articles/ignoring-files for more about ignoring files.
+#
+# Temporary files generated by your text editor or operating system
+# belong in git's global ignore instead:
+# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
+
+# Ignore bundler config.
+/.bundle
+
+# Ignore all environment files (except templates).
+/.env*
+!/.env*.erb
+
+# Ignore all logfiles and tempfiles.
+/log/*
+/tmp/*
+!/log/.keep
+!/tmp/.keep
+
+# Ignore pidfiles, but keep the directory.
+/tmp/pids/*
+!/tmp/pids/
+!/tmp/pids/.keep
+
+# Ignore storage (uploaded files in development and any SQLite databases).
+/storage/*
+!/storage/.keep
+/tmp/storage/*
+!/tmp/storage/
+!/tmp/storage/.keep
+
+/public/assets
+
+# Ignore master key for decrypting credentials and more.
+/config/master.key
--- /dev/null
+# Omakase Ruby styling for Rails
+inherit_gem: { rubocop-rails-omakase: rubocop.yml }
+
+# Overwrite or add rules to create your own house style
+#
+# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
+# Layout/SpaceInsideArrayLiteralBrackets:
+# Enabled: false
--- /dev/null
+# syntax = docker/dockerfile:1
+
+# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
+# docker build -t my-app .
+# docker run -d -p 80:80 -p 443:443 --name my-app -e RAILS_MASTER_KEY=<value from config/master.key> my-app
+
+# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
+ARG RUBY_VERSION=3.3.4
+FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
+
+# Rails app lives here
+WORKDIR /rails
+
+# Install base packages
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y curl default-mysql-client libjemalloc2 libvips && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Set production environment
+ENV RAILS_ENV="production" \
+ BUNDLE_DEPLOYMENT="1" \
+ BUNDLE_PATH="/usr/local/bundle" \
+ BUNDLE_WITHOUT="development"
+
+# Throw-away build stage to reduce size of final image
+FROM base AS build
+
+# Install packages needed to build gems
+RUN apt-get update -qq && \
+ apt-get install --no-install-recommends -y build-essential default-libmysqlclient-dev git pkg-config && \
+ rm -rf /var/lib/apt/lists /var/cache/apt/archives
+
+# Install application gems
+COPY Gemfile Gemfile.lock ./
+RUN bundle install && \
+ rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
+ bundle exec bootsnap precompile --gemfile
+
+# Copy application code
+COPY . .
+
+# Precompile bootsnap code for faster boot times
+RUN bundle exec bootsnap precompile app/ lib/
+
+# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
+RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
+
+
+
+
+# Final stage for app image
+FROM base
+
+# Copy built artifacts: gems, application
+COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
+COPY --from=build /rails /rails
+
+# Run and own only the runtime files as a non-root user for security
+RUN groupadd --system --gid 1000 rails && \
+ useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
+ chown -R rails:rails db log storage tmp
+USER 1000:1000
+
+# Entrypoint prepares the database.
+ENTRYPOINT ["/rails/bin/docker-entrypoint"]
+
+# Start the server by default, this can be overwritten at runtime
+EXPOSE 3000
+CMD ["./bin/rails", "server"]
--- /dev/null
+source "https://rubygems.org"
+
+# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
+gem "rails", "~> 7.2.1"
+# The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
+gem "sprockets-rails"
+# Use mysql as the database for Active Record
+gem "mysql2", "~> 0.5"
+# Use the Puma web server [https://github.com/puma/puma]
+gem "puma", ">= 5.0"
+# users and auth
+gem "devise"
+#pagination
+gem "kaminari"
+#markdown
+gem "redcarpet"
+#syntax
+gem "rouge"
+# Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
+# gem "kredis"
+
+# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
+# gem "bcrypt", "~> 3.1.7"
+
+# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
+gem "tzinfo-data", platforms: %i[ windows jruby ]
+
+# Reduces boot times through caching; required in config/boot.rb
+gem "bootsnap", require: false
+
+# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
+# gem "image_processing", "~> 1.2"
+
+group :development, :test do
+ # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
+ gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
+
+ # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
+ gem "brakeman", require: false
+
+ # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
+ gem "rubocop-rails-omakase", require: false
+end
+
+group :development do
+ # Use console on exceptions pages [https://github.com/rails/web-console]
+ gem "web-console"
+end
+
+group :test do
+ # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
+ gem "capybara"
+ gem "selenium-webdriver"
+end
--- /dev/null
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actioncable (7.2.1)
+ actionpack (= 7.2.1)
+ activesupport (= 7.2.1)
+ nio4r (~> 2.0)
+ websocket-driver (>= 0.6.1)
+ zeitwerk (~> 2.6)
+ actionmailbox (7.2.1)
+ actionpack (= 7.2.1)
+ activejob (= 7.2.1)
+ activerecord (= 7.2.1)
+ activestorage (= 7.2.1)
+ activesupport (= 7.2.1)
+ mail (>= 2.8.0)
+ actionmailer (7.2.1)
+ actionpack (= 7.2.1)
+ actionview (= 7.2.1)
+ activejob (= 7.2.1)
+ activesupport (= 7.2.1)
+ mail (>= 2.8.0)
+ rails-dom-testing (~> 2.2)
+ actionpack (7.2.1)
+ actionview (= 7.2.1)
+ activesupport (= 7.2.1)
+ nokogiri (>= 1.8.5)
+ racc
+ rack (>= 2.2.4, < 3.2)
+ rack-session (>= 1.0.1)
+ rack-test (>= 0.6.3)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ useragent (~> 0.16)
+ actiontext (7.2.1)
+ actionpack (= 7.2.1)
+ activerecord (= 7.2.1)
+ activestorage (= 7.2.1)
+ activesupport (= 7.2.1)
+ globalid (>= 0.6.0)
+ nokogiri (>= 1.8.5)
+ actionview (7.2.1)
+ activesupport (= 7.2.1)
+ builder (~> 3.1)
+ erubi (~> 1.11)
+ rails-dom-testing (~> 2.2)
+ rails-html-sanitizer (~> 1.6)
+ activejob (7.2.1)
+ activesupport (= 7.2.1)
+ globalid (>= 0.3.6)
+ activemodel (7.2.1)
+ activesupport (= 7.2.1)
+ activerecord (7.2.1)
+ activemodel (= 7.2.1)
+ activesupport (= 7.2.1)
+ timeout (>= 0.4.0)
+ activestorage (7.2.1)
+ actionpack (= 7.2.1)
+ activejob (= 7.2.1)
+ activerecord (= 7.2.1)
+ activesupport (= 7.2.1)
+ marcel (~> 1.0)
+ activesupport (7.2.1)
+ base64
+ bigdecimal
+ concurrent-ruby (~> 1.0, >= 1.3.1)
+ connection_pool (>= 2.2.5)
+ drb
+ i18n (>= 1.6, < 2)
+ logger (>= 1.4.2)
+ minitest (>= 5.1)
+ securerandom (>= 0.3)
+ tzinfo (~> 2.0, >= 2.0.5)
+ addressable (2.8.7)
+ public_suffix (>= 2.0.2, < 7.0)
+ ast (2.4.2)
+ base64 (0.2.0)
+ bcrypt (3.1.20)
+ bigdecimal (3.1.8)
+ bindex (0.8.1)
+ bootsnap (1.18.4)
+ msgpack (~> 1.2)
+ brakeman (6.2.1)
+ racc
+ builder (3.3.0)
+ capybara (3.40.0)
+ addressable
+ matrix
+ mini_mime (>= 0.1.3)
+ nokogiri (~> 1.11)
+ rack (>= 1.6.0)
+ rack-test (>= 0.6.3)
+ regexp_parser (>= 1.5, < 3.0)
+ xpath (~> 3.2)
+ concurrent-ruby (1.3.4)
+ connection_pool (2.4.1)
+ crass (1.0.6)
+ date (3.3.4)
+ debug (1.9.2)
+ irb (~> 1.10)
+ reline (>= 0.3.8)
+ devise (4.9.4)
+ bcrypt (~> 3.0)
+ orm_adapter (~> 0.1)
+ railties (>= 4.1.0)
+ responders
+ warden (~> 1.2.3)
+ drb (2.2.1)
+ erubi (1.13.0)
+ globalid (1.2.1)
+ activesupport (>= 6.1)
+ i18n (1.14.5)
+ concurrent-ruby (~> 1.0)
+ io-console (0.7.2)
+ irb (1.14.0)
+ rdoc (>= 4.0.0)
+ reline (>= 0.4.2)
+ json (2.7.2)
+ kaminari (1.2.2)
+ activesupport (>= 4.1.0)
+ kaminari-actionview (= 1.2.2)
+ kaminari-activerecord (= 1.2.2)
+ kaminari-core (= 1.2.2)
+ kaminari-actionview (1.2.2)
+ actionview
+ kaminari-core (= 1.2.2)
+ kaminari-activerecord (1.2.2)
+ activerecord
+ kaminari-core (= 1.2.2)
+ kaminari-core (1.2.2)
+ language_server-protocol (3.17.0.3)
+ logger (1.6.1)
+ loofah (2.22.0)
+ crass (~> 1.0.2)
+ nokogiri (>= 1.12.0)
+ mail (2.8.1)
+ mini_mime (>= 0.1.1)
+ net-imap
+ net-pop
+ net-smtp
+ marcel (1.0.4)
+ matrix (0.4.2)
+ mini_mime (1.1.5)
+ minitest (5.25.1)
+ msgpack (1.7.2)
+ mysql2 (0.5.6)
+ net-imap (0.4.16)
+ date
+ net-protocol
+ net-pop (0.1.2)
+ net-protocol
+ net-protocol (0.2.2)
+ timeout
+ net-smtp (0.5.0)
+ net-protocol
+ nio4r (2.7.3)
+ nokogiri (1.16.7-aarch64-linux)
+ racc (~> 1.4)
+ nokogiri (1.16.7-arm-linux)
+ racc (~> 1.4)
+ nokogiri (1.16.7-arm64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.16.7-x86-linux)
+ racc (~> 1.4)
+ nokogiri (1.16.7-x86_64-darwin)
+ racc (~> 1.4)
+ nokogiri (1.16.7-x86_64-linux)
+ racc (~> 1.4)
+ orm_adapter (0.5.0)
+ parallel (1.26.3)
+ parser (3.3.5.0)
+ ast (~> 2.4.1)
+ racc
+ psych (5.1.2)
+ stringio
+ public_suffix (6.0.1)
+ puma (6.4.2)
+ nio4r (~> 2.0)
+ racc (1.8.1)
+ rack (3.1.7)
+ rack-session (2.0.0)
+ rack (>= 3.0.0)
+ rack-test (2.1.0)
+ rack (>= 1.3)
+ rackup (2.1.0)
+ rack (>= 3)
+ webrick (~> 1.8)
+ rails (7.2.1)
+ actioncable (= 7.2.1)
+ actionmailbox (= 7.2.1)
+ actionmailer (= 7.2.1)
+ actionpack (= 7.2.1)
+ actiontext (= 7.2.1)
+ actionview (= 7.2.1)
+ activejob (= 7.2.1)
+ activemodel (= 7.2.1)
+ activerecord (= 7.2.1)
+ activestorage (= 7.2.1)
+ activesupport (= 7.2.1)
+ bundler (>= 1.15.0)
+ railties (= 7.2.1)
+ rails-dom-testing (2.2.0)
+ activesupport (>= 5.0.0)
+ minitest
+ nokogiri (>= 1.6)
+ rails-html-sanitizer (1.6.0)
+ loofah (~> 2.21)
+ nokogiri (~> 1.14)
+ railties (7.2.1)
+ actionpack (= 7.2.1)
+ activesupport (= 7.2.1)
+ irb (~> 1.13)
+ rackup (>= 1.0.0)
+ rake (>= 12.2)
+ thor (~> 1.0, >= 1.2.2)
+ zeitwerk (~> 2.6)
+ rainbow (3.1.1)
+ rake (13.2.1)
+ rdoc (6.7.0)
+ psych (>= 4.0.0)
+ redcarpet (3.6.0)
+ regexp_parser (2.9.2)
+ reline (0.5.10)
+ io-console (~> 0.5)
+ responders (3.1.1)
+ actionpack (>= 5.2)
+ railties (>= 5.2)
+ rexml (3.3.7)
+ rouge (4.3.0)
+ rubocop (1.66.1)
+ json (~> 2.3)
+ language_server-protocol (>= 3.17.0)
+ parallel (~> 1.10)
+ parser (>= 3.3.0.2)
+ rainbow (>= 2.2.2, < 4.0)
+ regexp_parser (>= 2.4, < 3.0)
+ rubocop-ast (>= 1.32.2, < 2.0)
+ ruby-progressbar (~> 1.7)
+ unicode-display_width (>= 2.4.0, < 3.0)
+ rubocop-ast (1.32.3)
+ parser (>= 3.3.1.0)
+ rubocop-minitest (0.36.0)
+ rubocop (>= 1.61, < 2.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
+ rubocop-performance (1.21.1)
+ rubocop (>= 1.48.1, < 2.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
+ rubocop-rails (2.26.1)
+ activesupport (>= 4.2.0)
+ rack (>= 1.1)
+ rubocop (>= 1.52.0, < 2.0)
+ rubocop-ast (>= 1.31.1, < 2.0)
+ rubocop-rails-omakase (1.0.0)
+ rubocop
+ rubocop-minitest
+ rubocop-performance
+ rubocop-rails
+ ruby-progressbar (1.13.0)
+ rubyzip (2.3.2)
+ securerandom (0.3.1)
+ selenium-webdriver (4.24.0)
+ base64 (~> 0.2)
+ logger (~> 1.4)
+ rexml (~> 3.2, >= 3.2.5)
+ rubyzip (>= 1.2.2, < 3.0)
+ websocket (~> 1.0)
+ sprockets (4.2.1)
+ concurrent-ruby (~> 1.0)
+ rack (>= 2.2.4, < 4)
+ sprockets-rails (3.5.2)
+ actionpack (>= 6.1)
+ activesupport (>= 6.1)
+ sprockets (>= 3.0.0)
+ stringio (3.1.1)
+ thor (1.3.2)
+ timeout (0.4.1)
+ tzinfo (2.0.6)
+ concurrent-ruby (~> 1.0)
+ unicode-display_width (2.6.0)
+ useragent (0.16.10)
+ warden (1.2.9)
+ rack (>= 2.0.9)
+ web-console (4.2.1)
+ actionview (>= 6.0.0)
+ activemodel (>= 6.0.0)
+ bindex (>= 0.4.0)
+ railties (>= 6.0.0)
+ webrick (1.8.1)
+ websocket (1.2.11)
+ websocket-driver (0.7.6)
+ websocket-extensions (>= 0.1.0)
+ websocket-extensions (0.1.5)
+ xpath (3.2.0)
+ nokogiri (~> 1.8)
+ zeitwerk (2.6.18)
+
+PLATFORMS
+ aarch64-linux
+ arm-linux
+ arm64-darwin
+ x86-linux
+ x86_64-darwin
+ x86_64-linux
+
+DEPENDENCIES
+ bootsnap
+ brakeman
+ capybara
+ debug
+ devise
+ kaminari
+ mysql2 (~> 0.5)
+ puma (>= 5.0)
+ rails (~> 7.2.1)
+ redcarpet
+ rouge
+ rubocop-rails-omakase
+ selenium-webdriver
+ sprockets-rails
+ tzinfo-data
+ web-console
+
+BUNDLED WITH
+ 2.5.11
--- /dev/null
+# README
+
+This README would normally document whatever steps are necessary to get the
+application up and running.
+
+Things you may want to cover:
+
+* Ruby version
+
+* System dependencies
+
+* Configuration
+
+* Database creation
+
+* Database initialization
+
+* How to run the test suite
+
+* Services (job queues, cache servers, search engines, etc.)
+
+* Deployment instructions
+
+* ...
--- /dev/null
+# Add your own tasks in files placed in lib/tasks ending in .rake,
+# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
+
+require_relative "config/application"
+
+Rails.application.load_tasks
--- /dev/null
+//= link_tree ../images
+//= link_directory ../stylesheets .css
--- /dev/null
+/*
+ *= require_tree .
+ *= require_self
+ */
+
+/* Font face declarations */
+@font-face {
+ font-family: 'Meta Correspondence Pro';
+ src: url('/fonts/Meta_Correspondence_Pro_Regular.otf') format('opentype');
+ font-weight: normal;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'Meta Correspondence Pro';
+ src: url('/fonts/Meta_Correspondence_Pro_Bold.otf') format('opentype');
+ font-weight: bold;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'Meta Correspondence Pro';
+ src: url('/fonts/Meta_Correspondence_Pro_Italic.otf') format('opentype');
+ font-weight: normal;
+ font-style: italic;
+}
+
+@font-face {
+ font-family: 'Meta Correspondence Pro';
+ src: url('/fonts/Meta_Correspondence_Pro_Bold_Italic.otf') format('opentype');
+ font-weight: bold;
+ font-style: italic;
+}
+@font-face {
+ font-family: 'Inria Sans';
+ src: url('/fonts/InriaSans-Regular.ttf') format('truetype');
+ font-weight: 400;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'Inria Sans';
+ src: url('/fonts/InriaSans-Bold.ttf') format('truetype');
+ font-weight: 700;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'Inria Sans';
+ src: url('/fonts/InriaSans-Italic.ttf') format('truetype');
+ font-weight: 400;
+ font-style: italic;
+}
+
+@font-face {
+ font-family: 'Inria Sans';
+ src: url('/fonts/InriaSans-BoldItalic.ttf') format('truetype');
+ font-weight: 700;
+ font-style: italic;
+}
+
+@font-face {
+ font-family: 'Inria Sans';
+ src: url('/fonts/InriaSans-Light.ttf') format('truetype');
+ font-weight: 300;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'Inria Sans';
+ src: url('/fonts/InriaSans-LightItalic.ttf') format('truetype');
+ font-weight: 300;
+ font-style: italic;
+}
+
+/* Root variables (Dark mode) */
+:root {
+ --post-bg: #2c1e1a;
+ --body-bg: #3d2a24;
+ --quote-bg: #5a3d33;
+ --link-color: #e8c396;
+ --accent-a: #f2a76c;
+ --accent-b: #8ca5b0;
+ --accent-c: #b68e7d;
+ --body-text: #e8d1c0;
+ --dark-text: #faf0e6;
+ --light-text: #c9ae9c;
+ --code-text: #f2a76c;
+}
+
+/* Light mode */
+@media (prefers-color-scheme: light) {
+ :root {
+ --post-bg: #fdf6f0;
+ --body-bg: #f5e6db;
+ --quote-bg: #e8d1c0;
+ --link-color: #b3461c;
+ --accent-a: #f2a76c;
+ --accent-b: #6a8693;
+ --accent-c: #9e6b57;
+ --body-text: #4a332c;
+ --dark-text: #2c1e1a;
+ --light-text: #7d5b4e;
+ --code-text: #b3461c;
+ }
+}
+
+/* Basic styles */
+body {
+ font-family: 'Meta Correspondence Pro', sans-serif;
+ background-color: var(--body-bg);
+ color: var(--body-text);
+ line-height: 1.6;
+ margin: 0;
+ padding: 0;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ color: var(--dark-text);
+ font-weight: 700;
+ font-family: 'Inria Sans', 'Meta Correspondence Pro', sans-serif;
+}
+
+a,
+a:visited {
+ color: var(--link-color);
+ text-decoration: none;
+}
+
+a:hover {
+ text-decoration: underline;
+}
+
+form {
+ display:inline;
+}
+
+blockquote {
+ border-left: 4px solid var(--quote-bg);
+ margin: 1em 0;
+ padding: 0.5em 1em;
+ color: var(--dark-text);
+}
+
+code {
+ font-family: monospace;
+ background-color: var(--post-bg);
+ color: var(--code-text);
+ padding: 2px 0px;
+ border-radius: 3px;
+}
+
+pre {
+ background-color: var(--post-bg);
+ padding: 1em;
+ overflow-x: auto;
+}
+
+abbr {
+ font-variant-emoji: unicode;
+}
+
+/* Style for all form inputs */
+input[type="text"],
+input[type="email"],
+input[type="password"],
+input[type="number"],
+input[type="tel"],
+textarea,
+select {
+ width: 100%;
+ padding: 12px;
+ margin: 8px 0;
+ display: inline-block;
+ border: 1px solid #ccc;
+ border-radius: 4px;
+ box-sizing: border-box;
+ font-size: 16px;
+}
+
+/* Style for focus state */
+input[type="text"]:focus,
+input[type="email"]:focus,
+input[type="password"]:focus,
+input[type="number"]:focus,
+input[type="tel"]:focus,
+textarea:focus,
+select:focus {
+ outline: none;
+}
+
+/* Style for submit button */
+input[type="submit"] {
+ padding: 14px 20px;
+ margin: 8px 0;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ font-size: 16px;
+}
+
+/* Style for labels */
+label {
+ font-weight: bold;
+ margin-bottom: 5px;
+ display: block;
+}
+
+.post {
+ background-color: var(--post-bg);
+ padding: 2em;
+ margin: 1em 0;
+ word-break: break-word;
+}
+
+.container,
+footer {
+ margin: 0 auto;
+ width: 97.5%;
+ max-width: 945px;
+}
+
+.callout {
+ color: var(--accent-b);
+}
+
+button, input[type="submit"], input[type="reset"] {
+ padding: 0;
+ border: none;
+ outline: none;
+ font: inherit;
+ color: inherit;
+}
+
+footer {
+ margin-top: 3rem;
+ border-top: 1px solid var(--accent-a);
+}
+
+footer p {
+ font-size: .8rem;
+}
+
+.logo {
+ max-width: 48px;
+ float: right;
+}
+
+.pagination {
+ margin: 3em 0;
+}
+
+.pagination a {
+ border: 1px solid var(--link-color);
+ padding: 2px 8px;
+ text-decoration: none;
+ border-radius: 2px;
+}
+
+.pagination a:hover,
+.pagination a:active,
+.pagination .active {
+ color: var(--accent-b);
+ border: 1px solid var(--accent-b);
+}
+
+.pagination .active:hover {
+ border: 1px solid var(--link-color);
+ color: var(--link-color);
+}
+
+ul li {
+ list-style: none;
+ margin-left: 2em;
+ text-indent: -2em;
+}
+
+ul .dispatch-item::before {
+ content: "✳\FE0E";
+ font-variant-emoji: text;
+}
+
+ul .bookmark-item::before {
+ content: "❥\FE0E";
+ font-variant-emoji: text;
+}
+
+ul .pinned::before {
+ content: "✯\FE0E";
+ font-variant-emoji: text;
+}
+
+.post-item p {
+ margin-left: 2em;
+ white-space: nowrap;
+}
+
+.filter-buttons {
+ margin-bottom: 20px;
+ text-align: center;
+}
+
+.filter-buttons .button {
+ display: inline-block;
+ padding: 10px 20px;
+ margin: 0 5px;
+ background-color: var(--accent-a);
+ color: var(--body-text);
+ text-decoration: none;
+ border-radius: 5px;
+}
+
+.filter-buttons .button.active {
+ background-color: var(--body-text);
+ color: var(--accent-a);
+}
+
+.filter-buttons .button:hover {
+ background-color: var(--body-text);
+ color: var(--accent-a);
+}
+
+.excerpt {
+ margin-top: 10px;
+ text-indent: 0;
+ font-style: italic;
+ color: var(--light-text);
+}
+
+.bookmark-comment {
+ font-style: italic;
+ color: var(--code-text);
+ font-size: 0.9em;
+}
+
+.bookmark-item {
+ padding-bottom: 10px;
+}
+
+table {
+ width: 100%;
+ border-collapse: collapse;
+ margin-bottom: 1rem;
+}
+
+th, td {
+ padding: 0.5rem;
+ text-align: left;
+ border-bottom: 1px solid #ddd;
+}
+
+th {
+ background-color: #f2f2f2;
+ font-weight: bold;
+}
+
+button, input[type="submit"], .button {
+ display: inline-block;
+ padding: 0.5rem 1rem;
+ text-decoration: none;
+ background-color: var(--quote-bg);
+ color: var(--link-color);
+ border-radius: 0.25rem;
+ margin-right: 0.5rem;
+}
+
+.button.small {
+ padding: 0.25rem 0.5rem;
+ font-size: 0.875rem;
+}
+
+.button.danger {
+ background-color: #dc3545;
+ color: var(--body-text);
+}
+
+.button:hover {
+ opacity: 0.8;
+ text-decoration: none;
+}
+
+@media (max-width: 1010px) {
+ ul {
+ padding-left: 0;
+ }
+}
+
+ul .post-item a,
+ul .post-item a:visited {
+ color: var(--accent-c);
+}
+
+@media (max-width: 480px) {
+
+ .container,
+ footer {
+ margin: 5px 10px -10px 5px;
+ overflow: hidden;
+ }
+
+ footer {
+ margin-top: 3rem;
+ }
+
+ .post {
+ overflow: hidden;
+ }
+
+ .logo {
+ margin-top: 20px;
+ }
+}
--- /dev/null
+class Api::V1::ApiController < ApplicationController
+ skip_before_action :verify_authenticity_token
+ before_action :validate_api_key, except: [:status]
+
+ def status
+ render json: { message: "API is up!", online: true }
+ end
+
+ def handle_request
+ case params[:request]
+ when 'list'
+ index
+ when 'post'
+ show
+ when 'add_post'
+ create
+ when 'edit_post'
+ update
+ when 'delete_post'
+ destroy
+ when 'add_bookmark'
+ create_bookmark
+ when 'delete_bookmark'
+ destroy_bookmark
+ else
+ render json: { error: 'Invalid request type' }, status: :bad_request
+ end
+ end
+
+ private
+
+ def index
+ page = params[:page].to_i || 1
+ per_page = params[:per_page].to_i || 15
+ filter = params[:filter] || 'all'
+
+ items = Post.get_posts_and_bookmarks_with_pagination(page, per_page, filter)
+
+ render json: {
+ items: items.map { |item| format_item(item) },
+ meta: {
+ current_page: items.current_page,
+ total_pages: items.total_pages,
+ per_page: per_page,
+ total_items: items.total_count
+ }
+ }
+ end
+
+ def show
+ year = params[:year]
+ slug = params[:slug]
+
+ post = Post.find_by(slug: slug, published_at: Date.new(year.to_i)..Date.new(year.to_i).end_of_year)
+
+ if post
+ render json: {
+ id: post.id,
+ title: post.title,
+ date: post.published_at,
+ content: post.rendered_content,
+ tags: post.tags.split(','),
+ url: post_url(year, post.slug),
+ reading_time: calculate_reading_time(post.content)
+ }
+ else
+ render json: { error: 'Post not found' }, status: :not_found
+ end
+ end
+
+ def create
+ post = Post.new(post_params)
+ post.slug = post.title.parameterize
+ post.published_at = Time.current
+
+ if post.save
+ render json: { message: 'Post added successfully' }, status: :created
+ else
+ render json: { error: post.errors.full_messages }, status: :unprocessable_entity
+ end
+ end
+
+ def update
+ post = Post.find(params[:id])
+
+ if post.update(post_params)
+ render json: { message: 'Post updated successfully' }
+ else
+ render json: { error: post.errors.full_messages }, status: :unprocessable_entity
+ end
+ end
+
+ def destroy
+ post = Post.find(params[:id])
+ post.destroy
+ render json: { message: 'Post deleted successfully' }
+ end
+
+ def create_bookmark
+ bookmark = Post.new(
+ post_type: 'bookmark',
+ title: params[:url],
+ url: params[:url],
+ excerpt: params[:comment],
+ tags: params[:starred] == '1' ? 'starred' : ''
+ )
+
+ if bookmark.save
+ render json: { message: 'Bookmark added successfully' }, status: :created
+ else
+ render json: { error: bookmark.errors.full_messages }, status: :unprocessable_entity
+ end
+ end
+
+ def destroy_bookmark
+ bookmark = Post.find(params[:id])
+ bookmark.destroy
+ render json: { message: 'Bookmark deleted successfully' }
+ end
+
+ def validate_api_key
+ api_key = request.headers['X-API-Key'] || params[:api_key] || (request.post? ? params[:api_key] : nil)
+ unless ApiKey.exists?(key: api_key)
+ render json: { error: 'Invalid API key' }, status: :unauthorized
+ end
+ end
+
+ def post_params
+ params.permit(:post_type, :title, :content, :tags, :url)
+ end
+
+ def format_item(item)
+ if item.post_type == 'dispatch'
+ {
+ type: 'post',
+ id: item.id,
+ date: item.published_at,
+ title: item.title,
+ slug: item.slug,
+ excerpt: item.generate_excerpt,
+ tags: item.tags.split(','),
+ url: post_url(item.published_at.year, item.slug)
+ }
+ else
+ {
+ type: 'bookmark',
+ id: item.id,
+ date: item.created_at,
+ title: item.title,
+ comment: item.excerpt,
+ url: item.url
+ }
+ end
+ end
+
+ def calculate_reading_time(content)
+ (content.split.size / 200.0).ceil
+ end
+
+ def post_url(year, slug)
+ "/#{year}/#{slug}"
+ end
+end
\ No newline at end of file
--- /dev/null
+class ApiKeysController < ApplicationController
+ before_action :set_api_key, only: [:show, :destroy]
+ before_action :authenticate_user! # Assuming you're using Devise for authentication
+ before_action :authorize_admin # You'll need to implement this method
+
+ def index
+ @api_keys = ApiKey.all
+ end
+
+ def show
+ end
+
+ def new
+ @api_key = ApiKey.new
+ end
+
+ def create
+ @api_key = ApiKey.new
+ if @api_key.save
+ redirect_to @api_key, notice: 'API key was successfully created.'
+ else
+ render :new
+ end
+ end
+
+ def destroy
+ @api_key.destroy
+ redirect_to api_keys_url, notice: 'API key was successfully destroyed.'
+ end
+
+ private
+
+ def set_api_key
+ @api_key = ApiKey.find(params[:id])
+ end
+
+ def authorize_admin
+ redirect_to root_path, alert: 'Not authorized.' unless current_user.admin?
+ end
+end
\ No newline at end of file
--- /dev/null
+class ApplicationController < ActionController::Base
+ # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
+ #allow_browser versions: :modern
+ before_action :configure_permitted_parameters, if: :devise_controller?
+
+ protected
+
+ def configure_permitted_parameters
+ devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])
+ devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])
+ end
+end
--- /dev/null
+module AdminAuthenticatable
+ extend ActiveSupport::Concern
+
+ included do
+ before_action :authenticate_admin!
+ end
+
+ private
+
+ def authenticate_admin!
+ unless current_user&.admin?
+ flash[:alert] = "You are not authorized to access this page."
+ redirect_to root_path
+ end
+ end
+end
\ No newline at end of file
--- /dev/null
+class PostsController < ApplicationController
+ include AdminAuthenticatable
+ before_action :set_post, only: %i[ show edit update destroy ]
+
+ # GET /posts
+ def index
+ @posts = Post.order(published_at: :desc).page(params[:page]).per(20)
+ end
+
+ # GET /posts/1
+ def show
+ end
+
+ # GET /posts/new
+ def new
+ @post = Post.new
+ end
+
+ # GET /posts/1/edit
+ def edit
+ end
+
+ # POST /posts
+ def create
+ @post = Post.new(post_params)
+ @post.slug = @post.title.parameterize if @post.title.present?
+
+ if @post.save
+ redirect_to @post, notice: "Post was successfully created."
+ else
+ render :new, status: :unprocessable_entity
+ end
+ end
+
+ # PATCH/PUT /posts/1
+ def update
+ if @post.update(post_params)
+ redirect_to @post, notice: "Post was successfully updated.", status: :see_other
+ else
+ render :edit, status: :unprocessable_entity
+ end
+ end
+
+ # DELETE /posts/1
+ def destroy
+ @post.destroy!
+ redirect_to posts_url, notice: "Post was successfully destroyed.", status: :see_other
+ end
+
+ private
+ # Use callbacks to share common setup or constraints between actions.
+ def set_post
+ @post = Post.find(params[:id])
+ end
+
+ # Only allow a list of trusted parameters through.
+ def post_params
+ params.require(:post).permit(:post_type, :title, :slug, :published_at, :excerpt, :tags, :content, :url)
+ end
+end
--- /dev/null
+class PubviewController < ApplicationController
+ def index
+ @per_page = 15
+ @page = params[:page].to_i || 1
+ @filter = params[:filter] || 'all'
+
+ @items = Post.get_posts_and_bookmarks_with_pagination(@page, @per_page, @filter)
+ @total_pages = @items.total_pages
+ @current_page = @items.current_page
+ end
+
+ def post
+ start_date = Date.new(params[:year].to_i, 1, 1)
+ end_date = Date.new(params[:year].to_i, 12, 31)
+
+ @post = Post.find_by(slug: params[:slug], published_at: start_date..end_date)
+
+ if @post
+ @reading_time = calculate_reading_time(@post.content)
+ @excerpt = @post.generate_excerpt
+ @tags = @post.format_tags
+ @rendered_content = @post.rendered_content
+ else
+ render file: "#{Rails.root}/public/404.html", layout: false, status: :not_found
+ end
+ end
+
+ def rss
+ @posts = Post.order(published_at: :desc).limit(20)
+ respond_to do |format|
+ format.rss { render layout: false }
+ end
+ end
+
+ def dispatches_rss
+ @posts = Post.dispatches.order(published_at: :desc).limit(20)
+ respond_to do |format|
+ format.rss { render layout: false, template: "pubview/rss" }
+ end
+ end
+
+ private
+
+ def calculate_reading_time(content)
+ word_count = content.split.size
+ (word_count / 200.0).ceil
+ end
+end
\ No newline at end of file
--- /dev/null
+module ApiKeysHelper
+end
--- /dev/null
+module ApplicationHelper
+ def admin?
+ current_user&.admin?
+ end
+end
--- /dev/null
+module PostsHelper
+end
--- /dev/null
+module PubviewHelper
+end
--- /dev/null
+class ApplicationJob < ActiveJob::Base
+ # Automatically retry jobs that encountered a deadlock
+ # retry_on ActiveRecord::Deadlocked
+
+ # Most jobs are safe to ignore if the underlying records are no longer available
+ # discard_on ActiveJob::DeserializationError
+end
--- /dev/null
+class ApplicationMailer < ActionMailer::Base
+ layout "mailer"
+end
--- /dev/null
+class ApiKey < ApplicationRecord
+ validates :key, presence: true, uniqueness: true
+
+ before_validation :generate_key, on: :create
+
+ private
+
+ def generate_key
+ self.key = SecureRandom.hex(20) unless key.present?
+ end
+end
--- /dev/null
+class ApplicationRecord < ActiveRecord::Base
+ primary_abstract_class
+end
--- /dev/null
+class Post < ApplicationRecord
+ validates :post_type, presence: true, inclusion: { in: %w[dispatch bookmark] }
+ validates :title, presence: true
+ validates :slug, presence: true, uniqueness: true
+ validates :published_at, presence: true, if: :dispatch?
+ validates :content, presence: true, if: :dispatch?
+ validates :url, presence: true, if: :bookmark?
+
+ before_validation :set_slug, if: :new_record?
+
+ scope :dispatches, -> { where(post_type: 'dispatch') }
+ scope :bookmarks, -> { where(post_type: 'bookmark') }
+
+ def self.get_posts_and_bookmarks_with_pagination(page, per_page, filter)
+ case filter
+ when 'posts'
+ dispatches
+ when 'bookmarks'
+ bookmarks
+ else
+ all
+ end.order(published_at: :desc).page(page).per(per_page)
+ end
+
+ def rss_time
+ published_at.strftime("%a, %d %b %Y %H:%M:%S %Z") if published_at
+ end
+
+ def dispatch?
+ post_type == 'dispatch'
+ end
+
+ def bookmark?
+ post_type == 'bookmark'
+ end
+
+ def rendered_content
+ MarkdownRenderer.render(content)
+ end
+
+ def format_tags
+ tags.split(/\s*(?:,|\s+and)\s*/).map { |tag| "<code>#{tag.strip}</code>" }.join(', ') + '.'
+ end
+
+ def generate_excerpt(max_length = 180)
+ stripped_content = ActionController::Base.helpers.strip_tags(content)
+ excerpt = stripped_content.split('.').first || stripped_content[0...max_length]
+ excerpt.gsub!("Dear friends,", "")
+ excerpt.gsub!(/\s+/, ' ')
+ excerpt.strip
+ end
+
+ private
+
+ def set_slug
+ self.slug = title.parameterize
+ end
+
+ def set_published_at
+ self.published_at ||= Time.current
+ end
+end
\ No newline at end of file
--- /dev/null
+class User < ApplicationRecord
+ # Include default devise modules. Others available are:
+ # :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
+ devise :database_authenticatable, :registerable,
+ :recoverable, :rememberable, :validatable
+
+ validates :first_name, presence: true
+ validates :last_name, presence: true
+
+ def full_name
+ "#{first_name} #{last_name}"
+ end
+
+ def admin?
+ admin
+ end
+end
--- /dev/null
+class MarkdownRenderer
+ def self.render(text)
+ options = {
+ filter_html: true,
+ hard_wrap: true,
+ link_attributes: { rel: 'nofollow', target: "_blank" },
+ space_after_headers: true,
+ fenced_code_blocks: true
+ }
+
+ extensions = {
+ autolink: true,
+ superscript: true,
+ disable_indented_code_blocks: true,
+ highlight: true
+ }
+
+ renderer = Redcarpet::Render::HTML.new(options)
+ markdown = Redcarpet::Markdown.new(renderer, extensions)
+
+ markdown.render(text)
+ end
+end
\ No newline at end of file
--- /dev/null
+<div class="container">
+<h1>API Keys</h1>
+
+<%= link_to 'New API Key', new_api_key_path, class: "button" %>
+<%= link_to 'Home', root_path, class: "button" %>
+</div>
+<div class="post">
+ <div class="container">
+ <table>
+ <thead>
+ <tr>
+ <th>Key</th>
+ <th>Created At</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @api_keys.each do |api_key| %>
+ <tr>
+ <td><%= api_key.key %></td>
+ <td><%= api_key.created_at %></td>
+ <td>
+ <%= link_to 'View', api_key, class: "button" %>
+ <%= button_to 'Destroy', api_key, method: :delete %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="container">
+ <h1>Generate New API Key</h1>
+ <%= link_to 'Back to API Keys', api_keys_path, class: "button" %>
+</div>
+
+<div class="post">
+ <div class="container">
+ <p>Click the button below to generate a new API key.</p>
+
+ <%= form_with(model: @api_key, local: true) do |form| %>
+ <% if @api_key.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(@api_key.errors.count, "error") %> prohibited this API key from being saved:</h2>
+
+ <ul>
+ <% @api_key.errors.full_messages.each do |message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="actions">
+ <%= form.submit "Generate API Key" %>
+ </div>
+ <% end %>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="container">
+ <h1>API Key Details</h1>
+ <%= link_to 'Back to API Keys', api_keys_path, class: "button" %>
+</div>
+
+<div class="post">
+ <div class="container">
+ <p>
+ <strong>Key:</strong>
+ <%= @api_key.key %>
+ </p>
+
+ <p>
+ <strong>Created at:</strong>
+ <%= @api_key.created_at %>
+ </p>
+ </div>
+</div>
--- /dev/null
+<div class="container">
+ <h1><%= yield(:title) %></h1>
+
+ <%= yield(:form_content) %>
+
+ <div class="links">
+ <%= render "devise/shared/links" %>
+ </div>
+</div>
+
+<style>
+ .container {
+ max-width: 400px;
+ background: var(--post-bg);
+ margin: 40px auto 0 auto;
+ padding: 20px;
+ border-radius: 4px;
+ box-shadow: rgba(70, 70, 70, 0.50) 10px 10px 5px;
+ }
+ h1 {
+ text-align: center;
+ margin-bottom: 20px;
+ }
+ .field {
+ margin-bottom: 15px;
+ }
+ .field label {
+ display: block;
+ margin-bottom: 5px;
+ }
+ .field input[type="email"],
+ .field input[type="password"] {
+ width: 100%;
+ padding: 8px;
+ border: 1px solid #ddd;
+ border-radius: 4px;
+ }
+ .actions {
+ margin-top: 20px;
+ text-align: center;
+ }
+ .actions input[type="submit"] {
+ background-color: #007bff;
+ color: white;
+ padding: 10px 20px;
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ }
+ .actions input[type="submit"]:hover {
+ background-color: #0056b3;
+ }
+ .links {
+ margin-top: 20px;
+ text-align: center;
+ }
+ .links a {
+ color: #007bff;
+ text-decoration: none;
+ }
+ .links a:hover {
+ text-decoration: underline;
+ }
+</style>
\ No newline at end of file
--- /dev/null
+<h2>Resend confirmation instructions</h2>
+
+<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
+
+ <div class="field">
+ <%= f.label :email %><br />
+ <%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
+ </div>
+
+ <div class="actions">
+ <%= f.submit "Resend confirmation instructions" %>
+ </div>
+<% end %>
+
+<%= render "devise/shared/links" %>
--- /dev/null
+<p>Welcome <%= @email %>!</p>
+
+<p>You can confirm your account email through the link below:</p>
+
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p>
--- /dev/null
+<p>Hello <%= @email %>!</p>
+
+<% if @resource.try(:unconfirmed_email?) %>
+ <p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
+<% else %>
+ <p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
+<% end %>
--- /dev/null
+<p>Hello <%= @resource.email %>!</p>
+
+<p>We're contacting you to notify you that your password has been changed.</p>
--- /dev/null
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Someone has requested a link to change your password. You can do this through the link below.</p>
+
+<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
+
+<p>If you didn't request this, please ignore this email.</p>
+<p>Your password won't change until you access the link above and create a new one.</p>
--- /dev/null
+<p>Hello <%= @resource.email %>!</p>
+
+<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
+
+<p>Click the link below to unlock your account:</p>
+
+<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
--- /dev/null
+<h2>Change your password</h2>
+
+<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
+ <%= f.hidden_field :reset_password_token %>
+
+ <div class="field">
+ <%= f.label :password, "New password" %><br />
+ <% if @minimum_password_length %>
+ <em>(<%= @minimum_password_length %> characters minimum)</em><br />
+ <% end %>
+ <%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
+ </div>
+
+ <div class="field">
+ <%= f.label :password_confirmation, "Confirm new password" %><br />
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
+ </div>
+
+ <div class="actions">
+ <%= f.submit "Change my password" %>
+ </div>
+<% end %>
+
+<%= render "devise/shared/links" %>
--- /dev/null
+<% content_for :title do %>Forgot your password?<% end %>
+
+<% content_for :form_content do %>
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post }) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
+
+ <div class="field">
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
+ </div>
+
+ <div class="actions">
+ <%= f.submit "Send me reset password instructions" %>
+ </div>
+ <% end %>
+<% end %>
+
+<%= render template: 'devise/base_template' %>
\ No newline at end of file
--- /dev/null
+<% content_for :title do %>Edit <%= resource_name.to_s.humanize %><% end %>
+
+<% content_for :form_content do %>
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
+
+ <div class="field">
+ <%= f.label :first_name %>
+ <%= f.text_field :first_name, autofocus: true %>
+ </div>
+
+ <div class="field">
+ <%= f.label :last_name %>
+ <%= f.text_field :last_name %>
+ </div>
+
+ <div class="field">
+ <%= f.label :email %>
+ <%= f.email_field :email, autocomplete: "email" %>
+ </div>
+
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
+ <% end %>
+
+ <div class="field">
+ <%= f.label :password %> <i>(leave blank if you don't want to change it)</i>
+ <%= f.password_field :password, autocomplete: "new-password" %>
+ <% if @minimum_password_length %>
+ <em><%= @minimum_password_length %> characters minimum</em>
+ <% end %>
+ </div>
+
+ <div class="field">
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
+ </div>
+
+ <div class="field">
+ <%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i>
+ <%= f.password_field :current_password, autocomplete: "current-password" %>
+ </div>
+
+ <div class="actions">
+ <%= f.submit "Update" %>
+ </div>
+ <% end %>
+
+ <% if current_user&.admin? %>
+
+ <% else %>
+ <h3>Cancel my account</h3>
+
+ <div>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?", turbo_confirm: "Are you sure?" }, method: :delete %></div>
+
+ <%= link_to "Back", :back %>
+ <% end %>
+<% end %>
+
+<%= render template: 'devise/base_template' %>
\ No newline at end of file
--- /dev/null
+<% content_for :title do %>Sign up<% end %>
+
+<% content_for :form_content do %>
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name)) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
+
+ <div class="field">
+ <%= f.label :first_name %>
+ <%= f.text_field :first_name, autofocus: true %>
+ </div>
+
+ <div class="field">
+ <%= f.label :last_name %>
+ <%= f.text_field :last_name %>
+ </div>
+
+ <div class="field">
+ <%= f.label :email %>
+ <%= f.email_field :email, autocomplete: "email" %>
+ </div>
+
+ <div class="field">
+ <%= f.label :password %>
+ <% if @minimum_password_length %>
+ <em>(<%= @minimum_password_length %> characters minimum)</em>
+ <% end %>
+ <%= f.password_field :password, autocomplete: "new-password" %>
+ </div>
+
+ <div class="field">
+ <%= f.label :password_confirmation %>
+ <%= f.password_field :password_confirmation, autocomplete: "new-password" %>
+ </div>
+
+ <div class="actions">
+ <%= f.submit "Sign up" %>
+ </div>
+ <% end %>
+<% end %>
+
+<%= render template: 'devise/base_template' %>
\ No newline at end of file
--- /dev/null
+<% content_for :title do %>Log in<% end %>
+
+<% content_for :form_content do %>
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name)) do |f| %>
+ <div class="field">
+ <%= f.label :email %>
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
+ </div>
+
+ <div class="field">
+ <%= f.label :password %>
+ <%= f.password_field :password, autocomplete: "current-password" %>
+ </div>
+
+ <% if devise_mapping.rememberable? %>
+ <div class="field">
+ <%= f.check_box :remember_me %>
+ <%= f.label :remember_me %>
+ </div>
+ <% end %>
+
+ <div class="actions">
+ <%= f.submit "Log in" %>
+ </div>
+ <% end %>
+<% end %>
+
+<%= render template: 'devise/base_template' %>
\ No newline at end of file
--- /dev/null
+<% if resource.errors.any? %>
+ <div id="error_explanation" data-turbo-cache="false">
+ <h2>
+ <%= I18n.t("errors.messages.not_saved",
+ count: resource.errors.count,
+ resource: resource.class.model_name.human.downcase)
+ %>
+ </h2>
+ <ul>
+ <% resource.errors.full_messages.each do |message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ </div>
+<% end %>
--- /dev/null
+<%- if controller_name != 'sessions' %>
+ <%= link_to "Log in", new_session_path(resource_name) %><br />
+<% end %>
+
+<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
+<% end %>
+
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
+<% end %>
+
+<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
+<% end %>
+
+<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
+<% end %>
+
+<%- if devise_mapping.omniauthable? %>
+ <%- resource_class.omniauth_providers.each do |provider| %>
+ <%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
+ <% end %>
+<% end %>
--- /dev/null
+<h2>Resend unlock instructions</h2>
+
+<%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post }) do |f| %>
+ <%= render "devise/shared/error_messages", resource: resource %>
+
+ <div class="field">
+ <%= f.label :email %><br />
+ <%= f.email_field :email, autofocus: true, autocomplete: "email" %>
+ </div>
+
+ <div class="actions">
+ <%= f.submit "Resend unlock instructions" %>
+ </div>
+<% end %>
+
+<%= render "devise/shared/links" %>
--- /dev/null
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="utf-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <title><%= content_for?(:title) ? yield(:title) : "Aidan shares stuff" %></title>
+ <meta name="robots" content="index, follow">
+ <meta name="author" content="Aidan Cornelius-Bell">
+ <% if content_for?(:meta_description) %>
+ <meta name="description" content="<%= yield(:meta_description) %>">
+ <% end %>
+ <% if content_for?(:meta_keywords) %>
+ <meta name="keywords" content="<%= yield(:meta_keywords) %>">
+ <% end %>
+
+ <%= csrf_meta_tags %>
+ <%= csp_meta_tag %>
+
+ <%= stylesheet_link_tag "application" %>
+
+ <%= auto_discovery_link_tag(:rss, rss_url, title: "Aidan has Ideas (Links+Posts)") %>
+ </head>
+
+ <body>
+ <%= yield %>
+
+ <footer>
+ <p>© <%= Time.current.year %> Aidan Cornelius-Bell, CC-NC-SA.</p>
+ <p>This site is managed from the sovereign Yarta of the Kaurna Miyurna, with respect and gratitude for the custodianship of Elders past and present of the many Countries it may appear upon.</p>
+ <p>For legal purposes: any views expressed directly on this website are my own and not reflective of those of any employers, colleagues or affiliates. Links provided remain the views and intellectual property of their respective owners.</p>
+ </footer>
+ </body>
+</html>
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+ <style>
+ /* Email styles need to be inline */
+ </style>
+ </head>
+
+ <body>
+ <%= yield %>
+ </body>
+</html>
--- /dev/null
+<%= yield %>
--- /dev/null
+<%= form_with(model: post, local: true) do |form| %>
+ <% if post.errors.any? %>
+ <div id="error_explanation">
+ <h2><%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:</h2>
+ <ul>
+ <% post.errors.full_messages.each do |message| %>
+ <li><%= message %></li>
+ <% end %>
+ </ul>
+ </div>
+ <% end %>
+
+ <div class="field">
+ <%= form.label :post_type %>
+ <%= form.select :post_type, [['Dispatch', 'dispatch'], ['Bookmark', 'bookmark']], {}, { onchange: 'toggleFields()' } %>
+ </div>
+
+ <div class="field">
+ <%= form.label :title %>
+ <%= form.text_field :title %>
+ </div>
+
+ <div class="field dispatch-field">
+ <%= form.label :published_at %>
+ <%= form.datetime_local_field :published_at %>
+ </div>
+
+ <div class="field dispatch-field">
+ <%= form.label :content %>
+ <%= form.text_area :content, rows: 10 %>
+ </div>
+
+ <div class="field dispatch-field">
+ <%= form.label :tags %>
+ <%= form.text_field :tags %>
+ </div>
+
+ <div class="field bookmark-field" style="display: none;">
+ <%= form.label :url %>
+ <%= form.url_field :url, onblur: 'fetchTitle()' %>
+ </div>
+
+ <div class="field bookmark-field" style="display: none;">
+ <%= form.label :content, "Comment" %>
+ <%= form.text_area :content, rows: 3, placeholder: "Enter your comment here" %>
+ </div>
+
+ <div class="actions">
+ <%= form.submit(class: "button") %>
+ </div>
+<% end %>
+
+<script>
+function toggleFields() {
+ var postType = document.getElementById('post_post_type').value;
+ var dispatchFields = document.getElementsByClassName('dispatch-field');
+ var bookmarkFields = document.getElementsByClassName('bookmark-field');
+
+ if (postType === 'dispatch') {
+ Array.from(dispatchFields).forEach(field => field.style.display = 'block');
+ Array.from(bookmarkFields).forEach(field => field.style.display = 'none');
+ } else {
+ Array.from(dispatchFields).forEach(field => field.style.display = 'none');
+ Array.from(bookmarkFields).forEach(field => field.style.display = 'block');
+ }
+}
+
+function fetchTitle() {
+ var url = document.getElementById('post_url').value;
+ if (url && document.getElementById('post_title').value === '') {
+ // You would implement the actual title fetching here, possibly using an AJAX call to a server endpoint
+ // For demonstration, we'll just set a placeholder title
+ document.getElementById('post_title').value = 'Title for ' + url;
+ }
+}
+
+// Initial toggle on page load
+document.addEventListener('DOMContentLoaded', toggleFields);
+</script>
\ No newline at end of file
--- /dev/null
+<div id="<%= dom_id post %>">
+ <p>
+ <strong>Post type:</strong>
+ <%= post.post_type %>
+ </p>
+
+ <p>
+ <strong>Title:</strong>
+ <%= post.title %>
+ </p>
+
+ <p>
+ <strong>Slug:</strong>
+ <%= post.slug %>
+ </p>
+
+ <p>
+ <strong>Published at:</strong>
+ <%= post.published_at %>
+ </p>
+
+ <p>
+ <strong>Excerpt:</strong>
+ <%= post.excerpt %>
+ </p>
+
+ <p>
+ <strong>Tags:</strong>
+ <%= post.tags %>
+ </p>
+
+ <p>
+ <strong>Content:</strong>
+ <%= post.content %>
+ </p>
+
+ <p>
+ <strong>Url:</strong>
+ <%= post.url %>
+ </p>
+
+</div>
--- /dev/null
+<div class="container">
+ <% content_for :title, "Editing post" %>
+ <h1>Editing post</h1>
+ <%= link_to "Back to posts", posts_path, class: "button" %> <%= link_to "Show this post", @post, class: "button" %>
+</div>
+
+<div class="post">
+ <div class="container">
+ <%= render "form", post: @post %>
+ </div>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="container">
+ <% content_for :title, "Posts" %>
+ <h1>Posts</h1>
+ <%= link_to "New post", new_post_path, class: "button" %> <%= link_to "Home", root_path, class: "button" %>
+</div>
+
+<div class="post">
+ <div class="container">
+ <table>
+ <thead>
+ <tr>
+ <th>Title</th>
+ <th>Type</th>
+ <th>Created</th>
+ <th>Tags</th>
+ <th>Actions</th>
+ </tr>
+ </thead>
+ <tbody>
+ <% @posts.each do |post| %>
+ <tr>
+ <td><%= post.title %></td>
+ <td><%= post.post_type.capitalize %></td>
+ <td><%= post.created_at.strftime("%Y-%m-%d %H:%M") %></td>
+ <td><%= post.tags %></td>
+ <td>
+ <%= link_to "View", post, class: "button small" %>
+ <%= link_to "Edit", edit_post_path(post), class: "button small" %>
+ <%= link_to "Delete", post, method: :delete, data: { confirm: "Are you sure you want to delete this post?" }, class: "button small danger" %>
+ </td>
+ </tr>
+ <% end %>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+<% if @posts.respond_to?(:total_pages) %>
+ <div class="container">
+ <%= paginate @posts %>
+ </div>
+<% end %>
\ No newline at end of file
--- /dev/null
+<% content_for :title, "New post" %>
+<div class="container">
+ <h1>New post</h1>
+ <%= link_to "Back to posts", posts_path, class: "button" %>
+</div>
+
+<div class="post">
+ <div class="container">
+ <%= render "form", post: @post %>
+ </div>
+</div>
--- /dev/null
+<div class="container">
+ <h1>Post details</h1>
+ <%= link_to "Back to posts", posts_path, class: "button" %>
+</div>
+<div class="post">
+ <div class="container">
+
+ <p style="color: green"><%= notice %></p>
+
+ <%= render @post %>
+
+ <div>
+ <%= link_to "Edit this post", edit_post_path(@post) %>
+
+ <%= button_to "Destroy this post", @post, method: :delete %>
+ </div>
+ </div>
+</div>
--- /dev/null
+<div class="container">
+ <%= link_to root_path do %>
+ <%= image_tag "logo-192.png", class: "logo" %>
+ <% end %>
+ <h1>Arelpe</h1>
+</div>
+
+<div class="filter-buttons">
+ <%= link_to "All", root_path(filter: 'all'), class: "button #{@filter == 'all' ? 'active' : ''}" %>
+ <%= link_to "Posts", root_path(filter: 'posts'), class: "button #{@filter == 'posts' ? 'active' : ''}" %>
+ <%= link_to "Bookmarks", root_path(filter: 'bookmarks'), class: "button #{@filter == 'bookmarks' ? 'active' : ''}" %>
+ <% if current_user&.admin? %>
+ <%= link_to "Manage Posts", posts_path, class: "button" %>
+ <%= link_to "Manage API Keys", api_keys_path, class: "button" %>
+ <% end %>
+</div>
+
+<div class="post">
+ <ul class="container">
+ <% @items.each do |item| %>
+ <li class="<%= item.post_type %>-item">
+ <% if item.dispatch? %>
+ <span class="post-link">
+ <%= link_to item.title, public_post_path(year: item.published_at.year, slug: item.slug) %>
+ <abbr title="internal link">↙︎</abbr>
+ </span>
+ <span class="dash">—</span>
+ <span class="meta">posted <%= item.published_at.strftime('%d/%m/%y') %>, tagged as <%= raw item.format_tags %></span>
+ <blockquote class="excerpt"><%= item.generate_excerpt %>..</blockquote>
+ <% else %>
+ <span class="post-link">
+ <%= link_to item.title, item.url, target: "_blank" %>
+ <abbr title="external link">↗︎</abbr>
+ </span>
+ <span class="dash">—</span>
+ <span class="meta">added <%= item.created_at.strftime('%l:%M%P on %d/%m/%y') if item.created_at.present? %></span>
+ <% end %>
+ </li>
+ <% end %>
+ </ul>
+</div>
+
+<div class="container">
+ <%= paginate @items %>
+ <p class="links">
+ <span class="callout">→ Sponsorship</span> like what you've read? Learn about <%= link_to "supporting it here <abbr title=\"external link\">↗︎</abbr>".html_safe, "https://aidan.cornelius-bell.com/sponsor/" %>.<br>
+ <span class="callout">→ Prefer email?</span> <%= link_to "subscribe to my mailing list <abbr title=\"external link\">↗︎</abbr>".html_safe, "https://buttondown.com/acb" %> to get fresh ideas in your inbox (you email masochist, you).<br>
+ <span class="callout">→ Prefer RSS?</span> you can subscribe to a combined <%= link_to "bookmarks+ideas feed here <abbr title=\"internal link\">↙︎</abbr>".html_safe, rss_path %> or <%= link_to "ideas only feed here <abbr title=\"external link\">↗︎</abbr>".html_safe, "https://aidan.cornelius-bell.com/feed/" %>.
+ </p>
+</div>
\ No newline at end of file
--- /dev/null
+<div class="container" id="top">
+ <h1><%= @post.title %></h1>
+ <%= link_to "↼ Back to some other ideas...", root_path %>
+ <div class="postmeta">
+ <p>Posted <%= @post.published_at.strftime('%B %d, %Y') %> and tagged <%= raw @post.format_tags %> Reading Time: about <%= @reading_time %> minute(s).</p>
+ </div>
+</div>
+
+<div class="post">
+ <div class="container">
+ <%= raw @rendered_content %>
+ </div>
+</div>
+
+<div class="container" id="bottom">
+ <h3>More stuff from Aidan</h3>
+ <p><span class="callout">→ Circular economy</span>: if this work has been of interest to you, please consider subsidising my existence, <em>no subscriptions</em>: <%= link_to "click here to donate with PayPal <abbr title=\"external link\">↗︎</abbr>".html_safe, "https://paypal.me/aidancornelius/10.00/" %> or <%= link_to "here for more options and information <abbr title=\"external link\">↗︎</abbr>".html_safe, "https://aidan.cornelius-bell.com/sponsor/" %>.</p>
+ <p><span class="callout">→ Stay updated</span>: email masochists amongst us may receive my "ideas" directly in their inbox with the form below. Alternatively, you are able to subscribe in an RSS reader via the <%= link_to "feed <abbr title=\"external link\">↗︎</abbr>".html_safe, "https://aidan.cornelius-bell.com/feed/" %> to keep your inbox sanity.</p>
+ <iframe scrolling="no" style="width:100%!important;height:220px;border:1px #ccc solid !important" src="https://buttondown.email/acb?as_embed=true"></iframe><br /><br />
+ <p><%= link_to "↑ Back to top", "#top" %> or <%= link_to "↼ Back to some other ideas...", root_path %></p>
+</div>
\ No newline at end of file
--- /dev/null
+xml.instruct! :xml, version: "1.0"
+xml.rss version: "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom" do
+xml.channel do
+if params[:action] == 'dispatches_rss'
+ xml.title "Aidan's Dispatches"
+ xml.description "Aidan's thoughts and ideas"
+else
+ xml.title "Aidan's Posts and Bookmarks"
+ xml.description "Aidan's thoughts, ideas, and interesting links"
+end
+xml.link root_url
+xml.atom :link, href: request.url, rel: "self", type: "application/rss+xml"
+xml.language "en-US"
+
+ xml.item do
+ xml.title post.title
+ if params[:action] == 'dispatches_rss'
+ xml.description do
+ xml.cdata! post.content
+ end
+ else
+ xml.description post.generate_excerpt
+ end
+ xml.pubDate post.rss_time
+ xml.link public_post_url(year: post.created_at.year, slug: post.slug)
+ xml.guid public_post_url(year: post.created_at.year, slug: post.slug)
+
+ # Add more metadata if needed
+ xml.author post.user.full_name if post.respond_to?(:user) && post.user
+ xml.category post.tags if post.respond_to?(:tags) && post.tags.present?
+ end
+end
+end
+end
\ No newline at end of file
--- /dev/null
+{
+ "name": "Arelpe",
+ "icons": [
+ {
+ "src": "/icon.png",
+ "type": "image/png",
+ "sizes": "512x512"
+ },
+ {
+ "src": "/icon.png",
+ "type": "image/png",
+ "sizes": "512x512",
+ "purpose": "maskable"
+ }
+ ],
+ "start_url": "/",
+ "display": "standalone",
+ "scope": "/",
+ "description": "Arelpe.",
+ "theme_color": "red",
+ "background_color": "red"
+}
--- /dev/null
+// Add a service worker for processing Web Push notifications:
+//
+// self.addEventListener("push", async (event) => {
+// const { title, options } = await event.data.json()
+// event.waitUntil(self.registration.showNotification(title, options))
+// })
+//
+// self.addEventListener("notificationclick", function(event) {
+// event.notification.close()
+// event.waitUntil(
+// clients.matchAll({ type: "window" }).then((clientList) => {
+// for (let i = 0; i < clientList.length; i++) {
+// let client = clientList[i]
+// let clientPath = (new URL(client.url)).pathname
+//
+// if (clientPath == event.notification.data.path && "focus" in client) {
+// return client.focus()
+// }
+// }
+//
+// if (clients.openWindow) {
+// return clients.openWindow(event.notification.data.path)
+// }
+// })
+// )
+// })
--- /dev/null
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+ARGV.unshift("--ensure-latest")
+
+load Gem.bin_path("brakeman", "brakeman")
--- /dev/null
+#!/usr/bin/env ruby
+# frozen_string_literal: true
+
+#
+# This file was generated by Bundler.
+#
+# The application 'bundle' is installed as part of a gem, and
+# this file is here to facilitate running it.
+#
+
+require "rubygems"
+
+m = Module.new do
+ module_function
+
+ def invoked_as_script?
+ File.expand_path($0) == File.expand_path(__FILE__)
+ end
+
+ def env_var_version
+ ENV["BUNDLER_VERSION"]
+ end
+
+ def cli_arg_version
+ return unless invoked_as_script? # don't want to hijack other binstubs
+ return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
+ bundler_version = nil
+ update_index = nil
+ ARGV.each_with_index do |a, i|
+ if update_index && update_index.succ == i && a.match?(Gem::Version::ANCHORED_VERSION_PATTERN)
+ bundler_version = a
+ end
+ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
+ bundler_version = $1
+ update_index = i
+ end
+ bundler_version
+ end
+
+ def gemfile
+ gemfile = ENV["BUNDLE_GEMFILE"]
+ return gemfile if gemfile && !gemfile.empty?
+
+ File.expand_path("../Gemfile", __dir__)
+ end
+
+ def lockfile
+ lockfile =
+ case File.basename(gemfile)
+ when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
+ else "#{gemfile}.lock"
+ end
+ File.expand_path(lockfile)
+ end
+
+ def lockfile_version
+ return unless File.file?(lockfile)
+ lockfile_contents = File.read(lockfile)
+ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
+ Regexp.last_match(1)
+ end
+
+ def bundler_requirement
+ @bundler_requirement ||=
+ env_var_version ||
+ cli_arg_version ||
+ bundler_requirement_for(lockfile_version)
+ end
+
+ def bundler_requirement_for(version)
+ return "#{Gem::Requirement.default}.a" unless version
+
+ bundler_gem_version = Gem::Version.new(version)
+
+ bundler_gem_version.approximate_recommendation
+ end
+
+ def load_bundler!
+ ENV["BUNDLE_GEMFILE"] ||= gemfile
+
+ activate_bundler
+ end
+
+ def activate_bundler
+ gem_error = activation_error_handling do
+ gem "bundler", bundler_requirement
+ end
+ return if gem_error.nil?
+ require_error = activation_error_handling do
+ require "bundler/version"
+ end
+ return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
+ warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
+ exit 42
+ end
+
+ def activation_error_handling
+ yield
+ nil
+ rescue StandardError, LoadError => e
+ e
+ end
+end
+
+m.load_bundler!
+
+if m.invoked_as_script?
+ load Gem.bin_path("bundler", "bundle")
+end
--- /dev/null
+#!/bin/bash -e
+
+# Enable jemalloc for reduced memory usage and latency.
+if [ -z "${LD_PRELOAD+x}" ] && [ -f /usr/lib/*/libjemalloc.so.2 ]; then
+ export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)"
+fi
+
+# If running the rails server then create or migrate existing database
+if [ "${1}" == "./bin/rails" ] && [ "${2}" == "server" ]; then
+ ./bin/rails db:prepare
+fi
+
+exec "${@}"
--- /dev/null
+#!/usr/bin/env ruby
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
--- /dev/null
+#!/usr/bin/env ruby
+require_relative "../config/boot"
+require "rake"
+Rake.application.run
--- /dev/null
+#!/usr/bin/env ruby
+require "rubygems"
+require "bundler/setup"
+
+# explicit rubocop config increases performance slightly while avoiding config confusion.
+ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
+
+load Gem.bin_path("rubocop", "rubocop")
--- /dev/null
+#!/usr/bin/env ruby
+require "fileutils"
+
+APP_ROOT = File.expand_path("..", __dir__)
+APP_NAME = "arelpe"
+
+def system!(*args)
+ system(*args, exception: true)
+end
+
+FileUtils.chdir APP_ROOT do
+ # This script is a way to set up or update your development environment automatically.
+ # This script is idempotent, so that you can run it at any time and get an expectable outcome.
+ # Add necessary setup steps to this file.
+
+ puts "== Installing dependencies =="
+ system! "gem install bundler --conservative"
+ system("bundle check") || system!("bundle install")
+
+ # puts "\n== Copying sample files =="
+ # unless File.exist?("config/database.yml")
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
+ # end
+
+ puts "\n== Preparing database =="
+ system! "bin/rails db:prepare"
+
+ puts "\n== Removing old logs and tempfiles =="
+ system! "bin/rails log:clear tmp:clear"
+
+ puts "\n== Restarting application server =="
+ system! "bin/rails restart"
+
+ # puts "\n== Configuring puma-dev =="
+ # system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
+ # system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
+end
--- /dev/null
+# This file is used by Rack-based servers to start the application.
+
+require_relative "config/environment"
+
+run Rails.application
+Rails.application.load_server
--- /dev/null
+require_relative "boot"
+
+require "rails"
+# Pick the frameworks you want:
+require "active_model/railtie"
+require "active_job/railtie"
+require "active_record/railtie"
+require "active_storage/engine"
+require "action_controller/railtie"
+require "action_mailer/railtie"
+require "action_mailbox/engine"
+require "action_text/engine"
+require "action_view/railtie"
+# require "action_cable/engine"
+require "rails/test_unit/railtie"
+
+# Require the gems listed in Gemfile, including any gems
+# you've limited to :test, :development, or :production.
+Bundler.require(*Rails.groups)
+
+module Arelpe
+ class Application < Rails::Application
+ # Initialize configuration defaults for originally generated Rails version.
+ config.load_defaults 7.2
+
+ # Please, add to the `ignore` list any other `lib` subdirectories that do
+ # not contain `.rb` files, or that should not be reloaded or eager loaded.
+ # Common ones are `templates`, `generators`, or `middleware`, for example.
+ config.autoload_lib(ignore: %w[assets tasks])
+
+ # Configuration for the application, engines, and railties goes here.
+ #
+ # These settings can be overridden in specific environments using the files
+ # in config/environments, which are processed later.
+ #
+ # config.time_zone = "Central Time (US & Canada)"
+ # config.eager_load_paths << Rails.root.join("extras")
+ end
+end
--- /dev/null
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
+
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
--- /dev/null
+9kYVka9CFCj1yyYXajvTfcLa2BGRH44UtuAChP+O+StY/AtHrBFePFG9llTUtAi/OUIT/eIWgdlKRRGFBsq0lTlVucsqN+C+34Xs7YRz9nfRvrPb+liyWZIR0k81TkrU8CuN31aVlp/I2ZZeBEONbe/2ISbBKpXA1GScvveXCzhH93PZKJh2R1sDg+IGXAYeY39H71/pmJ0vwcmcHrrs/V5Fdvb6Ze17hBiS5NKuetEa9EvbLXzxTk8Vo8Bl9yqZkaoFaTvhiomraQUFP92TvCbjtzp7JESWU2uosyd0fAI+qwZXT/AIWLVfKSJ62oz9SygpJMvNJHi4SyuS9LcnN34ce9VHwQBB1/nf4lqqrJiXI7EP2LkISpprqTkqXOrf1mrklQ6uKNl/yI2Z/KoR8C/tE/Or--QXMk23jZC7frOfwO--M9QxrCetYHjpBOk9X/fZAQ==
\ No newline at end of file
--- /dev/null
+# MySQL. Versions 5.5.8 and up are supported.
+#
+# Install the MySQL driver
+# gem install mysql2
+#
+# Ensure the MySQL gem is defined in your Gemfile
+# gem "mysql2"
+#
+# And be sure to use new-style password hashing:
+# https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html
+#
+default: &default
+ adapter: mysql2
+ encoding: utf8mb4
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
+ username: root
+ password: ***REMOVED***
+ socket: /tmp/mysql.sock
+
+development:
+ <<: *default
+ database: arelpe_development
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ <<: *default
+ database: arelpe_test
+
+# As with config/credentials.yml, you never want to store sensitive information,
+# like your database password, in your source code. If your source code is
+# ever seen by anyone, they now have access to your database.
+#
+# Instead, provide the password or a full connection URL as an environment
+# variable when you boot the app. For example:
+#
+# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
+#
+# If the connection URL is provided in the special DATABASE_URL environment
+# variable, Rails will automatically merge its configuration values on top of
+# the values provided in this file. Alternatively, you can specify a connection
+# URL environment variable explicitly:
+#
+# production:
+# url: <%= ENV["MY_APP_DATABASE_URL"] %>
+#
+# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
+# for a full overview on how database connection configuration can be specified.
+#
+production:
+ <<: *default
+ database: arelpe_production
+ username: arelpe
+ password: <%= ENV["ARELPE_DATABASE_PASSWORD"] %>
--- /dev/null
+# Load the Rails application.
+require_relative "application"
+
+# Initialize the Rails application.
+Rails.application.initialize!
--- /dev/null
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # In the development environment your application's code is reloaded any time
+ # it changes. This slows down response time but is perfect for development
+ # since you don't have to restart the web server when you make code changes.
+ config.enable_reloading = true
+
+ # Do not eager load code on boot.
+ config.eager_load = false
+
+ # Show full error reports.
+ config.consider_all_requests_local = true
+
+ # Enable server timing.
+ config.server_timing = true
+
+ # Enable/disable caching. By default caching is disabled.
+ # Run rails dev:cache to toggle caching.
+ if Rails.root.join("tmp/caching-dev.txt").exist?
+ config.action_controller.perform_caching = true
+ config.action_controller.enable_fragment_cache_logging = true
+
+ config.cache_store = :memory_store
+ config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{2.days.to_i}" }
+ else
+ config.action_controller.perform_caching = false
+
+ config.cache_store = :null_store
+ end
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Don't care if the mailer can't send.
+ config.action_mailer.raise_delivery_errors = false
+
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
+ config.action_mailer.perform_caching = false
+
+ config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
+
+ # Print deprecation notices to the Rails logger.
+ config.active_support.deprecation = :log
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raise an error on page load if there are pending migrations.
+ config.active_record.migration_error = :page_load
+
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
+
+ # Highlight code that enqueued background job in logs.
+ config.active_job.verbose_enqueue_logs = true
+
+ # Suppress logger output for asset requests.
+ config.assets.quiet = true
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ config.action_controller.raise_on_missing_callback_actions = true
+
+ # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
+ # config.generators.apply_rubocop_autocorrect_after_generate!
+end
--- /dev/null
+require "active_support/core_ext/integer/time"
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # Code is not reloaded between requests.
+ config.enable_reloading = false
+
+ # Eager load code on boot. This eager loads most of Rails and
+ # your application in memory, allowing both threaded web servers
+ # and those relying on copy on write to perform better.
+ # Rake tasks automatically ignore this option for performance.
+ config.eager_load = true
+
+ # Full error reports are disabled and caching is turned on.
+ config.consider_all_requests_local = false
+ config.action_controller.perform_caching = true
+
+ # Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
+ # key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
+
+ # Disable serving static files from `public/`, relying on NGINX/Apache to do so instead.
+ # config.public_file_server.enabled = false
+
+ # Compress CSS using a preprocessor.
+ # config.assets.css_compressor = :sass
+
+ # Do not fall back to assets pipeline if a precompiled asset is missed.
+ config.assets.compile = false
+
+ # Enable serving of images, stylesheets, and JavaScripts from an asset server.
+ # config.asset_host = "http://assets.example.com"
+
+ # Specifies the header that your server uses for sending files.
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
+
+ # Assume all access to the app is happening through a SSL-terminating reverse proxy.
+ # Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
+ # config.assume_ssl = true
+
+ # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
+ config.force_ssl = true
+
+ # Skip http-to-https redirect for the default health check endpoint.
+ # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
+
+ # Log to STDOUT by default
+ config.logger = ActiveSupport::Logger.new(STDOUT)
+ .tap { |logger| logger.formatter = ::Logger::Formatter.new }
+ .then { |logger| ActiveSupport::TaggedLogging.new(logger) }
+
+ # Prepend all log lines with the following tags.
+ config.log_tags = [ :request_id ]
+
+ # "info" includes generic and useful information about system operation, but avoids logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII). If you
+ # want to log everything, set the level to "debug".
+ config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
+
+ # Use a different cache store in production.
+ # config.cache_store = :mem_cache_store
+
+ # Use a real queuing backend for Active Job (and separate queues per environment).
+ # config.active_job.queue_adapter = :resque
+ # config.active_job.queue_name_prefix = "arelpe_production"
+
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
+ config.action_mailer.perform_caching = false
+
+ # Ignore bad email addresses and do not raise email delivery errors.
+ # Set this to true and configure the email server for immediate delivery to raise delivery errors.
+ # config.action_mailer.raise_delivery_errors = false
+
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
+ # the I18n.default_locale when a translation cannot be found).
+ config.i18n.fallbacks = true
+
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
+
+ # Do not dump schema after migrations.
+ config.active_record.dump_schema_after_migration = false
+
+ # Enable DNS rebinding protection and other `Host` header attacks.
+ # config.hosts = [
+ # "example.com", # Allow requests from example.com
+ # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
+ # ]
+ # Skip DNS rebinding protection for the default health check endpoint.
+ # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
+end
--- /dev/null
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
+Rails.application.configure do
+ # Settings specified here will take precedence over those in config/application.rb.
+
+ # While tests run files are not watched, reloading is not necessary.
+ config.enable_reloading = false
+
+ # Eager loading loads your entire application. When running a single test locally,
+ # this is usually not necessary, and can slow down your test suite. However, it's
+ # recommended that you enable it in continuous integration systems to ensure eager
+ # loading is working properly before deploying your code.
+ config.eager_load = ENV["CI"].present?
+
+ # Configure public file server for tests with Cache-Control for performance.
+ config.public_file_server.headers = { "Cache-Control" => "public, max-age=#{1.hour.to_i}" }
+
+ # Show full error reports and disable caching.
+ config.consider_all_requests_local = true
+ config.action_controller.perform_caching = false
+ config.cache_store = :null_store
+
+ # Render exception templates for rescuable exceptions and raise for other exceptions.
+ config.action_dispatch.show_exceptions = :rescuable
+
+ # Disable request forgery protection in test environment.
+ config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
+ # Disable caching for Action Mailer templates even if Action Controller
+ # caching is enabled.
+ config.action_mailer.perform_caching = false
+
+ # Tell Action Mailer not to deliver emails to the real world.
+ # The :test delivery method accumulates sent emails in the
+ # ActionMailer::Base.deliveries array.
+ config.action_mailer.delivery_method = :test
+
+ # Unlike controllers, the mailer instance doesn't have any context about the
+ # incoming request so you'll need to provide the :host parameter yourself.
+ config.action_mailer.default_url_options = { host: "www.example.com" }
+
+ # Print deprecation notices to the stderr.
+ config.active_support.deprecation = :stderr
+
+ # Raise exceptions for disallowed deprecations.
+ config.active_support.disallowed_deprecation = :raise
+
+ # Tell Active Support which deprecation messages to disallow.
+ config.active_support.disallowed_deprecation_warnings = []
+
+ # Raises error for missing translations.
+ # config.i18n.raise_on_missing_translations = true
+
+ # Annotate rendered view with file names.
+ # config.action_view.annotate_rendered_view_with_filenames = true
+
+ # Raise error when a before_action's only/except options reference missing actions.
+ config.action_controller.raise_on_missing_callback_actions = true
+end
--- /dev/null
+# Be sure to restart your server when you modify this file.
+
+# Version of your assets, change this if you want to expire all your assets.
+Rails.application.config.assets.version = "1.0"
+
+# Add additional assets to the asset load path.
+# Rails.application.config.assets.paths << Emoji.images_path
+
+# Precompile additional assets.
+# application.js, application.css, and all non-JS/CSS in the app/assets
+# folder are already added.
+# Rails.application.config.assets.precompile += %w[ admin.js admin.css ]
--- /dev/null
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy.
+# See the Securing Rails Applications Guide for more information:
+# https://guides.rubyonrails.org/security.html#content-security-policy-header
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src style-src)
+#
+# # Report violations without enforcing the policy.
+# # config.content_security_policy_report_only = true
+# end
--- /dev/null
+# frozen_string_literal: true
+
+# Assuming you have not yet modified this file, each configuration option below
+# is set to its default value. Note that some are commented out while others
+# are not: uncommented lines are intended to protect your configuration from
+# breaking changes in upgrades (i.e., in the event that future versions of
+# Devise change the default values for those options).
+#
+# Use this hook to configure devise mailer, warden hooks and so forth.
+# Many of these configuration options can be set straight in your model.
+Devise.setup do |config|
+ # The secret key used by Devise. Devise uses this key to generate
+ # random tokens. Changing this key will render invalid all existing
+ # confirmation, reset password and unlock tokens in the database.
+ # Devise will use the `secret_key_base` as its `secret_key`
+ # by default. You can change it below and use your own secret key.
+ # config.secret_key = '23b92d967d048946a2b662a9fc1513c7a82dcc96479509c4cce6dc22f064437220cfca0c2acb375c5c9283b25db6d8d5d243a0ff0b60f562e416b4f08e082143'
+
+ # ==> Controller configuration
+ # Configure the parent class to the devise controllers.
+ # config.parent_controller = 'DeviseController'
+
+ # ==> Mailer Configuration
+ # Configure the e-mail address which will be shown in Devise::Mailer,
+ # note that it will be overwritten if you use your own mailer class
+ # with default "from" parameter.
+
+ # Configure the class responsible to send e-mails.
+ # config.mailer = 'Devise::Mailer'
+
+ # Configure the parent class responsible to send e-mails.
+ # config.parent_mailer = 'ActionMailer::Base'
+
+ # ==> ORM configuration
+ # Load and configure the ORM. Supports :active_record (default) and
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
+ # available as additional gems.
+ require 'devise/orm/active_record'
+
+ # ==> Configuration for any authentication mechanism
+ # Configure which keys are used when authenticating a user. The default is
+ # just :email. You can configure it to use [:username, :subdomain], so for
+ # authenticating a user, both parameters are required. Remember that those
+ # parameters are used only when authenticating and not when retrieving from
+ # session. If you need permissions, you should implement that in a before filter.
+ # You can also supply a hash where the value is a boolean determining whether
+ # or not authentication should be aborted when the value is not present.
+ # config.authentication_keys = [:email]
+
+ # Configure parameters from the request object used for authentication. Each entry
+ # given should be a request method and it will automatically be passed to the
+ # find_for_authentication method and considered in your model lookup. For instance,
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
+ # config.request_keys = []
+
+ # Configure which authentication keys should be case-insensitive.
+ # These keys will be downcased upon creating or modifying a user and when used
+ # to authenticate or find a user. Default is :email.
+ config.case_insensitive_keys = [:email]
+
+ # Configure which authentication keys should have whitespace stripped.
+ # These keys will have whitespace before and after removed upon creating or
+ # modifying a user and when used to authenticate or find a user. Default is :email.
+ config.strip_whitespace_keys = [:email]
+
+ # Tell if authentication through request.params is enabled. True by default.
+ # It can be set to an array that will enable params authentication only for the
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
+ # enable it only for database (email + password) authentication.
+ # config.params_authenticatable = true
+
+ # Tell if authentication through HTTP Auth is enabled. False by default.
+ # It can be set to an array that will enable http authentication only for the
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
+ # enable it only for database authentication.
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
+ # enable this with :database unless you are using a custom strategy.
+ # The supported strategies are:
+ # :database = Support basic authentication with authentication key + password
+ # config.http_authenticatable = false
+
+ # If 401 status code should be returned for AJAX requests. True by default.
+ # config.http_authenticatable_on_xhr = true
+
+ # The realm used in Http Basic Authentication. 'Application' by default.
+ # config.http_authentication_realm = 'Application'
+
+ # It will change confirmation, password recovery and other workflows
+ # to behave the same regardless if the e-mail provided was right or wrong.
+ # Does not affect registerable.
+ # config.paranoid = true
+
+ # By default Devise will store the user in session. You can skip storage for
+ # particular strategies by setting this option.
+ # Notice that if you are skipping storage for all authentication paths, you
+ # may want to disable generating routes to Devise's sessions controller by
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
+ config.skip_session_storage = [:http_auth]
+
+ # By default, Devise cleans up the CSRF token on authentication to
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
+ # requests for sign in and sign up, you need to get a new CSRF token
+ # from the server. You can disable this option at your own risk.
+ # config.clean_up_csrf_token_on_authentication = true
+
+ # When false, Devise will not attempt to reload routes on eager load.
+ # This can reduce the time taken to boot the app but if your application
+ # requires the Devise mappings to be loaded during boot time the application
+ # won't boot properly.
+ # config.reload_routes = true
+
+ # ==> Configuration for :database_authenticatable
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
+ # using other algorithms, it sets how many times you want the password to be hashed.
+ # The number of stretches used for generating the hashed password are stored
+ # with the hashed password. This allows you to change the stretches without
+ # invalidating existing passwords.
+ #
+ # Limiting the stretches to just one in testing will increase the performance of
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
+ config.stretches = Rails.env.test? ? 1 : 12
+
+ # Set up a pepper to generate the hashed password.
+ # config.pepper = '41751fba075b9a85d3e00434e37cfcc6c9876bb90de77e6f5100bd4593fc3c6aafa1aac5ed603bde47df4983b91bd51dfd04f2a5b4a78a482b05f41a3540c59a'
+
+ # Send a notification to the original email when the user's email is changed.
+ # config.send_email_changed_notification = false
+
+ # Send a notification email when the user's password is changed.
+ # config.send_password_change_notification = false
+
+ # ==> Configuration for :confirmable
+ # A period that the user is allowed to access the website even without
+ # confirming their account. For instance, if set to 2.days, the user will be
+ # able to access the website for two days without confirming their account,
+ # access will be blocked just in the third day.
+ # You can also set it to nil, which will allow the user to access the website
+ # without confirming their account.
+ # Default is 0.days, meaning the user cannot access the website without
+ # confirming their account.
+ # config.allow_unconfirmed_access_for = 2.days
+
+ # A period that the user is allowed to confirm their account before their
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
+ # their account within 3 days after the mail was sent, but on the fourth day
+ # their account can't be confirmed with the token any more.
+ # Default is nil, meaning there is no restriction on how long a user can take
+ # before confirming their account.
+ # config.confirm_within = 3.days
+
+ # If true, requires any email changes to be confirmed (exactly the same way as
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
+ # db field (see migrations). Until confirmed, new email is stored in
+ # unconfirmed_email column, and copied to email column on successful confirmation.
+ config.reconfirmable = true
+
+ # Defines which key will be used when confirming an account
+ # config.confirmation_keys = [:email]
+
+ # ==> Configuration for :rememberable
+ # The time the user will be remembered without asking for credentials again.
+ # config.remember_for = 2.weeks
+
+ # Invalidates all the remember me tokens when the user signs out.
+ config.expire_all_remember_me_on_sign_out = true
+
+ # If true, extends the user's remember period when remembered via cookie.
+ # config.extend_remember_period = false
+
+ # Options to be passed to the created cookie. For instance, you can set
+ # secure: true in order to force SSL only cookies.
+ # config.rememberable_options = {}
+
+ # ==> Configuration for :validatable
+ # Range for password length.
+ config.password_length = 6..128
+
+ # Email regex used to validate email formats. It simply asserts that
+ # one (and only one) @ exists in the given string. This is mainly
+ # to give user feedback and not to assert the e-mail validity.
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
+
+ # ==> Configuration for :timeoutable
+ # The time you want to timeout the user session without activity. After this
+ # time the user will be asked for credentials again. Default is 30 minutes.
+ # config.timeout_in = 30.minutes
+
+ # ==> Configuration for :lockable
+ # Defines which strategy will be used to lock an account.
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
+ # :none = No lock strategy. You should handle locking by yourself.
+ # config.lock_strategy = :failed_attempts
+
+ # Defines which key will be used when locking and unlocking an account
+ # config.unlock_keys = [:email]
+
+ # Defines which strategy will be used to unlock an account.
+ # :email = Sends an unlock link to the user email
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
+ # :both = Enables both strategies
+ # :none = No unlock strategy. You should handle unlocking by yourself.
+ # config.unlock_strategy = :both
+
+ # Number of authentication tries before locking an account if lock_strategy
+ # is failed attempts.
+ # config.maximum_attempts = 20
+
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
+ # config.unlock_in = 1.hour
+
+ # Warn on the last attempt before the account is locked.
+ # config.last_attempt_warning = true
+
+ # ==> Configuration for :recoverable
+ #
+ # Defines which key will be used when recovering the password for an account
+ # config.reset_password_keys = [:email]
+
+ # Time interval you can reset your password with a reset password key.
+ # Don't put a too small interval or your users won't have the time to
+ # change their passwords.
+ config.reset_password_within = 6.hours
+
+ # When set to false, does not sign a user in automatically after their password is
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
+ # config.sign_in_after_reset_password = true
+
+ # ==> Configuration for :encryptable
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
+ # for default behavior) and :restful_authentication_sha1 (then you should set
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
+ #
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
+ # config.encryptor = :sha512
+
+ # ==> Scopes configuration
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
+ # "users/sessions/new". It's turned off by default because it's slower if you
+ # are using only default views.
+ # config.scoped_views = false
+
+ # Configure the default scope given to Warden. By default it's the first
+ # devise role declared in your routes (usually :user).
+ # config.default_scope = :user
+
+ # Set this configuration to false if you want /users/sign_out to sign out
+ # only the current scope. By default, Devise signs out all scopes.
+ # config.sign_out_all_scopes = true
+
+ # ==> Navigation configuration
+ # Lists the formats that should be treated as navigational. Formats like
+ # :html should redirect to the sign in page when the user does not have
+ # access, but formats like :xml or :json, should return 401.
+ #
+ # If you have any extra navigational formats, like :iphone or :mobile, you
+ # should add them to the navigational formats lists.
+ #
+ # The "*/*" below is required to match Internet Explorer requests.
+ # config.navigational_formats = ['*/*', :html, :turbo_stream]
+
+ # The default HTTP method used to sign out a resource. Default is :delete.
+ config.sign_out_via = :delete
+
+ # ==> OmniAuth
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
+ # up on your models and hooks.
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
+
+ # ==> Warden configuration
+ # If you want to use other strategies, that are not supported by Devise, or
+ # change the failure app, you can configure them inside the config.warden block.
+ #
+ # config.warden do |manager|
+ # manager.intercept_401 = false
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
+ # end
+
+ # ==> Mountable engine configurations
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
+ # is mountable, there are some extra configurations to be taken into account.
+ # The following options are available, assuming the engine is mounted as:
+ #
+ # mount MyEngine, at: '/my_engine'
+ #
+ # The router that invoked `devise_for`, in the example above, would be:
+ # config.router_name = :my_engine
+ #
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
+ # so you need to do it manually. For the users scope, it would be:
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
+
+ # ==> Hotwire/Turbo configuration
+ # When using Devise with Hotwire/Turbo, the http status for error responses
+ # and some redirects must match the following. The default in Devise for existing
+ # apps is `200 OK` and `302 Found` respectively, but new apps are generated with
+ # these new defaults that match Hotwire/Turbo behavior.
+ # Note: These might become the new default in future versions of Devise.
+ config.responder.error_status = :unprocessable_entity
+ config.responder.redirect_status = :see_other
+
+ # ==> Configuration for :registerable
+
+ # When set to false, does not sign a user in automatically after their password is
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
+ # config.sign_in_after_change_password = true
+end
--- /dev/null
+# Be sure to restart your server when you modify this file.
+
+# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
+# Use this to limit dissemination of sensitive information.
+# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+]
--- /dev/null
+# Be sure to restart your server when you modify this file.
+
+# Add new inflection rules using the following format. Inflections
+# are locale specific, and you may define rules for as many different
+# locales as you wish. All of these examples are active by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
+# inflect.uncountable %w( fish sheep )
+# end
+
+# These inflection rules are supported but not enabled by default:
+# ActiveSupport::Inflector.inflections(:en) do |inflect|
+# inflect.acronym "RESTful"
+# end
--- /dev/null
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide HTTP permissions policy. For further
+# information see: https://developers.google.com/web/updates/2018/06/feature-policy
+
+# Rails.application.config.permissions_policy do |policy|
+# policy.camera :none
+# policy.gyroscope :none
+# policy.microphone :none
+# policy.usb :none
+# policy.fullscreen :self
+# policy.payment :self, "https://secure.example.com"
+# end
--- /dev/null
+# Additional translations at https://github.com/heartcombo/devise/wiki/I18n
+
+en:
+ devise:
+ confirmations:
+ confirmed: "Your email address has been successfully confirmed."
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
+ failure:
+ already_authenticated: "You are already signed in."
+ inactive: "Your account is not activated yet."
+ invalid: "Invalid %{authentication_keys} or password."
+ locked: "Your account is locked."
+ last_attempt: "You have one more attempt before your account is locked."
+ not_found_in_database: "Invalid %{authentication_keys} or password."
+ timeout: "Your session expired. Please sign in again to continue."
+ unauthenticated: "You need to sign in or sign up before continuing."
+ unconfirmed: "You have to confirm your email address before continuing."
+ mailer:
+ confirmation_instructions:
+ subject: "Confirmation instructions"
+ reset_password_instructions:
+ subject: "Reset password instructions"
+ unlock_instructions:
+ subject: "Unlock instructions"
+ email_changed:
+ subject: "Email Changed"
+ password_change:
+ subject: "Password Changed"
+ omniauth_callbacks:
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
+ success: "Successfully authenticated from %{kind} account."
+ passwords:
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
+ updated: "Your password has been changed successfully. You are now signed in."
+ updated_not_active: "Your password has been changed successfully."
+ registrations:
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
+ signed_up: "Welcome! You have signed up successfully."
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirmation link to confirm your new email address."
+ updated: "Your account has been updated successfully."
+ updated_but_not_signed_in: "Your account has been updated successfully, but since your password was changed, you need to sign in again."
+ sessions:
+ signed_in: "Signed in successfully."
+ signed_out: "Signed out successfully."
+ already_signed_out: "Signed out successfully."
+ unlocks:
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
+ errors:
+ messages:
+ already_confirmed: "was already confirmed, please try signing in"
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
+ expired: "has expired, please request a new one"
+ not_found: "not found"
+ not_locked: "was not locked"
+ not_saved:
+ one: "1 error prohibited this %{resource} from being saved:"
+ other: "%{count} errors prohibited this %{resource} from being saved:"
--- /dev/null
+# Files in the config/locales directory are used for internationalization and
+# are automatically loaded by Rails. If you want to use locales other than
+# English, add the necessary files in this directory.
+#
+# To use the locales, use `I18n.t`:
+#
+# I18n.t "hello"
+#
+# In views, this is aliased to just `t`:
+#
+# <%= t("hello") %>
+#
+# To use a different locale, set it with `I18n.locale`:
+#
+# I18n.locale = :es
+#
+# This would use the information in config/locales/es.yml.
+#
+# To learn more about the API, please read the Rails Internationalization guide
+# at https://guides.rubyonrails.org/i18n.html.
+#
+# Be aware that YAML interprets the following case-insensitive strings as
+# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
+# must be quoted to be interpreted as strings. For example:
+#
+# en:
+# "yes": yup
+# enabled: "ON"
+
+en:
+ hello: "Hello world"
--- /dev/null
+# This configuration file will be evaluated by Puma. The top-level methods that
+# are invoked here are part of Puma's configuration DSL. For more information
+# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
+
+# Puma starts a configurable number of processes (workers) and each process
+# serves each request in a thread from an internal thread pool.
+#
+# The ideal number of threads per worker depends both on how much time the
+# application spends waiting for IO operations and on how much you wish to
+# to prioritize throughput over latency.
+#
+# As a rule of thumb, increasing the number of threads will increase how much
+# traffic a given process can handle (throughput), but due to CRuby's
+# Global VM Lock (GVL) it has diminishing returns and will degrade the
+# response time (latency) of the application.
+#
+# The default is set to 3 threads as it's deemed a decent compromise between
+# throughput and latency for the average Rails application.
+#
+# Any libraries that use a connection pool or another resource pool should
+# be configured to provide at least as many connections as the number of
+# threads. This includes Active Record's `pool` parameter in `database.yml`.
+threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
+threads threads_count, threads_count
+
+# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
+port ENV.fetch("PORT", 3000)
+
+# Allow puma to be restarted by `bin/rails restart` command.
+plugin :tmp_restart
+
+# Specify the PID file. Defaults to tmp/pids/server.pid in development.
+# In other environments, only set the PID file if requested.
+pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
--- /dev/null
+Rails.application.routes.draw do
+
+ namespace :api do
+ namespace :v1 do
+ match 'api', to: 'api#handle_request', via: [:get, :post]
+ get 'status', to: 'api#status'
+ end
+ end
+
+ resources :api_keys
+ devise_for :users
+ resources :posts
+ get '/feed', to: 'pubview#rss', as: 'rss', defaults: { format: 'rss' }
+ get '/feed/dispatches', to: 'pubview#dispatches_rss', as: 'dispatches_rss', defaults: { format: 'rss' }
+
+ get '/:year/:slug', to: 'pubview#post', as: 'public_post'
+ # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
+ # Can be used by load balancers and uptime monitors to verify that the app is live.
+ get "up" => "rails/health#show", as: :rails_health_check
+
+ # Render dynamic PWA files from app/views/pwa/*
+ get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
+ get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
+
+ # Defines the root path route ("/")
+ root "pubview#index"
+end
--- /dev/null
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
--- /dev/null
+class CreatePosts < ActiveRecord::Migration[7.2]
+ def change
+ create_table :posts do |t|
+ t.string :post_type
+ t.string :title
+ t.string :slug
+ t.datetime :published_at
+ t.text :excerpt
+ t.text :tags
+ t.text :content
+ t.string :url
+
+ t.timestamps
+ end
+
+ add_index :posts, :slug, unique: true
+ add_index :posts, :published_at
+ add_index :posts, :post_type
+ end
+end
--- /dev/null
+# frozen_string_literal: true
+
+class DeviseCreateUsers < ActiveRecord::Migration[7.2]
+ def change
+ create_table :users do |t|
+ ## Database authenticatable
+ t.string :email, null: false, default: ""
+ t.string :encrypted_password, null: false, default: ""
+
+ ## Recoverable
+ t.string :reset_password_token
+ t.datetime :reset_password_sent_at
+
+ ## Rememberable
+ t.datetime :remember_created_at
+
+ ## Trackable
+ # t.integer :sign_in_count, default: 0, null: false
+ # t.datetime :current_sign_in_at
+ # t.datetime :last_sign_in_at
+ # t.string :current_sign_in_ip
+ # t.string :last_sign_in_ip
+
+ ## Confirmable
+ # t.string :confirmation_token
+ # t.datetime :confirmed_at
+ # t.datetime :confirmation_sent_at
+ # t.string :unconfirmed_email # Only if using reconfirmable
+
+ ## Lockable
+ # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
+ # t.string :unlock_token # Only if unlock strategy is :email or :both
+ # t.datetime :locked_at
+
+ t.string :first_name
+ t.string :last_name
+ t.boolean :admin, default: false
+
+ t.timestamps null: false
+ end
+
+ add_index :users, :email, unique: true
+ add_index :users, :reset_password_token, unique: true
+ # add_index :users, :confirmation_token, unique: true
+ # add_index :users, :unlock_token, unique: true
+ end
+end
--- /dev/null
+class CreateApiKeys < ActiveRecord::Migration[7.2]
+ def change
+ create_table :api_keys do |t|
+ t.string :key
+
+ t.timestamps
+ end
+ add_index :api_keys, :key, unique: true
+ end
+end
--- /dev/null
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
+#
+# It's strongly recommended that you check this file into your version control system.
+
+ActiveRecord::Schema[7.2].define(version: 2024_09_14_095138) do
+ create_table "api_keys", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
+ t.string "key"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["key"], name: "index_api_keys_on_key", unique: true
+ end
+
+ create_table "posts", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
+ t.string "post_type"
+ t.string "title"
+ t.string "slug"
+ t.datetime "published_at"
+ t.text "excerpt"
+ t.text "tags"
+ t.text "content"
+ t.string "url"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["post_type"], name: "index_posts_on_post_type"
+ t.index ["published_at"], name: "index_posts_on_published_at"
+ t.index ["slug"], name: "index_posts_on_slug", unique: true
+ end
+
+ create_table "users", charset: "utf8mb4", collation: "utf8mb4_0900_ai_ci", force: :cascade do |t|
+ t.string "email", default: "", null: false
+ t.string "encrypted_password", default: "", null: false
+ t.string "reset_password_token"
+ t.datetime "reset_password_sent_at"
+ t.datetime "remember_created_at"
+ t.string "first_name"
+ t.string "last_name"
+ t.boolean "admin"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["email"], name: "index_users_on_email", unique: true
+ t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
+ end
+end
--- /dev/null
+# This file should ensure the existence of records required to run the application in every environment (production,
+# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
+#
+# Example:
+#
+# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
+# MovieGenre.find_or_create_by!(name: genre_name)
+# end
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The page you were looking for doesn't exist (404)</title>
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <style>
+ .rails-default-error-page {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ margin: 0;
+ }
+
+ .rails-default-error-page div.dialog {
+ width: 95%;
+ max-width: 33em;
+ margin: 4em auto 0;
+ }
+
+ .rails-default-error-page div.dialog > div {
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 12% 0;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+
+ .rails-default-error-page h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ .rails-default-error-page div.dialog > p {
+ margin: 0 0 1em;
+ padding: 1em;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+ </style>
+</head>
+
+<body class="rails-default-error-page">
+ <!-- This file lives in public/404.html -->
+ <div class="dialog">
+ <div>
+ <h1>The page you were looking for doesn't exist.</h1>
+ <p>You may have mistyped the address or the page may have moved.</p>
+ </div>
+ <p>If you are the application owner check the logs for more information.</p>
+ </div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Your browser is not supported (406)</title>
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <style>
+ .rails-default-error-page {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ margin: 0;
+ }
+
+ .rails-default-error-page div.dialog {
+ width: 95%;
+ max-width: 33em;
+ margin: 4em auto 0;
+ }
+
+ .rails-default-error-page div.dialog > div {
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 12% 0;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+
+ .rails-default-error-page h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ .rails-default-error-page div.dialog > p {
+ margin: 0 0 1em;
+ padding: 1em;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+ </style>
+</head>
+
+<body class="rails-default-error-page">
+ <!-- This file lives in public/406-unsupported-browser.html -->
+ <div class="dialog">
+ <div>
+ <h1>Your browser is not supported.</h1>
+ <p>Please upgrade your browser to continue.</p>
+ </div>
+ </div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>The change you wanted was rejected (422)</title>
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <style>
+ .rails-default-error-page {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ margin: 0;
+ }
+
+ .rails-default-error-page div.dialog {
+ width: 95%;
+ max-width: 33em;
+ margin: 4em auto 0;
+ }
+
+ .rails-default-error-page div.dialog > div {
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 12% 0;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+
+ .rails-default-error-page h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ .rails-default-error-page div.dialog > p {
+ margin: 0 0 1em;
+ padding: 1em;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+ </style>
+</head>
+
+<body class="rails-default-error-page">
+ <!-- This file lives in public/422.html -->
+ <div class="dialog">
+ <div>
+ <h1>The change you wanted was rejected.</h1>
+ <p>Maybe you tried to change something you didn't have access to.</p>
+ </div>
+ <p>If you are the application owner check the logs for more information.</p>
+ </div>
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html>
+<html>
+<head>
+ <title>We're sorry, but something went wrong (500)</title>
+ <meta name="viewport" content="width=device-width,initial-scale=1">
+ <style>
+ .rails-default-error-page {
+ background-color: #EFEFEF;
+ color: #2E2F30;
+ text-align: center;
+ font-family: arial, sans-serif;
+ margin: 0;
+ }
+
+ .rails-default-error-page div.dialog {
+ width: 95%;
+ max-width: 33em;
+ margin: 4em auto 0;
+ }
+
+ .rails-default-error-page div.dialog > div {
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #BBB;
+ border-top: #B00100 solid 4px;
+ border-top-left-radius: 9px;
+ border-top-right-radius: 9px;
+ background-color: white;
+ padding: 7px 12% 0;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+
+ .rails-default-error-page h1 {
+ font-size: 100%;
+ color: #730E15;
+ line-height: 1.5em;
+ }
+
+ .rails-default-error-page div.dialog > p {
+ margin: 0 0 1em;
+ padding: 1em;
+ background-color: #F7F7F7;
+ border: 1px solid #CCC;
+ border-right-color: #999;
+ border-left-color: #999;
+ border-bottom-color: #999;
+ border-bottom-left-radius: 4px;
+ border-bottom-right-radius: 4px;
+ border-top-color: #DADADA;
+ color: #666;
+ box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
+ }
+ </style>
+</head>
+
+<body class="rails-default-error-page">
+ <!-- This file lives in public/500.html -->
+ <div class="dialog">
+ <div>
+ <h1>We're sorry, but something went wrong.</h1>
+ </div>
+ <p>If you are the application owner check the logs for more information.</p>
+ </div>
+</body>
+</html>
--- /dev/null
+# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
--- /dev/null
+require "test_helper"
+
+class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
+ driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
+end
--- /dev/null
+require "test_helper"
+
+class ApiKeysControllerTest < ActionDispatch::IntegrationTest
+ # test "the truth" do
+ # assert true
+ # end
+end
--- /dev/null
+require "test_helper"
+
+class PostsControllerTest < ActionDispatch::IntegrationTest
+ setup do
+ @post = posts(:one)
+ end
+
+ test "should get index" do
+ get posts_url
+ assert_response :success
+ end
+
+ test "should get new" do
+ get new_post_url
+ assert_response :success
+ end
+
+ test "should create post" do
+ assert_difference("Post.count") do
+ post posts_url, params: { post: { content: @post.content, excerpt: @post.excerpt, post_type: @post.post_type, published_at: @post.published_at, slug: @post.slug, tags: @post.tags, title: @post.title, url: @post.url } }
+ end
+
+ assert_redirected_to post_url(Post.last)
+ end
+
+ test "should show post" do
+ get post_url(@post)
+ assert_response :success
+ end
+
+ test "should get edit" do
+ get edit_post_url(@post)
+ assert_response :success
+ end
+
+ test "should update post" do
+ patch post_url(@post), params: { post: { content: @post.content, excerpt: @post.excerpt, post_type: @post.post_type, published_at: @post.published_at, slug: @post.slug, tags: @post.tags, title: @post.title, url: @post.url } }
+ assert_redirected_to post_url(@post)
+ end
+
+ test "should destroy post" do
+ assert_difference("Post.count", -1) do
+ delete post_url(@post)
+ end
+
+ assert_redirected_to posts_url
+ end
+end
--- /dev/null
+require "test_helper"
+
+class PubviewControllerTest < ActionDispatch::IntegrationTest
+ test "should get index" do
+ get pubview_index_url
+ assert_response :success
+ end
+
+ test "should get post" do
+ get pubview_post_url
+ assert_response :success
+ end
+
+ test "should get rss" do
+ get pubview_rss_url
+ assert_response :success
+ end
+end
--- /dev/null
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ key: MyString
+
+two:
+ key: MyString
--- /dev/null
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+one:
+ post_type: MyString
+ title: MyString
+ slug: MyString
+ published_at: 2024-09-14 17:08:02
+ excerpt: MyText
+ tags: MyText
+ content: MyText
+ url: MyString
+
+two:
+ post_type: MyString
+ title: MyString
+ slug: MyString
+ published_at: 2024-09-14 17:08:02
+ excerpt: MyText
+ tags: MyText
+ content: MyText
+ url: MyString
--- /dev/null
+# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
+
+# This model initially had no columns defined. If you add columns to the
+# model remove the "{}" from the fixture names and add the columns immediately
+# below each fixture, per the syntax in the comments below
+#
+one: {}
+# column: value
+#
+two: {}
+# column: value
--- /dev/null
+require "test_helper"
+
+class ApiKeyTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
--- /dev/null
+require "test_helper"
+
+class PostTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
--- /dev/null
+require "test_helper"
+
+class UserTest < ActiveSupport::TestCase
+ # test "the truth" do
+ # assert true
+ # end
+end
--- /dev/null
+require "application_system_test_case"
+
+class PostsTest < ApplicationSystemTestCase
+ setup do
+ @post = posts(:one)
+ end
+
+ test "visiting the index" do
+ visit posts_url
+ assert_selector "h1", text: "Posts"
+ end
+
+ test "should create post" do
+ visit posts_url
+ click_on "New post"
+
+ fill_in "Content", with: @post.content
+ fill_in "Excerpt", with: @post.excerpt
+ fill_in "Post type", with: @post.post_type
+ fill_in "Published at", with: @post.published_at
+ fill_in "Slug", with: @post.slug
+ fill_in "Tags", with: @post.tags
+ fill_in "Title", with: @post.title
+ fill_in "Url", with: @post.url
+ click_on "Create Post"
+
+ assert_text "Post was successfully created"
+ click_on "Back"
+ end
+
+ test "should update Post" do
+ visit post_url(@post)
+ click_on "Edit this post", match: :first
+
+ fill_in "Content", with: @post.content
+ fill_in "Excerpt", with: @post.excerpt
+ fill_in "Post type", with: @post.post_type
+ fill_in "Published at", with: @post.published_at.to_s
+ fill_in "Slug", with: @post.slug
+ fill_in "Tags", with: @post.tags
+ fill_in "Title", with: @post.title
+ fill_in "Url", with: @post.url
+ click_on "Update Post"
+
+ assert_text "Post was successfully updated"
+ click_on "Back"
+ end
+
+ test "should destroy Post" do
+ visit post_url(@post)
+ click_on "Destroy this post", match: :first
+
+ assert_text "Post was successfully destroyed"
+ end
+end
--- /dev/null
+ENV["RAILS_ENV"] ||= "test"
+require_relative "../config/environment"
+require "rails/test_help"
+
+module ActiveSupport
+ class TestCase
+ # Run tests in parallel with specified workers
+ parallelize(workers: :number_of_processors)
+
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+ end
+end