From e5878ea4298371b57af7d58847820ee7664a9f77 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 10 Jan 2026 16:17:07 +0000 Subject: [PATCH] first --- .dockerignore | 51 ++ .gitattributes | 9 + .github/dependabot.yml | 12 + .github/workflows/ci.yml | 124 +++++ .gitignore | 39 ++ .kamal/hooks/docker-setup.sample | 3 + .kamal/hooks/post-app-boot.sample | 3 + .kamal/hooks/post-deploy.sample | 14 + .kamal/hooks/post-proxy-reboot.sample | 3 + .kamal/hooks/pre-app-boot.sample | 3 + .kamal/hooks/pre-build.sample | 51 ++ .kamal/hooks/pre-connect.sample | 47 ++ .kamal/hooks/pre-deploy.sample | 122 +++++ .kamal/hooks/pre-proxy-reboot.sample | 3 + .kamal/secrets | 19 + .rubocop.yml | 8 + .ruby-version | 1 + Dockerfile | 76 +++ Gemfile | 68 +++ Gemfile.lock | 414 ++++++++++++++++ RAILS_ENV=production | 0 README.md | 1 + Rakefile | 6 + app/assets/images/.keep | 0 app/assets/stylesheets/actiontext.css | 440 ++++++++++++++++++ app/assets/stylesheets/application.css | 292 ++++++++++++ app/channels/application_cable/connection.rb | 16 + app/controllers/application_controller.rb | 22 + app/controllers/articles_controller.rb | 74 +++ app/controllers/blogmap_controller.rb | 20 + app/controllers/blogs_controller.rb | 67 +++ app/controllers/comments_controller.rb | 42 ++ app/controllers/concerns/.keep | 0 app/controllers/concerns/authentication.rb | 54 +++ app/controllers/lists_controller.rb | 2 + app/controllers/members_controller.rb | 57 +++ app/controllers/pages_controller.rb | 2 + app/controllers/passwords_controller.rb | 35 ++ app/controllers/posts_controller.rb | 64 +++ app/controllers/profiles_controller.rb | 64 +++ app/controllers/sessions_controller.rb | 31 ++ app/controllers/sitemaps_controller.rb | 51 ++ app/controllers/updates_controller.rb | 2 + app/controllers/welcome_controller.rb | 19 + app/helpers/application_helper.rb | 2 + app/helpers/articles_helper.rb | 2 + app/helpers/blogmap_helper.rb | 2 + app/helpers/blogs_helper.rb | 2 + app/helpers/comments_helper.rb | 2 + app/helpers/lists_helper.rb | 2 + app/helpers/members_helper.rb | 2 + app/helpers/pages_helper.rb | 2 + app/helpers/posts_helper.rb | 2 + app/helpers/profiles_helper.rb | 2 + app/helpers/sitemap_helper.rb | 2 + app/helpers/updates_helper.rb | 2 + app/helpers/welcome_helper.rb | 2 + app/javascript/application.js | 6 + app/javascript/controllers/application.js | 9 + .../controllers/hello_controller.js | 7 + app/javascript/controllers/index.js | 4 + app/jobs/application_job.rb | 7 + app/mailers/application_mailer.rb | 4 + app/mailers/passwords_mailer.rb | 6 + app/models/application_record.rb | 3 + app/models/article.rb | 15 + app/models/blog.rb | 7 + app/models/blogmap.rb | 2 + app/models/comment.rb | 6 + app/models/concerns/.keep | 0 app/models/current.rb | 4 + app/models/list.rb | 2 + app/models/member.rb | 12 + app/models/page.rb | 10 + app/models/post.rb | 13 + app/models/profile.rb | 5 + app/models/session.rb | 3 + app/models/sitemap.rb | 5 + app/models/update.rb | 2 + app/models/user.rb | 10 + app/views/articles/_form.html.erb | 28 ++ app/views/articles/edit.html.erb | 28 ++ app/views/articles/feed.xml.builder | 19 + app/views/articles/index.html.erb | 20 + app/views/articles/new.html.erb | 32 ++ app/views/articles/rss.rss.builder | 23 + app/views/articles/show.html.erb | 37 ++ app/views/blogmap/index.html.erb | 9 + app/views/blogs/edit.html.erb | 21 + app/views/blogs/index.html.erb | 9 + app/views/blogs/list.html.erb | 9 + app/views/blogs/new.html.erb | 23 + app/views/blogs/show.html.erb | 39 ++ app/views/comments/_comment.html.erb | 21 + .../action_text/contents/_content.html.erb | 3 + app/views/layouts/application.html.erb | 60 +++ app/views/layouts/mailer.html.erb | 13 + app/views/layouts/mailer.text.erb | 1 + app/views/members/edit.html.erb | 56 +++ app/views/members/index.html.erb | 42 ++ app/views/members/new.html.erb | 44 ++ app/views/members/show.html.erb | 75 +++ app/views/pages/edit.html.erb | 0 app/views/pages/index.html.erb | 0 app/views/pages/new.html.erb | 0 app/views/pages/show.html.erb | 0 app/views/passwords_mailer/reset.html.erb | 6 + app/views/passwords_mailer/reset.text.erb | 4 + app/views/posts/edit.html.erb | 34 ++ app/views/posts/index.html.erb | 26 ++ app/views/posts/new.html.erb | 36 ++ app/views/posts/show.html.erb | 39 ++ app/views/profiles/edit.html.erb | 38 ++ app/views/profiles/index.html.erb | 31 ++ app/views/profiles/new.html.erb | 38 ++ app/views/profiles/show.html.erb | 17 + app/views/pwa/manifest.json.erb | 22 + app/views/pwa/service-worker.js | 26 ++ app/views/sessions/new.html.erb | 11 + app/views/sitemaps/edit.html.erb | 7 + app/views/sitemaps/index.html.erb | 17 + app/views/sitemaps/new.html.erb | 7 + app/views/sitemaps/show.html.erb | 0 app/views/welcome/index.html.erb | 43 ++ bin/brakeman | 7 + bin/bundler-audit | 6 + bin/ci | 6 + bin/dev | 2 + bin/docker-entrypoint | 8 + bin/importmap | 4 + bin/jobs | 6 + bin/kamal | 27 ++ bin/rails | 4 + bin/rake | 4 + bin/rubocop | 8 + bin/setup | 35 ++ bin/thrust | 5 + config.ru | 6 + config/application.rb | 27 ++ config/boot.rb | 4 + config/bundler-audit.yml | 5 + config/cable.yml | 17 + config/cache.yml | 16 + config/ci.rb | 23 + config/credentials.yml.enc | 1 + config/database.yml | 41 ++ config/deploy.yml | 126 +++++ config/environment.rb | 5 + config/environments/development.rb | 78 ++++ config/environments/production.rb | 90 ++++ config/environments/test.rb | 53 +++ config/importmap.rb | 9 + config/initializers/assets.rb | 7 + .../initializers/content_security_policy.rb | 29 ++ .../initializers/filter_parameter_logging.rb | 8 + config/initializers/inflections.rb | 16 + config/initializers/session_store.rb | 5 + config/locales/en.yml | 31 ++ config/puma.rb | 42 ++ config/queue.yml | 18 + config/recurring.yml | 15 + config/routes.rb | 26 ++ config/storage.yml | 27 ++ lib/tasks/.keep | 0 log/.keep | 0 public/400.html | 135 ++++++ public/404.html | 135 ++++++ public/406-unsupported-browser.html | 135 ++++++ public/422.html | 135 ++++++ public/500.html | 135 ++++++ public/button.png | Bin 0 -> 2272 bytes public/icon.svg | 68 +++ public/kissingcomputer.png | Bin 0 -> 11002 bytes public/robots.txt | 1 + public/updates.html | 10 + script/.keep | 0 test/application_system_test_case.rb | 5 + test/controllers/.keep | 0 test/controllers/articles_controller_test.rb | 7 + test/controllers/blogmap_controller_test.rb | 7 + test/controllers/blogs_controller_test.rb | 7 + test/controllers/comments_controller_test.rb | 7 + test/controllers/lists_controller_test.rb | 7 + test/controllers/members_controller_test.rb | 7 + test/controllers/pages_controller_test.rb | 7 + test/controllers/passwords_controller_test.rb | 67 +++ test/controllers/posts_controller_test.rb | 7 + test/controllers/profiles_controller_test.rb | 7 + test/controllers/sessions_controller_test.rb | 33 ++ test/controllers/sitemap_controller_test.rb | 7 + test/controllers/updates_controller_test.rb | 7 + test/controllers/welcome_controller_test.rb | 8 + test/fixtures/action_text/rich_texts.yml | 4 + test/fixtures/articles.yml | 13 + test/fixtures/blogmaps.yml | 11 + test/fixtures/blogs.yml | 11 + test/fixtures/comments.yml | 13 + test/fixtures/files/.keep | 0 test/fixtures/lists.yml | 11 + test/fixtures/members.yml | 11 + test/fixtures/pages.yml | 11 + test/fixtures/posts.yml | 11 + test/fixtures/profiles.yml | 15 + test/fixtures/sitemaps.yml | 11 + test/fixtures/updates.yml | 11 + test/fixtures/users.yml | 9 + test/helpers/.keep | 0 test/integration/.keep | 0 test/mailers/.keep | 0 .../previews/passwords_mailer_preview.rb | 7 + test/models/.keep | 0 test/models/article_test.rb | 7 + test/models/blog_test.rb | 7 + test/models/blogmap_test.rb | 7 + test/models/comment_test.rb | 7 + test/models/list_test.rb | 7 + test/models/member_test.rb | 7 + test/models/page_test.rb | 7 + test/models/post_test.rb | 7 + test/models/profile_test.rb | 7 + test/models/sitemap_test.rb | 7 + test/models/update_test.rb | 7 + test/models/user_test.rb | 8 + test/system/.keep | 0 test/test_helper.rb | 16 + test/test_helpers/session_test_helper.rb | 19 + tmp/.keep | 0 tmp/pids/.keep | 0 vendor/.keep | 0 vendor/javascript/.keep | 0 230 files changed, 5673 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitattributes create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .gitignore create mode 100755 .kamal/hooks/docker-setup.sample create mode 100755 .kamal/hooks/post-app-boot.sample create mode 100755 .kamal/hooks/post-deploy.sample create mode 100755 .kamal/hooks/post-proxy-reboot.sample create mode 100755 .kamal/hooks/pre-app-boot.sample create mode 100755 .kamal/hooks/pre-build.sample create mode 100755 .kamal/hooks/pre-connect.sample create mode 100755 .kamal/hooks/pre-deploy.sample create mode 100755 .kamal/hooks/pre-proxy-reboot.sample create mode 100644 .kamal/secrets create mode 100644 .rubocop.yml create mode 100644 .ruby-version create mode 100644 Dockerfile create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 RAILS_ENV=production create mode 100644 README.md create mode 100644 Rakefile create mode 100644 app/assets/images/.keep create mode 100644 app/assets/stylesheets/actiontext.css create mode 100644 app/assets/stylesheets/application.css create mode 100644 app/channels/application_cable/connection.rb create mode 100644 app/controllers/application_controller.rb create mode 100644 app/controllers/articles_controller.rb create mode 100644 app/controllers/blogmap_controller.rb create mode 100644 app/controllers/blogs_controller.rb create mode 100644 app/controllers/comments_controller.rb create mode 100644 app/controllers/concerns/.keep create mode 100644 app/controllers/concerns/authentication.rb create mode 100644 app/controllers/lists_controller.rb create mode 100644 app/controllers/members_controller.rb create mode 100644 app/controllers/pages_controller.rb create mode 100644 app/controllers/passwords_controller.rb create mode 100644 app/controllers/posts_controller.rb create mode 100644 app/controllers/profiles_controller.rb create mode 100644 app/controllers/sessions_controller.rb create mode 100644 app/controllers/sitemaps_controller.rb create mode 100644 app/controllers/updates_controller.rb create mode 100644 app/controllers/welcome_controller.rb create mode 100644 app/helpers/application_helper.rb create mode 100644 app/helpers/articles_helper.rb create mode 100644 app/helpers/blogmap_helper.rb create mode 100644 app/helpers/blogs_helper.rb create mode 100644 app/helpers/comments_helper.rb create mode 100644 app/helpers/lists_helper.rb create mode 100644 app/helpers/members_helper.rb create mode 100644 app/helpers/pages_helper.rb create mode 100644 app/helpers/posts_helper.rb create mode 100644 app/helpers/profiles_helper.rb create mode 100644 app/helpers/sitemap_helper.rb create mode 100644 app/helpers/updates_helper.rb create mode 100644 app/helpers/welcome_helper.rb create mode 100644 app/javascript/application.js create mode 100644 app/javascript/controllers/application.js create mode 100644 app/javascript/controllers/hello_controller.js create mode 100644 app/javascript/controllers/index.js create mode 100644 app/jobs/application_job.rb create mode 100644 app/mailers/application_mailer.rb create mode 100644 app/mailers/passwords_mailer.rb create mode 100644 app/models/application_record.rb create mode 100644 app/models/article.rb create mode 100644 app/models/blog.rb create mode 100644 app/models/blogmap.rb create mode 100644 app/models/comment.rb create mode 100644 app/models/concerns/.keep create mode 100644 app/models/current.rb create mode 100644 app/models/list.rb create mode 100644 app/models/member.rb create mode 100644 app/models/page.rb create mode 100644 app/models/post.rb create mode 100644 app/models/profile.rb create mode 100644 app/models/session.rb create mode 100644 app/models/sitemap.rb create mode 100644 app/models/update.rb create mode 100644 app/models/user.rb create mode 100644 app/views/articles/_form.html.erb create mode 100644 app/views/articles/edit.html.erb create mode 100644 app/views/articles/feed.xml.builder create mode 100644 app/views/articles/index.html.erb create mode 100644 app/views/articles/new.html.erb create mode 100644 app/views/articles/rss.rss.builder create mode 100644 app/views/articles/show.html.erb create mode 100644 app/views/blogmap/index.html.erb create mode 100644 app/views/blogs/edit.html.erb create mode 100644 app/views/blogs/index.html.erb create mode 100644 app/views/blogs/list.html.erb create mode 100644 app/views/blogs/new.html.erb create mode 100644 app/views/blogs/show.html.erb create mode 100644 app/views/comments/_comment.html.erb create mode 100644 app/views/layouts/action_text/contents/_content.html.erb create mode 100644 app/views/layouts/application.html.erb create mode 100644 app/views/layouts/mailer.html.erb create mode 100644 app/views/layouts/mailer.text.erb create mode 100644 app/views/members/edit.html.erb create mode 100644 app/views/members/index.html.erb create mode 100644 app/views/members/new.html.erb create mode 100644 app/views/members/show.html.erb create mode 100644 app/views/pages/edit.html.erb create mode 100644 app/views/pages/index.html.erb create mode 100644 app/views/pages/new.html.erb create mode 100644 app/views/pages/show.html.erb create mode 100644 app/views/passwords_mailer/reset.html.erb create mode 100644 app/views/passwords_mailer/reset.text.erb create mode 100644 app/views/posts/edit.html.erb create mode 100644 app/views/posts/index.html.erb create mode 100644 app/views/posts/new.html.erb create mode 100644 app/views/posts/show.html.erb create mode 100644 app/views/profiles/edit.html.erb create mode 100644 app/views/profiles/index.html.erb create mode 100644 app/views/profiles/new.html.erb create mode 100644 app/views/profiles/show.html.erb create mode 100644 app/views/pwa/manifest.json.erb create mode 100644 app/views/pwa/service-worker.js create mode 100644 app/views/sessions/new.html.erb create mode 100644 app/views/sitemaps/edit.html.erb create mode 100644 app/views/sitemaps/index.html.erb create mode 100644 app/views/sitemaps/new.html.erb create mode 100644 app/views/sitemaps/show.html.erb create mode 100644 app/views/welcome/index.html.erb create mode 100755 bin/brakeman create mode 100755 bin/bundler-audit create mode 100755 bin/ci create mode 100755 bin/dev create mode 100755 bin/docker-entrypoint create mode 100755 bin/importmap create mode 100755 bin/jobs create mode 100755 bin/kamal create mode 100755 bin/rails create mode 100755 bin/rake create mode 100755 bin/rubocop create mode 100755 bin/setup create mode 100755 bin/thrust create mode 100644 config.ru create mode 100644 config/application.rb create mode 100644 config/boot.rb create mode 100644 config/bundler-audit.yml create mode 100644 config/cable.yml create mode 100644 config/cache.yml create mode 100644 config/ci.rb create mode 100644 config/credentials.yml.enc create mode 100644 config/database.yml create mode 100644 config/deploy.yml create mode 100644 config/environment.rb create mode 100644 config/environments/development.rb create mode 100644 config/environments/production.rb create mode 100644 config/environments/test.rb create mode 100644 config/importmap.rb create mode 100644 config/initializers/assets.rb create mode 100644 config/initializers/content_security_policy.rb create mode 100644 config/initializers/filter_parameter_logging.rb create mode 100644 config/initializers/inflections.rb create mode 100644 config/initializers/session_store.rb create mode 100644 config/locales/en.yml create mode 100644 config/puma.rb create mode 100644 config/queue.yml create mode 100644 config/recurring.yml create mode 100644 config/routes.rb create mode 100644 config/storage.yml create mode 100644 lib/tasks/.keep create mode 100644 log/.keep create mode 100644 public/400.html create mode 100644 public/404.html create mode 100644 public/406-unsupported-browser.html create mode 100644 public/422.html create mode 100644 public/500.html create mode 100644 public/button.png create mode 100644 public/icon.svg create mode 100644 public/kissingcomputer.png create mode 100644 public/robots.txt create mode 100644 public/updates.html create mode 100644 script/.keep create mode 100644 test/application_system_test_case.rb create mode 100644 test/controllers/.keep create mode 100644 test/controllers/articles_controller_test.rb create mode 100644 test/controllers/blogmap_controller_test.rb create mode 100644 test/controllers/blogs_controller_test.rb create mode 100644 test/controllers/comments_controller_test.rb create mode 100644 test/controllers/lists_controller_test.rb create mode 100644 test/controllers/members_controller_test.rb create mode 100644 test/controllers/pages_controller_test.rb create mode 100644 test/controllers/passwords_controller_test.rb create mode 100644 test/controllers/posts_controller_test.rb create mode 100644 test/controllers/profiles_controller_test.rb create mode 100644 test/controllers/sessions_controller_test.rb create mode 100644 test/controllers/sitemap_controller_test.rb create mode 100644 test/controllers/updates_controller_test.rb create mode 100644 test/controllers/welcome_controller_test.rb create mode 100644 test/fixtures/action_text/rich_texts.yml create mode 100644 test/fixtures/articles.yml create mode 100644 test/fixtures/blogmaps.yml create mode 100644 test/fixtures/blogs.yml create mode 100644 test/fixtures/comments.yml create mode 100644 test/fixtures/files/.keep create mode 100644 test/fixtures/lists.yml create mode 100644 test/fixtures/members.yml create mode 100644 test/fixtures/pages.yml create mode 100644 test/fixtures/posts.yml create mode 100644 test/fixtures/profiles.yml create mode 100644 test/fixtures/sitemaps.yml create mode 100644 test/fixtures/updates.yml create mode 100644 test/fixtures/users.yml create mode 100644 test/helpers/.keep create mode 100644 test/integration/.keep create mode 100644 test/mailers/.keep create mode 100644 test/mailers/previews/passwords_mailer_preview.rb create mode 100644 test/models/.keep create mode 100644 test/models/article_test.rb create mode 100644 test/models/blog_test.rb create mode 100644 test/models/blogmap_test.rb create mode 100644 test/models/comment_test.rb create mode 100644 test/models/list_test.rb create mode 100644 test/models/member_test.rb create mode 100644 test/models/page_test.rb create mode 100644 test/models/post_test.rb create mode 100644 test/models/profile_test.rb create mode 100644 test/models/sitemap_test.rb create mode 100644 test/models/update_test.rb create mode 100644 test/models/user_test.rb create mode 100644 test/system/.keep create mode 100644 test/test_helper.rb create mode 100644 test/test_helpers/session_test_helper.rb create mode 100644 tmp/.keep create mode 100644 tmp/pids/.keep create mode 100644 vendor/.keep create mode 100644 vendor/javascript/.keep diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..325bfc0 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,51 @@ +# 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. +/.env* + +# 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 Kamal files. +/config/deploy*.yml +/.kamal + +# Ignore development files +/.devcontainer + +# Ignore Docker-related files +/.dockerignore +/Dockerfile* diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..8dc4323 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,9 @@ +# 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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..83610cf --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 +updates: +- package-ecosystem: bundler + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + open-pull-requests-limit: 10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4adf8d4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,124 @@ +name: CI + +on: + pull_request: + push: + branches: [ main ] + +jobs: + scan_ruby: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Scan for common Rails security vulnerabilities using static analysis + run: bin/brakeman --no-pager + + - name: Scan for known security vulnerabilities in gems used + run: bin/bundler-audit + + scan_js: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Scan for security vulnerabilities in JavaScript dependencies + run: bin/importmap audit + + lint: + runs-on: ubuntu-latest + env: + RUBOCOP_CACHE_ROOT: tmp/rubocop + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Prepare RuboCop cache + uses: actions/cache@v4 + env: + DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }} + with: + path: ${{ env.RUBOCOP_CACHE_ROOT }} + key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }} + restore-keys: | + rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}- + + - name: Lint code for consistent style + run: bin/rubocop -f github + + test: + runs-on: ubuntu-latest + + # services: + # redis: + # image: valkey/valkey:8 + # ports: + # - 6379:6379 + # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Run tests + env: + RAILS_ENV: test + # RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + # REDIS_URL: redis://localhost:6379/0 + run: bin/rails db:test:prepare test + + system-test: + runs-on: ubuntu-latest + + # services: + # redis: + # image: valkey/valkey:8 + # ports: + # - 6379:6379 + # options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 + steps: + - name: Checkout code + uses: actions/checkout@v5 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true + + - name: Run System Tests + env: + RAILS_ENV: test + # RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY }} + # REDIS_URL: redis://localhost:6379/0 + run: bin/rails db:test:prepare 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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c73cc8b --- /dev/null +++ b/.gitignore @@ -0,0 +1,39 @@ +# 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. +/.env* + +# 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 +/app/views/passwords +/app/views/active_storage +/public/assets + + +# Ignore key files for decrypting credentials and more. +/config/*.key +/public/assets +db/ +storage/ diff --git a/.kamal/hooks/docker-setup.sample b/.kamal/hooks/docker-setup.sample new file mode 100755 index 0000000..2fb07d7 --- /dev/null +++ b/.kamal/hooks/docker-setup.sample @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Docker set up on $KAMAL_HOSTS..." diff --git a/.kamal/hooks/post-app-boot.sample b/.kamal/hooks/post-app-boot.sample new file mode 100755 index 0000000..70f9c4b --- /dev/null +++ b/.kamal/hooks/post-app-boot.sample @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Booted app version $KAMAL_VERSION on $KAMAL_HOSTS..." diff --git a/.kamal/hooks/post-deploy.sample b/.kamal/hooks/post-deploy.sample new file mode 100755 index 0000000..fd364c2 --- /dev/null +++ b/.kamal/hooks/post-deploy.sample @@ -0,0 +1,14 @@ +#!/bin/sh + +# A sample post-deploy hook +# +# These environment variables are available: +# KAMAL_RECORDED_AT +# KAMAL_PERFORMER +# KAMAL_VERSION +# KAMAL_HOSTS +# KAMAL_ROLES (if set) +# KAMAL_DESTINATION (if set) +# KAMAL_RUNTIME + +echo "$KAMAL_PERFORMER deployed $KAMAL_VERSION to $KAMAL_DESTINATION in $KAMAL_RUNTIME seconds" diff --git a/.kamal/hooks/post-proxy-reboot.sample b/.kamal/hooks/post-proxy-reboot.sample new file mode 100755 index 0000000..1435a67 --- /dev/null +++ b/.kamal/hooks/post-proxy-reboot.sample @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Rebooted kamal-proxy on $KAMAL_HOSTS" diff --git a/.kamal/hooks/pre-app-boot.sample b/.kamal/hooks/pre-app-boot.sample new file mode 100755 index 0000000..45f7355 --- /dev/null +++ b/.kamal/hooks/pre-app-boot.sample @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Booting app version $KAMAL_VERSION on $KAMAL_HOSTS..." diff --git a/.kamal/hooks/pre-build.sample b/.kamal/hooks/pre-build.sample new file mode 100755 index 0000000..c5a5567 --- /dev/null +++ b/.kamal/hooks/pre-build.sample @@ -0,0 +1,51 @@ +#!/bin/sh + +# A sample pre-build hook +# +# Checks: +# 1. We have a clean checkout +# 2. A remote is configured +# 3. The branch has been pushed to the remote +# 4. The version we are deploying matches the remote +# +# These environment variables are available: +# KAMAL_RECORDED_AT +# KAMAL_PERFORMER +# KAMAL_VERSION +# KAMAL_HOSTS +# KAMAL_ROLES (if set) +# KAMAL_DESTINATION (if set) + +if [ -n "$(git status --porcelain)" ]; then + echo "Git checkout is not clean, aborting..." >&2 + git status --porcelain >&2 + exit 1 +fi + +first_remote=$(git remote) + +if [ -z "$first_remote" ]; then + echo "No git remote set, aborting..." >&2 + exit 1 +fi + +current_branch=$(git branch --show-current) + +if [ -z "$current_branch" ]; then + echo "Not on a git branch, aborting..." >&2 + exit 1 +fi + +remote_head=$(git ls-remote $first_remote --tags $current_branch | cut -f1) + +if [ -z "$remote_head" ]; then + echo "Branch not pushed to remote, aborting..." >&2 + exit 1 +fi + +if [ "$KAMAL_VERSION" != "$remote_head" ]; then + echo "Version ($KAMAL_VERSION) does not match remote HEAD ($remote_head), aborting..." >&2 + exit 1 +fi + +exit 0 diff --git a/.kamal/hooks/pre-connect.sample b/.kamal/hooks/pre-connect.sample new file mode 100755 index 0000000..77744bd --- /dev/null +++ b/.kamal/hooks/pre-connect.sample @@ -0,0 +1,47 @@ +#!/usr/bin/env ruby + +# A sample pre-connect check +# +# Warms DNS before connecting to hosts in parallel +# +# These environment variables are available: +# KAMAL_RECORDED_AT +# KAMAL_PERFORMER +# KAMAL_VERSION +# KAMAL_HOSTS +# KAMAL_ROLES (if set) +# KAMAL_DESTINATION (if set) +# KAMAL_RUNTIME + +hosts = ENV["KAMAL_HOSTS"].split(",") +results = nil +max = 3 + +elapsed = Benchmark.realtime do + results = hosts.map do |host| + Thread.new do + tries = 1 + + begin + Socket.getaddrinfo(host, 0, Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) + rescue SocketError + if tries < max + puts "Retrying DNS warmup: #{host}" + tries += 1 + sleep rand + retry + else + puts "DNS warmup failed: #{host}" + host + end + end + + tries + end + end.map(&:value) +end + +retries = results.sum - hosts.size +nopes = results.count { |r| r == max } + +puts "Prewarmed %d DNS lookups in %.2f sec: %d retries, %d failures" % [ hosts.size, elapsed, retries, nopes ] diff --git a/.kamal/hooks/pre-deploy.sample b/.kamal/hooks/pre-deploy.sample new file mode 100755 index 0000000..05b3055 --- /dev/null +++ b/.kamal/hooks/pre-deploy.sample @@ -0,0 +1,122 @@ +#!/usr/bin/env ruby + +# A sample pre-deploy hook +# +# Checks the Github status of the build, waiting for a pending build to complete for up to 720 seconds. +# +# Fails unless the combined status is "success" +# +# These environment variables are available: +# KAMAL_RECORDED_AT +# KAMAL_PERFORMER +# KAMAL_VERSION +# KAMAL_HOSTS +# KAMAL_COMMAND +# KAMAL_SUBCOMMAND +# KAMAL_ROLES (if set) +# KAMAL_DESTINATION (if set) + +# Only check the build status for production deployments +if ENV["KAMAL_COMMAND"] == "rollback" || ENV["KAMAL_DESTINATION"] != "production" + exit 0 +end + +require "bundler/inline" + +# true = install gems so this is fast on repeat invocations +gemfile(true, quiet: true) do + source "https://rubygems.org" + + gem "octokit" + gem "faraday-retry" +end + +MAX_ATTEMPTS = 72 +ATTEMPTS_GAP = 10 + +def exit_with_error(message) + $stderr.puts message + exit 1 +end + +class GithubStatusChecks + attr_reader :remote_url, :git_sha, :github_client, :combined_status + + def initialize + @remote_url = github_repo_from_remote_url + @git_sha = `git rev-parse HEAD`.strip + @github_client = Octokit::Client.new(access_token: ENV["GITHUB_TOKEN"]) + refresh! + end + + def refresh! + @combined_status = github_client.combined_status(remote_url, git_sha) + end + + def state + combined_status[:state] + end + + def first_status_url + first_status = combined_status[:statuses].find { |status| status[:state] == state } + first_status && first_status[:target_url] + end + + def complete_count + combined_status[:statuses].count { |status| status[:state] != "pending"} + end + + def total_count + combined_status[:statuses].count + end + + def current_status + if total_count > 0 + "Completed #{complete_count}/#{total_count} checks, see #{first_status_url} ..." + else + "Build not started..." + end + end + + private + def github_repo_from_remote_url + url = `git config --get remote.origin.url`.strip.delete_suffix(".git") + if url.start_with?("https://github.com/") + url.delete_prefix("https://github.com/") + elsif url.start_with?("git@github.com:") + url.delete_prefix("git@github.com:") + else + url + end + end +end + + +$stdout.sync = true + +begin + puts "Checking build status..." + + attempts = 0 + checks = GithubStatusChecks.new + + loop do + case checks.state + when "success" + puts "Checks passed, see #{checks.first_status_url}" + exit 0 + when "failure" + exit_with_error "Checks failed, see #{checks.first_status_url}" + when "pending" + attempts += 1 + end + + exit_with_error "Checks are still pending, gave up after #{MAX_ATTEMPTS * ATTEMPTS_GAP} seconds" if attempts == MAX_ATTEMPTS + + puts checks.current_status + sleep(ATTEMPTS_GAP) + checks.refresh! + end +rescue Octokit::NotFound + exit_with_error "Build status could not be found" +end diff --git a/.kamal/hooks/pre-proxy-reboot.sample b/.kamal/hooks/pre-proxy-reboot.sample new file mode 100755 index 0000000..061f805 --- /dev/null +++ b/.kamal/hooks/pre-proxy-reboot.sample @@ -0,0 +1,3 @@ +#!/bin/sh + +echo "Rebooting kamal-proxy on $KAMAL_HOSTS..." diff --git a/.kamal/secrets b/.kamal/secrets new file mode 100644 index 0000000..3c8de04 --- /dev/null +++ b/.kamal/secrets @@ -0,0 +1,19 @@ +# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets, +# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either +# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git. + +# Example of extracting secrets from 1password (or another compatible pw manager) +# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY) +# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS}) +# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS}) + +# Example of extracting secrets from Rails credentials +# KAMAL_REGISTRY_PASSWORD=$(rails credentials:fetch kamal.registry_password) + +# Use a GITHUB_TOKEN if private repositories are needed for the image +# GITHUB_TOKEN=$(gh config get -h github.com oauth_token) + +# Grab the registry password from ENV +KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD +# Improve security by using a password manager. Never check config/master.key into git! +RAILS_MASTER_KEY=$(cat config/master.key) diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..f9d86d4 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,8 @@ +# 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 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..fdeaef8 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-3.4.7 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8149c5d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,76 @@ +# syntax=docker/dockerfile:1 +# check=error=true + +# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand: +# docker build -t galaxy . +# docker run -d -p 80:80 -e RAILS_MASTER_KEY= --name galaxy galaxy + +# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html + +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version +ARG RUBY_VERSION=3.4.7 +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 libjemalloc2 libvips sqlite3 && \ + ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# Set production environment variables and enable jemalloc for reduced memory usage and latency. +ENV RAILS_ENV="production" \ + BUNDLE_DEPLOYMENT="1" \ + BUNDLE_PATH="/usr/local/bundle" \ + BUNDLE_WITHOUT="development" \ + LD_PRELOAD="/usr/local/lib/libjemalloc.so" + +# 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 git libyaml-dev pkg-config && \ + rm -rf /var/lib/apt/lists /var/cache/apt/archives + +# Install application gems +COPY Gemfile Gemfile.lock vendor ./ + +RUN bundle install && \ + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \ + # -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495 + bundle exec bootsnap precompile -j 1 --gemfile + +# Copy application code +COPY . . + +# Precompile bootsnap code for faster boot times. +# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495 +RUN bundle exec bootsnap precompile -j 1 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 + +# 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 +USER 1000:1000 + +# Copy built artifacts: gems, application +COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}" +COPY --chown=rails:rails --from=build /rails /rails + +# Entrypoint prepares the database. +ENTRYPOINT ["/rails/bin/docker-entrypoint"] + +# Start server via Thruster by default, this can be overwritten at runtime +EXPOSE 3000 +CMD ["./bin/thrust", "./bin/rails", "server"] diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..a012ce7 --- /dev/null +++ b/Gemfile @@ -0,0 +1,68 @@ +source "https://rubygems.org" + +# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main" +gem "rails", "~> 8.1.1" +# The modern asset pipeline for Rails [https://github.com/rails/propshaft] +gem "propshaft" +# Use sqlite3 as the database for Active Record +gem "sqlite3", ">= 2.1" +# Use the Puma web server [https://github.com/puma/puma] +gem "puma", ">= 5.0" +# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails] +gem "importmap-rails" +# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev] +gem "turbo-rails" +# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev] +gem "stimulus-rails" +# Build JSON APIs with ease [https://github.com/rails/jbuilder] +gem "jbuilder" + +# 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 ] + +# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable +gem "solid_cache" +gem "solid_queue" +gem "solid_cable" + +gem "rss" + +# Reduces boot times through caching; required in config/boot.rb +gem "bootsnap", require: false + +# Deploy this application anywhere as a Docker container [https://kamal-deploy.org] +gem "kamal", require: false + +# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/] +gem "thruster", 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" + + # Audits gems for known security defects (use config/bundler-audit.yml to ignore issues) + gem "bundler-audit", require: false + + # 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 diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..1d104ea --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,414 @@ +GEM + remote: https://rubygems.org/ + specs: + action_text-trix (2.1.15) + railties + actioncable (8.1.1) + actionpack (= 8.1.1) + activesupport (= 8.1.1) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + zeitwerk (~> 2.6) + actionmailbox (8.1.1) + actionpack (= 8.1.1) + activejob (= 8.1.1) + activerecord (= 8.1.1) + activestorage (= 8.1.1) + activesupport (= 8.1.1) + mail (>= 2.8.0) + actionmailer (8.1.1) + actionpack (= 8.1.1) + actionview (= 8.1.1) + activejob (= 8.1.1) + activesupport (= 8.1.1) + mail (>= 2.8.0) + rails-dom-testing (~> 2.2) + actionpack (8.1.1) + actionview (= 8.1.1) + activesupport (= 8.1.1) + nokogiri (>= 1.8.5) + rack (>= 2.2.4) + rack-session (>= 1.0.1) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + useragent (~> 0.16) + actiontext (8.1.1) + action_text-trix (~> 2.1.15) + actionpack (= 8.1.1) + activerecord (= 8.1.1) + activestorage (= 8.1.1) + activesupport (= 8.1.1) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (8.1.1) + activesupport (= 8.1.1) + builder (~> 3.1) + erubi (~> 1.11) + rails-dom-testing (~> 2.2) + rails-html-sanitizer (~> 1.6) + activejob (8.1.1) + activesupport (= 8.1.1) + globalid (>= 0.3.6) + activemodel (8.1.1) + activesupport (= 8.1.1) + activerecord (8.1.1) + activemodel (= 8.1.1) + activesupport (= 8.1.1) + timeout (>= 0.4.0) + activestorage (8.1.1) + actionpack (= 8.1.1) + activejob (= 8.1.1) + activerecord (= 8.1.1) + activesupport (= 8.1.1) + marcel (~> 1.0) + activesupport (8.1.1) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.3.1) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + json + logger (>= 1.4.2) + minitest (>= 5.1) + securerandom (>= 0.3) + tzinfo (~> 2.0, >= 2.0.5) + uri (>= 0.13.1) + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + ast (2.4.3) + base64 (0.3.0) + bcrypt (3.1.20) + bcrypt_pbkdf (1.1.1) + bigdecimal (3.3.1) + bindex (0.8.1) + bootsnap (1.18.6) + msgpack (~> 1.2) + brakeman (7.1.1) + racc + builder (3.3.0) + bundler-audit (0.9.2) + bundler (>= 1.2.0, < 3) + thor (~> 1.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.5) + connection_pool (2.5.4) + crass (1.0.6) + date (3.5.0) + debug (1.11.0) + irb (~> 1.10) + reline (>= 0.3.8) + dotenv (3.1.8) + drb (2.2.3) + ed25519 (1.4.0) + erb (5.1.3) + erubi (1.13.1) + et-orbi (1.4.0) + tzinfo + ffi (1.17.2-aarch64-linux-gnu) + ffi (1.17.2-aarch64-linux-musl) + ffi (1.17.2-arm-linux-gnu) + ffi (1.17.2-arm-linux-musl) + ffi (1.17.2-x86_64-linux-gnu) + ffi (1.17.2-x86_64-linux-musl) + fugit (1.12.1) + et-orbi (~> 1.4) + raabro (~> 1.4) + globalid (1.3.0) + activesupport (>= 6.1) + i18n (1.14.7) + concurrent-ruby (~> 1.0) + image_processing (1.14.0) + mini_magick (>= 4.9.5, < 6) + ruby-vips (>= 2.0.17, < 3) + importmap-rails (2.2.2) + actionpack (>= 6.0.0) + activesupport (>= 6.0.0) + railties (>= 6.0.0) + io-console (0.8.1) + irb (1.15.3) + pp (>= 0.6.0) + rdoc (>= 4.0.0) + reline (>= 0.4.2) + jbuilder (2.14.1) + actionview (>= 7.0.0) + activesupport (>= 7.0.0) + json (2.16.0) + kamal (2.8.2) + activesupport (>= 7.0) + base64 (~> 0.2) + bcrypt_pbkdf (~> 1.0) + concurrent-ruby (~> 1.2) + dotenv (~> 3.1) + ed25519 (~> 1.4) + net-ssh (~> 7.3) + sshkit (>= 1.23.0, < 2.0) + thor (~> 1.3) + zeitwerk (>= 2.6.18, < 3.0) + language_server-protocol (3.17.0.5) + lint_roller (1.1.0) + logger (1.7.0) + loofah (2.24.1) + crass (~> 1.0.2) + nokogiri (>= 1.12.0) + mail (2.9.0) + logger + mini_mime (>= 0.1.1) + net-imap + net-pop + net-smtp + marcel (1.1.0) + matrix (0.4.3) + mini_magick (5.3.1) + logger + mini_mime (1.1.5) + minitest (5.26.0) + msgpack (1.8.0) + net-imap (0.5.12) + date + net-protocol + net-pop (0.1.2) + net-protocol + net-protocol (0.2.2) + timeout + net-scp (4.1.0) + net-ssh (>= 2.6.5, < 8.0.0) + net-sftp (4.0.0) + net-ssh (>= 5.0.0, < 8.0.0) + net-smtp (0.5.1) + net-protocol + net-ssh (7.3.0) + nio4r (2.7.5) + nokogiri (1.18.10-aarch64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.10-aarch64-linux-musl) + racc (~> 1.4) + nokogiri (1.18.10-arm-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.10-arm-linux-musl) + racc (~> 1.4) + nokogiri (1.18.10-x86_64-linux-gnu) + racc (~> 1.4) + nokogiri (1.18.10-x86_64-linux-musl) + racc (~> 1.4) + ostruct (0.6.3) + parallel (1.27.0) + parser (3.3.10.0) + ast (~> 2.4.1) + racc + pp (0.6.3) + prettyprint + prettyprint (0.2.0) + prism (1.6.0) + propshaft (1.3.1) + actionpack (>= 7.0.0) + activesupport (>= 7.0.0) + rack + psych (5.2.6) + date + stringio + public_suffix (6.0.2) + puma (7.1.0) + nio4r (~> 2.0) + raabro (1.4.0) + racc (1.8.1) + rack (3.2.4) + rack-session (2.1.1) + base64 (>= 0.1.0) + rack (>= 3.0.0) + rack-test (2.2.0) + rack (>= 1.3) + rackup (2.2.1) + rack (>= 3) + rails (8.1.1) + actioncable (= 8.1.1) + actionmailbox (= 8.1.1) + actionmailer (= 8.1.1) + actionpack (= 8.1.1) + actiontext (= 8.1.1) + actionview (= 8.1.1) + activejob (= 8.1.1) + activemodel (= 8.1.1) + activerecord (= 8.1.1) + activestorage (= 8.1.1) + activesupport (= 8.1.1) + bundler (>= 1.15.0) + railties (= 8.1.1) + rails-dom-testing (2.3.0) + activesupport (>= 5.0.0) + minitest + nokogiri (>= 1.6) + rails-html-sanitizer (1.6.2) + loofah (~> 2.21) + nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) + railties (8.1.1) + actionpack (= 8.1.1) + activesupport (= 8.1.1) + irb (~> 1.13) + rackup (>= 1.0.0) + rake (>= 12.2) + thor (~> 1.0, >= 1.2.2) + tsort (>= 0.2) + zeitwerk (~> 2.6) + rainbow (3.1.1) + rake (13.3.1) + rdoc (6.15.1) + erb + psych (>= 4.0.0) + tsort + regexp_parser (2.11.3) + reline (0.6.2) + io-console (~> 0.5) + rexml (3.4.4) + rss (0.3.1) + rexml + rubocop (1.81.7) + json (~> 2.3) + language_server-protocol (~> 3.17.0.2) + lint_roller (~> 1.1.0) + parallel (~> 1.10) + parser (>= 3.3.0.2) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 2.9.3, < 3.0) + rubocop-ast (>= 1.47.1, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 2.4.0, < 4.0) + rubocop-ast (1.47.1) + parser (>= 3.3.7.2) + prism (~> 1.4) + rubocop-performance (1.26.1) + lint_roller (~> 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.47.1, < 2.0) + rubocop-rails (2.33.4) + activesupport (>= 4.2.0) + lint_roller (~> 1.1) + rack (>= 1.1) + rubocop (>= 1.75.0, < 2.0) + rubocop-ast (>= 1.44.0, < 2.0) + rubocop-rails-omakase (1.1.0) + rubocop (>= 1.72) + rubocop-performance (>= 1.24) + rubocop-rails (>= 2.30) + ruby-progressbar (1.13.0) + ruby-vips (2.2.5) + ffi (~> 1.12) + logger + rubyzip (3.2.2) + securerandom (0.4.1) + selenium-webdriver (4.38.0) + base64 (~> 0.2) + logger (~> 1.4) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2, < 4.0) + websocket (~> 1.0) + solid_cable (3.0.12) + actioncable (>= 7.2) + activejob (>= 7.2) + activerecord (>= 7.2) + railties (>= 7.2) + solid_cache (1.0.9) + activejob (>= 7.2) + activerecord (>= 7.2) + railties (>= 7.2) + solid_queue (1.2.4) + activejob (>= 7.1) + activerecord (>= 7.1) + concurrent-ruby (>= 1.3.1) + fugit (~> 1.11) + railties (>= 7.1) + thor (>= 1.3.1) + sqlite3 (2.8.0-aarch64-linux-gnu) + sqlite3 (2.8.0-aarch64-linux-musl) + sqlite3 (2.8.0-arm-linux-gnu) + sqlite3 (2.8.0-arm-linux-musl) + sqlite3 (2.8.0-x86_64-linux-gnu) + sqlite3 (2.8.0-x86_64-linux-musl) + sshkit (1.24.0) + base64 + logger + net-scp (>= 1.1.2) + net-sftp (>= 2.1.2) + net-ssh (>= 2.8.0) + ostruct + stimulus-rails (1.3.4) + railties (>= 6.0.0) + stringio (3.1.7) + thor (1.4.0) + thruster (0.1.16) + thruster (0.1.16-aarch64-linux) + thruster (0.1.16-x86_64-linux) + timeout (0.4.4) + tsort (0.2.0) + turbo-rails (2.0.20) + actionpack (>= 7.1.0) + railties (>= 7.1.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unicode-display_width (3.2.0) + unicode-emoji (~> 4.1) + unicode-emoji (4.1.0) + uri (1.1.1) + useragent (0.16.11) + web-console (4.2.1) + actionview (>= 6.0.0) + activemodel (>= 6.0.0) + bindex (>= 0.4.0) + railties (>= 6.0.0) + websocket (1.2.11) + websocket-driver (0.8.0) + base64 + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.7.3) + +PLATFORMS + aarch64-linux + aarch64-linux-gnu + aarch64-linux-musl + arm-linux-gnu + arm-linux-musl + x86_64-linux + x86_64-linux-gnu + x86_64-linux-musl + +DEPENDENCIES + bcrypt (~> 3.1.7) + bootsnap + brakeman + bundler-audit + capybara + debug + image_processing (~> 1.2) + importmap-rails + jbuilder + kamal + propshaft + puma (>= 5.0) + rails (~> 8.1.1) + rss + rubocop-rails-omakase + selenium-webdriver + solid_cable + solid_cache + solid_queue + sqlite3 (>= 2.1) + stimulus-rails + thruster + turbo-rails + tzinfo-data + web-console + +BUNDLED WITH + 2.6.9 diff --git a/RAILS_ENV=production b/RAILS_ENV=production new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..09d5e66 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +hi this is basically my blog i made for me and my system. it's a mess of old code i wrote and then massively repurposed. you can use this if you want but sorry if it sucks. if it does end up being helpful to you hmu :)))) diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..9a5ea73 --- /dev/null +++ b/Rakefile @@ -0,0 +1,6 @@ +# 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 diff --git a/app/assets/images/.keep b/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/assets/stylesheets/actiontext.css b/app/assets/stylesheets/actiontext.css new file mode 100644 index 0000000..9b6bcb0 --- /dev/null +++ b/app/assets/stylesheets/actiontext.css @@ -0,0 +1,440 @@ +/* + * Default Trix editor styles. See Action Text overwrites below. +*/ + +trix-editor { + border: 1px solid #bbb; + border-radius: 3px; + margin: 0; + padding: 0.4em 0.6em; + min-height: 5em; + outline: none; } + +trix-toolbar * { + box-sizing: border-box; } + +trix-toolbar .trix-button-row { + display: flex; + flex-wrap: nowrap; + justify-content: space-between; + overflow-x: auto; } + +trix-toolbar .trix-button-group { + display: flex; + margin-bottom: 10px; + border: 1px solid #bbb; + border-top-color: #ccc; + border-bottom-color: #888; + border-radius: 3px; } + trix-toolbar .trix-button-group:not(:first-child) { + margin-left: 1.5vw; } + @media (max-width: 768px) { + trix-toolbar .trix-button-group:not(:first-child) { + margin-left: 0; } } + +trix-toolbar .trix-button-group-spacer { + flex-grow: 1; } + @media (max-width: 768px) { + trix-toolbar .trix-button-group-spacer { + display: none; } } + +trix-toolbar .trix-button { + position: relative; + float: left; + color: rgba(0, 0, 0, 0.6); + font-size: 0.75em; + font-weight: 600; + white-space: nowrap; + padding: 0 0.5em; + margin: 0; + outline: none; + border: none; + border-bottom: 1px solid #ddd; + border-radius: 0; + background: transparent; } + trix-toolbar .trix-button:not(:first-child) { + border-left: 1px solid #ccc; } + trix-toolbar .trix-button.trix-active { + background: #cbeefa; + color: black; } + trix-toolbar .trix-button:not(:disabled) { + cursor: pointer; } + trix-toolbar .trix-button:disabled { + color: rgba(0, 0, 0, 0.125); } + @media (max-width: 768px) { + trix-toolbar .trix-button { + letter-spacing: -0.01em; + padding: 0 0.3em; } } + +trix-toolbar .trix-button--icon { + font-size: inherit; + width: 2.6em; + height: 1.6em; + max-width: calc(0.8em + 4vw); + text-indent: -9999px; } + @media (max-width: 768px) { + trix-toolbar .trix-button--icon { + height: 2em; + max-width: calc(0.8em + 3.5vw); } } + trix-toolbar .trix-button--icon::before { + display: inline-block; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + opacity: 0.6; + content: ""; + background-position: center; + background-repeat: no-repeat; + background-size: contain; } + @media (max-width: 768px) { + trix-toolbar .trix-button--icon::before { + right: 6%; + left: 6%; } } + trix-toolbar .trix-button--icon.trix-active::before { + opacity: 1; } + trix-toolbar .trix-button--icon:disabled::before { + opacity: 0.125; } + +trix-toolbar .trix-button--icon-attach::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M10.5%2018V7.5c0-2.25%203-2.25%203%200V18c0%204.125-6%204.125-6%200V7.5c0-6.375%209-6.375%209%200V18%22%20stroke%3D%22%23000%22%20stroke-width%3D%222%22%20stroke-miterlimit%3D%2210%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E"); + top: 8%; + bottom: 4%; } + +trix-toolbar .trix-button--icon-bold::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6.522%2019.242a.5.5%200%200%201-.5-.5V5.35a.5.5%200%200%201%20.5-.5h5.783c1.347%200%202.46.345%203.24.982.783.64%201.216%201.562%201.216%202.683%200%201.13-.587%202.129-1.476%202.71a.35.35%200%200%200%20.049.613c1.259.56%202.101%201.742%202.101%203.22%200%201.282-.483%202.334-1.363%203.063-.876.726-2.132%201.12-3.66%201.12h-5.89ZM9.27%207.347v3.362h1.97c.766%200%201.347-.17%201.733-.464.38-.291.587-.716.587-1.27%200-.53-.183-.928-.513-1.198-.334-.273-.838-.43-1.505-.43H9.27Zm0%205.606v3.791h2.389c.832%200%201.448-.177%201.853-.497.399-.315.614-.786.614-1.423%200-.62-.22-1.077-.63-1.385-.418-.313-1.053-.486-1.905-.486H9.27Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-italic::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M9%205h6.5v2h-2.23l-2.31%2010H13v2H6v-2h2.461l2.306-10H9V5Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-link::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M18.948%205.258a4.337%204.337%200%200%200-6.108%200L11.217%206.87a.993.993%200%200%200%200%201.41c.392.39%201.027.39%201.418%200l1.623-1.613a2.323%202.323%200%200%201%203.271%200%202.29%202.29%200%200%201%200%203.251l-2.393%202.38a3.021%203.021%200%200%201-4.255%200l-.05-.049a1.007%201.007%200%200%200-1.418%200%20.993.993%200%200%200%200%201.41l.05.049a5.036%205.036%200%200%200%207.091%200l2.394-2.38a4.275%204.275%200%200%200%200-6.072Zm-13.683%2013.6a4.337%204.337%200%200%200%206.108%200l1.262-1.255a.993.993%200%200%200%200-1.41%201.007%201.007%200%200%200-1.418%200L9.954%2017.45a2.323%202.323%200%200%201-3.27%200%202.29%202.29%200%200%201%200-3.251l2.344-2.331a2.579%202.579%200%200%201%203.631%200c.392.39%201.027.39%201.419%200a.993.993%200%200%200%200-1.41%204.593%204.593%200%200%200-6.468%200l-2.345%202.33a4.275%204.275%200%200%200%200%206.072Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-strike::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M6%2014.986c.088%202.647%202.246%204.258%205.635%204.258%203.496%200%205.713-1.728%205.713-4.463%200-.275-.02-.536-.062-.781h-3.461c.398.293.573.654.573%201.123%200%201.035-1.074%201.787-2.646%201.787-1.563%200-2.773-.762-2.91-1.924H6ZM6.432%2010h3.763c-.632-.314-.914-.715-.914-1.273%200-1.045.977-1.739%202.432-1.739%201.475%200%202.52.723%202.617%201.914h2.764c-.05-2.548-2.11-4.238-5.39-4.238-3.145%200-5.392%201.719-5.392%204.316%200%20.363.04.703.12%201.02ZM4%2011a1%201%200%201%200%200%202h15a1%201%200%201%200%200-2H4Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-quote::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M4.581%208.471c.44-.5%201.056-.834%201.758-.995C8.074%207.17%209.201%207.822%2010%208.752c1.354%201.578%201.33%203.555.394%205.277-.941%201.731-2.788%203.163-4.988%203.56a.622.622%200%200%201-.653-.317c-.113-.205-.121-.49.16-.764.294-.286.567-.566.791-.835.222-.266.413-.54.524-.815.113-.28.156-.597.026-.908-.128-.303-.39-.524-.72-.69a3.02%203.02%200%200%201-1.674-2.7c0-.905.283-1.59.72-2.088Zm9.419%200c.44-.5%201.055-.834%201.758-.995%201.734-.306%202.862.346%203.66%201.276%201.355%201.578%201.33%203.555.395%205.277-.941%201.731-2.789%203.163-4.988%203.56a.622.622%200%200%201-.653-.317c-.113-.205-.122-.49.16-.764.294-.286.567-.566.791-.835.222-.266.412-.54.523-.815.114-.28.157-.597.026-.908-.127-.303-.39-.524-.72-.69a3.02%203.02%200%200%201-1.672-2.701c0-.905.283-1.59.72-2.088Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-heading-1::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M21.5%207.5v-3h-12v3H14v13h3v-13h4.5ZM9%2013.5h3.5v-3h-10v3H6v7h3v-7Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-code::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3.293%2011.293a1%201%200%200%200%200%201.414l4%204a1%201%200%201%200%201.414-1.414L5.414%2012l3.293-3.293a1%201%200%200%200-1.414-1.414l-4%204Zm13.414%205.414%204-4a1%201%200%200%200%200-1.414l-4-4a1%201%200%201%200-1.414%201.414L18.586%2012l-3.293%203.293a1%201%200%200%200%201.414%201.414Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-bullet-list::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M5%207.5a1.5%201.5%200%201%200%200-3%201.5%201.5%200%200%200%200%203ZM8%206a1%201%200%200%201%201-1h11a1%201%200%201%201%200%202H9a1%201%200%200%201-1-1Zm1%205a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm0%206a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm-2.5-5a1.5%201.5%200%201%201-3%200%201.5%201.5%200%200%201%203%200ZM5%2019.5a1.5%201.5%200%201%200%200-3%201.5%201.5%200%200%200%200%203Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-number-list::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3%204h2v4H4V5H3V4Zm5%202a1%201%200%200%201%201-1h11a1%201%200%201%201%200%202H9a1%201%200%200%201-1-1Zm1%205a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm0%206a1%201%200%201%200%200%202h11a1%201%200%201%200%200-2H9Zm-3.5-7H6v1l-1.5%202H6v1H3v-1l1.667-2H3v-1h2.5ZM3%2017v-1h3v4H3v-1h2v-.5H4v-1h1V17H3Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-undo::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M3%2014a1%201%200%200%200%201%201h6a1%201%200%201%200%200-2H6.257c2.247-2.764%205.151-3.668%207.579-3.264%202.589.432%204.739%202.356%205.174%205.405a1%201%200%200%200%201.98-.283c-.564-3.95-3.415-6.526-6.825-7.095C11.084%207.25%207.63%208.377%205%2011.39V8a1%201%200%200%200-2%200v6Zm2-1Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-redo::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M21%2014a1%201%200%200%201-1%201h-6a1%201%200%201%201%200-2h3.743c-2.247-2.764-5.151-3.668-7.579-3.264-2.589.432-4.739%202.356-5.174%205.405a1%201%200%200%201-1.98-.283c.564-3.95%203.415-6.526%206.826-7.095%203.08-.513%206.534.614%209.164%203.626V8a1%201%200%201%201%202%200v6Zm-2-1Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-decrease-nesting-level::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M5%206a1%201%200%200%201%201-1h12a1%201%200%201%201%200%202H6a1%201%200%200%201-1-1Zm4%205a1%201%200%201%200%200%202h9a1%201%200%201%200%200-2H9Zm-3%206a1%201%200%201%200%200%202h12a1%201%200%201%200%200-2H6Zm-3.707-5.707a1%201%200%200%200%200%201.414l2%202a1%201%200%201%200%201.414-1.414L4.414%2012l1.293-1.293a1%201%200%200%200-1.414-1.414l-2%202Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-button--icon-increase-nesting-level::before { + background-image: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M5%206a1%201%200%200%201%201-1h12a1%201%200%201%201%200%202H6a1%201%200%200%201-1-1Zm4%205a1%201%200%201%200%200%202h9a1%201%200%201%200%200-2H9Zm-3%206a1%201%200%201%200%200%202h12a1%201%200%201%200%200-2H6Zm-2.293-2.293%202-2a1%201%200%200%200%200-1.414l-2-2a1%201%200%201%200-1.414%201.414L3.586%2012l-1.293%201.293a1%201%200%201%200%201.414%201.414Z%22%20fill%3D%22%23000%22%2F%3E%3C%2Fsvg%3E"); } + +trix-toolbar .trix-dialogs { + position: relative; } + +trix-toolbar .trix-dialog { + position: absolute; + top: 0; + left: 0; + right: 0; + font-size: 0.75em; + padding: 15px 10px; + background: #fff; + box-shadow: 0 0.3em 1em #ccc; + border-top: 2px solid #888; + border-radius: 5px; + z-index: 5; } + +trix-toolbar .trix-input--dialog { + font-size: inherit; + font-weight: normal; + padding: 0.5em 0.8em; + margin: 0 10px 0 0; + border-radius: 3px; + border: 1px solid #bbb; + background-color: #fff; + box-shadow: none; + outline: none; + -webkit-appearance: none; + -moz-appearance: none; } + trix-toolbar .trix-input--dialog.validate:invalid { + box-shadow: #F00 0px 0px 1.5px 1px; } + +trix-toolbar .trix-button--dialog { + font-size: inherit; + padding: 0.5em; + border-bottom: none; } + +trix-toolbar .trix-dialog--link { + max-width: 600px; } + +trix-toolbar .trix-dialog__link-fields { + display: flex; + align-items: baseline; } + trix-toolbar .trix-dialog__link-fields .trix-input { + flex: 1; } + trix-toolbar .trix-dialog__link-fields .trix-button-group { + flex: 0 0 content; + margin: 0; } + +trix-editor [data-trix-mutable]:not(.attachment__caption-editor) { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } + +trix-editor [data-trix-mutable]::-moz-selection, +trix-editor [data-trix-cursor-target]::-moz-selection, trix-editor [data-trix-mutable] ::-moz-selection { + background: none; } + +trix-editor [data-trix-mutable]::selection, +trix-editor [data-trix-cursor-target]::selection, trix-editor [data-trix-mutable] ::selection { + background: none; } + +trix-editor .attachment__caption-editor:focus[data-trix-mutable]::-moz-selection { + background: highlight; } + +trix-editor .attachment__caption-editor:focus[data-trix-mutable]::selection { + background: highlight; } + +trix-editor [data-trix-mutable].attachment.attachment--file { + box-shadow: 0 0 0 2px highlight; + border-color: transparent; } + +trix-editor [data-trix-mutable].attachment img { + box-shadow: 0 0 0 2px highlight; } + +trix-editor .attachment { + position: relative; } + trix-editor .attachment:hover { + cursor: default; } + +trix-editor .attachment--preview .attachment__caption:hover { + cursor: text; } + +trix-editor .attachment__progress { + position: absolute; + z-index: 1; + height: 20px; + top: calc(50% - 10px); + left: 5%; + width: 90%; + opacity: 0.9; + transition: opacity 200ms ease-in; } + trix-editor .attachment__progress[value="100"] { + opacity: 0; } + +trix-editor .attachment__caption-editor { + display: inline-block; + width: 100%; + margin: 0; + padding: 0; + font-size: inherit; + font-family: inherit; + line-height: inherit; + color: inherit; + text-align: center; + vertical-align: top; + border: none; + outline: none; + -webkit-appearance: none; + -moz-appearance: none; } + +trix-editor .attachment__toolbar { + position: absolute; + z-index: 1; + top: -0.9em; + left: 0; + width: 100%; + text-align: center; } + +trix-editor .trix-button-group { + display: inline-flex; } + +trix-editor .trix-button { + position: relative; + float: left; + color: #666; + white-space: nowrap; + font-size: 80%; + padding: 0 0.8em; + margin: 0; + outline: none; + border: none; + border-radius: 0; + background: transparent; } + trix-editor .trix-button:not(:first-child) { + border-left: 1px solid #ccc; } + trix-editor .trix-button.trix-active { + background: #cbeefa; } + trix-editor .trix-button:not(:disabled) { + cursor: pointer; } + +trix-editor .trix-button--remove { + text-indent: -9999px; + display: inline-block; + padding: 0; + outline: none; + width: 1.8em; + height: 1.8em; + line-height: 1.8em; + border-radius: 50%; + background-color: #fff; + border: 2px solid highlight; + box-shadow: 1px 1px 6px rgba(0, 0, 0, 0.25); } + trix-editor .trix-button--remove::before { + display: inline-block; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + opacity: 0.7; + content: ""; + background-image: url("data:image/svg+xml,%3Csvg%20height%3D%2224%22%20width%3D%2224%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19%206.41%2017.59%205%2012%2010.59%206.41%205%205%206.41%2010.59%2012%205%2017.59%206.41%2019%2012%2013.41%2017.59%2019%2019%2017.59%2013.41%2012z%22%2F%3E%3Cpath%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22%2F%3E%3C%2Fsvg%3E"); + background-position: center; + background-repeat: no-repeat; + background-size: 90%; } + trix-editor .trix-button--remove:hover { + border-color: #333; } + trix-editor .trix-button--remove:hover::before { + opacity: 1; } + +trix-editor .attachment__metadata-container { + position: relative; } + +trix-editor .attachment__metadata { + position: absolute; + left: 50%; + top: 2em; + transform: translate(-50%, 0); + max-width: 90%; + padding: 0.1em 0.6em; + font-size: 0.8em; + color: #fff; + background-color: rgba(0, 0, 0, 0.7); + border-radius: 3px; } + trix-editor .attachment__metadata .attachment__name { + display: inline-block; + max-width: 100%; + vertical-align: bottom; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } + trix-editor .attachment__metadata .attachment__size { + margin-left: 0.2em; + white-space: nowrap; } + +.trix-content { + line-height: 1.5; + overflow-wrap: break-word; + word-break: break-word; } + .trix-content * { + box-sizing: border-box; + margin: 0; + padding: 0; } + .trix-content h1 { + font-size: 1.2em; + line-height: 1.2; } + .trix-content blockquote { + border: 0 solid #ccc; + border-left-width: 0.3em; + margin-left: 0.3em; + padding-left: 0.6em; } + .trix-content [dir=rtl] blockquote, + .trix-content blockquote[dir=rtl] { + border-width: 0; + border-right-width: 0.3em; + margin-right: 0.3em; + padding-right: 0.6em; } + .trix-content li { + margin-left: 1em; } + .trix-content [dir=rtl] li { + margin-right: 1em; } + .trix-content pre { + display: inline-block; + width: 100%; + vertical-align: top; + font-family: monospace; + font-size: 0.9em; + padding: 0.5em; + white-space: pre; + background-color: #eee; + overflow-x: auto; } + .trix-content img { + max-width: 100%; + height: auto; } + .trix-content .attachment { + display: inline-block; + position: relative; + max-width: 100%; } + .trix-content .attachment a { + color: inherit; + text-decoration: none; } + .trix-content .attachment a:hover, .trix-content .attachment a:visited:hover { + color: inherit; } + .trix-content .attachment__caption { + text-align: center; } + .trix-content .attachment__caption .attachment__name + .attachment__size::before { + content: ' \2022 '; } + .trix-content .attachment--preview { + width: 100%; + text-align: center; } + .trix-content .attachment--preview .attachment__caption { + color: #666; + font-size: 0.9em; + line-height: 1.2; } + .trix-content .attachment--file { + color: #333; + line-height: 1; + margin: 0 2px 2px 2px; + padding: 0.4em 1em; + border: 1px solid #bbb; + border-radius: 5px; } + .trix-content .attachment-gallery { + display: flex; + flex-wrap: wrap; + position: relative; } + .trix-content .attachment-gallery .attachment { + flex: 1 0 33%; + padding: 0 0.5em; + max-width: 33%; } + .trix-content .attachment-gallery.attachment-gallery--2 .attachment, .trix-content .attachment-gallery.attachment-gallery--4 .attachment { + flex-basis: 50%; + max-width: 50%; } + +/* + * We need to override trix.css’s image gallery styles to accommodate the + * element we wrap around attachments. Otherwise, + * images in galleries will be squished by the max-width: 33%; rule. +*/ +.trix-content .attachment-gallery > action-text-attachment, +.trix-content .attachment-gallery > .attachment { + flex: 1 0 33%; + padding: 0 0.5em; + max-width: 33%; +} + +.trix-content .attachment-gallery.attachment-gallery--2 > action-text-attachment, +.trix-content .attachment-gallery.attachment-gallery--2 > .attachment, .trix-content .attachment-gallery.attachment-gallery--4 > action-text-attachment, +.trix-content .attachment-gallery.attachment-gallery--4 > .attachment { + flex-basis: 50%; + max-width: 50%; +} + +.trix-content action-text-attachment .attachment { + padding: 0 !important; + max-width: 100% !important; +} diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css new file mode 100644 index 0000000..edee87e --- /dev/null +++ b/app/assets/stylesheets/application.css @@ -0,0 +1,292 @@ +/* + * This is a manifest file that'll be compiled into application.css. + * + * With Propshaft, assets are served efficiently without preprocessing steps. You can still include + * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard + * cascading order, meaning styles declared later in the document or manifest will override earlier ones, + * depending on specificity. + * + * Consider organizing styles into separate files for maintainability. + */ +// : Use a value from 300 to 900 +// : Use a unique and descriptive class name + +.winky-sans-all{ + font-family: "Winky Sans", sans-serif; + font-optical-sizing: auto; + font-weight: 600; + font-style: normal; +} +table.intereststable { + +padding: 4px; +} +section.bottomindex { +border: 1px solid black; +width: 990px; +height: 240px; +position: absolute; +overflow: scroll; +margin-top: 400px; +} +section.etc { +border: 1px solid black; +padding: 10px; +width:260px; +height: 350px; +overflow: scroll; +position: absolute; +margin-left: 730px; +} +section.blogdesc { +border: 1px solid black; +padding: 5px; +} +#minty { + padding: .5em; + background-color: #f0faf5; + border: 1px solid black; +} +#minty-username { + margin-bottom: .5em; +} +.marquee { +position: absolute; +width:100%; +margin-top: 25px; +} +#minty-content { + margin: 0 1em 0.5em 1em; +} +section.aboutus { +border: 1px solid black; +padding:10px; +width: 470px; +height: 350px; +text-align: center; +position: absolute; +margin-left:230px; +overflow: scroll; +margin-bottom: 15px; +} + +section.latestpost { +position: absolute; +width: 215px; +height: 350px; +overflow: scroll; +margin-left: -15px; +border: 1px solid black; +padding: 10px; +} +section.posts { +margin: 0 auto; +border: 1px solid black; +padding: 4px; +} +section.interests { +float: right; +width: 250px; +border: 1px solid black; +padding: 1px; +} +section.createmember { +float: right; +top: 0px; +} +section.membertable { +border: 1px solid black; +padding: 3%; +} +section.memberspecific { +border: 1px solid black; +} +table { +padding: 3%; +margin: 0 auto; +} +tr.member { +border: 1px solid black; +} +td.member { +padding: 25px; + +} +td.memberinterests { +border: 1px solid black; +padding: 5px; +} +section.memberlist { +width: 850px; +height: auto; +border: 1px solid black; +text-align: center; +margin: 0 auto; +padding: 9px; +} +section.avatarimg { +border: 3px double black; +width: 100px; +height: 100px; +margin: 0 auto; +} +section.memberinner { +border:1px solid black; +width: 250px; +height: auto; +float: left; +padding: 4px; +} + body { + color: #000; + font-family: 'Comic Sans MS'; + +background: #ff597d; +background: linear-gradient(90deg, rgba(255, 89, 125, 1) 0%, rgba(97, 255, 136, 1) 50%, rgba(237, 83, 129, 1) 100%); +font-size:17px; + } + section.inner { + text-align: left; + } + + section.about { + + text-align: center; + margin: 0 auto; + width: 450px; + overflow: scroll; + border:2px outset #000; + } + section.footer { +background: #ffe0e8; +background: radial-gradient(circle, rgba(255, 224, 232, 1) 0%, rgba(180, 250, 197, 1) 50%, rgba(255, 207, 219, 1) 100%); + width: 1000px; + color: #000; + height: 30px; + text-align: center; + padding-left: 2%; + padding-right: 2%; + padding-bottom: 1%; + margin: auto; + border:3px outset #000; + } + h1 { + font-family: "Comic Sans MS", cursive, sans-serif; + background-color: pink; + border: 5px outset #42f548; + color: #000; + text-align: center; + } + .profilenews { + background: #fff; + color: #000; + } + main { + width: 1000px; + overflow: scroll; + height: 1000px; + margin: 0 auto; +background: #ffe0e8; +background: radial-gradient(circle, rgba(255, 224, 232, 1) 0%, rgba(180, 250, 197, 1) 50%, rgba(255, 207, 219, 1) 100%); + border: 8px groove #ff5975; + box-shadow: 8px 2px 5px 2px #a3ffc3; +padding-left: 2%; +padding-right: 2%; + + } + .header { + text-align: center; +background: #ffe0e8; +background: radial-gradient(circle, rgba(255, 224, 232, 1) 0%, rgba(180, 250, 197, 1) 50%, rgba(255, 207, 219, 1) 100%); + } + .headerall { + color: #000; +background: #ffe0e8; +background: radial-gradient(circle, rgba(255, 224, 232, 1) 0%, rgba(180, 250, 197, 1) 50%, rgba(255, 207, 219, 1) 100%); + } + a { + color: #000; + } + + section.profileinner { + text-align: left; + padding: 15px; + } +section.article { +text-align: center; +background-color: #fff; +padding: 5px; +color: #000; +} +section.profile { +text-align: center; +background-color: #fff; +padding: 15px; +color: #000; +} +h1.h1bio { +width: 350px; +margin: auto; +} +section.homepage { + +} + a:visited { + color: #000; + } + a:hover { + color: #000; + } + section.auth { + float:right; + box-shadow: 3px 3px 3px gray; +background: #fff; + color: #000; + + } + section.newstuff { + width:200px; + border:5px outset #42f548; +background: pink; + color: #000; + text-align: center; + margin: auto; + padding: 3px; + + } + + section.articleshow { + align-content: center; + background: pink; + color: #000; + border:5px outset #42f548; + } + section.newstuff a, a:visited, a:hover { + color: #000; + } + table.articleshowing { +margin: auto; + } + +table.articleshowing a { + color: #000; + } + +table.articleshowing a:visited { + color: #000; + } + table.articleshowing a:hover { + color: #000; + } + + + section.profilelist { + margin: auto; + width: 300px; + align-content: center; + padding: 10px; + overflow: scroll; + background-color: pink; + color: #000; + border:5px outset #42f548; + } diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb new file mode 100644 index 0000000..4264c74 --- /dev/null +++ b/app/channels/application_cable/connection.rb @@ -0,0 +1,16 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + identified_by :current_user + + def connect + set_current_user || reject_unauthorized_connection + end + + private + def set_current_user + if session = Session.find_by(id: cookies.signed[:session_id]) + self.current_user = session.user + end + end + end +end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb new file mode 100644 index 0000000..0d6e4b2 --- /dev/null +++ b/app/controllers/application_controller.rb @@ -0,0 +1,22 @@ +class ApplicationController < ActionController::Base + include Authentication + # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. + allow_browser versions: :modern + + # Changes to the importmap will invalidate the etag for HTML responses + stale_when_importmap_changes + helper_method :current_user + + private + + def current_user + + @current_user ||= User.find_by(id: session[:user_id]) if session[:user_id] + end + + def authenticate_user! + unless current_user + redirect_to login_path, alert: "You must be logged in to access this page." + end + end +end diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb new file mode 100644 index 0000000..245b37d --- /dev/null +++ b/app/controllers/articles_controller.rb @@ -0,0 +1,74 @@ +class ArticlesController < ApplicationController + before_action :authenticate_user!, only: [:new, :edit, :update, :create] + allow_unauthenticated_access(only: %i[index show]) + + def feed + @articles = Article.order(created_at: :asc) + response.headers['Content-Type'] = 'application/rss+xml' + render 'feed', formats: :xml + end + + + def index + @articles = Article.order(created_at: :desc) + @members = Member.all + @blogs = Blog.all + + end + + + def show + @article = Article.find(params[:id]) + end + + + def new + @article = Article.new + end + + + def create + @article = Article.new(article_params) + if @article.save + redirect_to @article + else + render 'new' + end + end + + + def edit + @article = Article.find(params[:id]) + end + + + def update + @article = Article.find(params[:id]) + if @article.update(article_params) + redirect_to @article + else + render :edit + end + end + + + def destroy + @article = Article.find(params[:id]) + @article.destroy + redirect_to articles_path + end + + private + + + def article_params + params.require(:article).permit(:title, :text, :mood, :music, :icon_image) + end +end + + + + + + + diff --git a/app/controllers/blogmap_controller.rb b/app/controllers/blogmap_controller.rb new file mode 100644 index 0000000..43ec79e --- /dev/null +++ b/app/controllers/blogmap_controller.rb @@ -0,0 +1,20 @@ +class BlogmapController < ApplicationController + allow_unauthenticated_access(only: %i[index show]) + before_action :authenticate_user!, only: [:new, :edit, :update, :create] + +def index + @blogs = Blog.all + end +def new +end +def update +end +def edit +end +def create +end +def destroy +end +def show +end +end diff --git a/app/controllers/blogs_controller.rb b/app/controllers/blogs_controller.rb new file mode 100644 index 0000000..bccbf46 --- /dev/null +++ b/app/controllers/blogs_controller.rb @@ -0,0 +1,67 @@ +class BlogsController < ApplicationController + before_action :authenticate_user!, only: [:destroy, :new, :create, :edit, :update] + allow_unauthenticated_access(only: %i[index show]) + before_action :set_member + before_action :set_blog, only: [:show, :edit, :update, :destroy] +def index + @posts = Post.order(created_at: :asc) +end + +def edit + @blog = Blog.find(params[:id]) +end +def new +@blog = @member.blogs.new +@blog = @member.blogs.build +end + + +def create + @blog = @member.blogs.new(blog_params) + + if @blog.save + + redirect_to root_path, notice: 'Blog was successfully created.' + else + + render :new, notice: 'Could not save blog.' +end +end +def destroy + @member = Member.find(params[:member_id]) + @blog = @member.blogs.find(params[:id]) + @blog.destroy + redirect_to member_path(@member), notice: "Blog deleted." +end +def show + @member = Member.find(params[:member_id]) + @blog = @member.blogs.find(params[:id]) + @posts = @blog.posts.order(created_at: :desc) + +end + +def update + @blog = Blog.find(params[:id]) + + if @blog.update(blog_params) + redirect_to member_blog_path(@member) + else + render :edit + end + end + end +private + +def blog_params + params.require(:blog).permit(:title, :links, :description) + +end + + + def set_member + @member = Member.find(params[:member_id]) + end + def set_blog + @blog = @member.blogs.find(params[:id]) + end + diff --git a/app/controllers/comments_controller.rb b/app/controllers/comments_controller.rb new file mode 100644 index 0000000..547feb1 --- /dev/null +++ b/app/controllers/comments_controller.rb @@ -0,0 +1,42 @@ +class CommentsController < ApplicationController + allow_unauthenticated_access + before_action :set_member + before_action :set_blog + before_action :set_post + + def create + @comment = @post.comments.build(comment_params) + if @comment.save + redirect_to member_blog_post_path(@member, @blog, @post), notice: "Comment added!" + else + redirect_to member_blog_post_path(@member, @blog, @post), alert: "Could not save comment." + end + end + + def destroy + @comment = @post.comments.find(params[:id]) + @comment.destroy + + redirect_to member_blog_post_path(@member, @blog, @post), + notice: "Comment deleted." + end + + private + + def set_member + @member = Member.find(params[:member_id]) + end + + def set_blog + @blog = @member.blogs.find(params[:blog_id]) + end + + def set_post + @post = @blog.posts.find(params[:post_id]) + end + + def comment_params + params.require(:comment).permit(:commenter, :website, :body) + end +end + diff --git a/app/controllers/concerns/.keep b/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/controllers/concerns/authentication.rb b/app/controllers/concerns/authentication.rb new file mode 100644 index 0000000..9a3aec5 --- /dev/null +++ b/app/controllers/concerns/authentication.rb @@ -0,0 +1,54 @@ +module Authentication + extend ActiveSupport::Concern + + included do + before_action :require_authentication, except: [:new, :create, :destroy] + helper_method :authenticated? + end + + class_methods do + def allow_unauthenticated_access(**options) + skip_before_action :require_authentication, **options + end + end + + private + + def authenticated? + resume_session + end + + def require_authentication + resume_session || request_authentication + end + + def resume_session + Current.session ||= find_session_by_cookie + end + + def find_session_by_cookie + Session.find_by(id: cookies.signed[:session_id]) if cookies.signed[:session_id] + end + + def request_authentication + session[:return_to_after_authenticating] = request.url + redirect_to new_session_path + end + + def after_authentication_url + session.delete(:return_to_after_authenticating) || root_url + end + + def start_new_session_for(user) + user.sessions.create!(user_agent: request.user_agent, ip_address: request.remote_ip).tap do |session| + Current.session = session + cookies.signed.permanent[:session_id] = { value: session.id, httponly: true, same_site: :lax } + end + end + + def terminate_session + Current.session.destroy + cookies.delete(:session_id) + end +end + diff --git a/app/controllers/lists_controller.rb b/app/controllers/lists_controller.rb new file mode 100644 index 0000000..9d5a2b4 --- /dev/null +++ b/app/controllers/lists_controller.rb @@ -0,0 +1,2 @@ +class ListsController < ApplicationController +end diff --git a/app/controllers/members_controller.rb b/app/controllers/members_controller.rb new file mode 100644 index 0000000..c7fe9dc --- /dev/null +++ b/app/controllers/members_controller.rb @@ -0,0 +1,57 @@ +class MembersController < ApplicationController + before_action :authenticate_user!, only: [:new, :edit, :update, :create, :destroy] + allow_unauthenticated_access(only: %i[index show]) +def index + @members = Member.all +end + +def blogs +@blog = Blog.all +end +def edit + @member = Member.find(params[:id]) +end +def new +@member = current_user.members.new +end +def update + @member = Member.find(params[:id]) + if @member.update(member_params) + redirect_to @member + else + render :edit + end + end + +def create + @member = current_user.members.new(member_params) + + if @member.save + redirect_to @member + else + redirect_to root_path + end + end + +def destroy + @member = Member.find(params[:id]) + @member.destroy + redirect_to member_path(@member), notice: "Member deleted." + +end + +def show + @member = Member.find_by(id: params[:id]) + if @member.nil? + flash[:alert] = "Member not found" + redirect_to root_path + return + end +end +end +private + + def member_params + params.require(:member).permit(:name, :avatar_image, :bio, :links, :birthday, :pronouns, :system_role, :age, :tv_interests, :music_interests, :other_interests) + end + diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb new file mode 100644 index 0000000..ce3bf58 --- /dev/null +++ b/app/controllers/pages_controller.rb @@ -0,0 +1,2 @@ +class PagesController < ApplicationController +end diff --git a/app/controllers/passwords_controller.rb b/app/controllers/passwords_controller.rb new file mode 100644 index 0000000..f95ec78 --- /dev/null +++ b/app/controllers/passwords_controller.rb @@ -0,0 +1,35 @@ +class PasswordsController < ApplicationController + allow_unauthenticated_access + before_action :set_user_by_token, only: %i[ edit update ] + rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_password_path, alert: "Try again later." } + + def new + end + + def create + if user = User.find_by(email_address: params[:email_address]) + PasswordsMailer.reset(user).deliver_later + end + + redirect_to new_session_path, notice: "Password reset instructions sent (if user with that email address exists)." + end + + def edit + end + + def update + if @user.update(params.permit(:password, :password_confirmation)) + @user.sessions.destroy_all + redirect_to new_session_path, notice: "Password has been reset." + else + redirect_to edit_password_path(params[:token]), alert: "Passwords did not match." + end + end + + private + def set_user_by_token + @user = User.find_by_password_reset_token!(params[:token]) + rescue ActiveSupport::MessageVerifier::InvalidSignature + redirect_to new_password_path, alert: "Password reset link is invalid or has expired." + end +end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb new file mode 100644 index 0000000..93c877b --- /dev/null +++ b/app/controllers/posts_controller.rb @@ -0,0 +1,64 @@ +class PostsController < ApplicationController + before_action :authenticate_user!, only: [:new, :create, :edit, :update, :destroy] + allow_unauthenticated_access(only: [:index, :show]) + + before_action :set_member + before_action :set_blog + before_action :set_post, only: [:show, :edit, :update, :destroy] + + def index + @posts = @blog.posts + end + + def show + + end + + def new + @post = @blog.posts.build + end + + def create + @post = @blog.posts.build(post_params) + if @post.save + redirect_to member_blog_post_path(@member, @blog, @post), notice: "Post created." + else + render :new, status: :unprocessable_entity + end + end + + def edit + end + + def update + if @post.update(post_params) + redirect_to member_blog_post_path(@member, @blog, @post), notice: "Post updated." + else + render :edit, status: :unprocessable_entity + end + end + + def destroy + @post.destroy + redirect_to member_blog_path(@member, @blog), notice: "Post deleted." + end + + private + + def set_member + @member = Member.find(params[:member_id]) + end + + def set_blog + @blog = @member.blogs.find(params[:blog_id]) + end + + def set_post + @post = @blog.posts.find(params[:id]) + end + + def post_params + params.require(:post).permit(:post_title, :text, :mood, :music, :icon_image) + end +end + diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb new file mode 100644 index 0000000..ea7cd2a --- /dev/null +++ b/app/controllers/profiles_controller.rb @@ -0,0 +1,64 @@ +class ProfilesController < ApplicationController + allow_unauthenticated_access only: %i[ index show ] + before_action :authenticate_user!, only: [:new, :create, :edit, :update] + before_action :set_profile, only: [:edit, :update, :update] + + def index + @profiles = Profile.all + end + + def new + @profile = Profile.new +end + +def create + @profile = Profile.create(profile_params) + if @profile.save + + redirect_to @profile, notice: 'Profile was successfully created.' + else + + render :new + end +end + def edit + + end + + def update + if @profile.update(profile_params) + redirect_to @profile, notice: 'Profile was successfully updated!' + else + render :edit + end + end + + def show + @profile = Profile.find_by(id: params[:id]) + + if @profile.nil? + flash[:alert] = "Profile not found" + redirect_to root_path + end +end + def destroy + @profile = Profile.find(params[:id]) + @profile.destroy +end + + private + + def set_profile + @profile = Profile.find_by(id: params[:id]) # Find profile by ID passed in the URL + if @profile.nil? + redirect_to profiles_path, alert: 'Profile not found.' + end + end + + def profile_params +params.require(:profile).permit(:bio, :name, :avatar_image, :age, :location, :website, :pronouns) + end + +end + + diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb new file mode 100644 index 0000000..cd9677e --- /dev/null +++ b/app/controllers/sessions_controller.rb @@ -0,0 +1,31 @@ +class SessionsController < ApplicationController + + allow_unauthenticated_access only: %i[new create] + rate_limit to: 10, within: 3.minutes, only: :create, with: -> { redirect_to new_session_path, alert: "Try again later." } + + + def new + end + + + def create + + user = User.find_by(email_address: params[:email_address]) + + if user&.authenticate(params[:password]) + session[:user_id] = user.id + start_new_session_for(user) + redirect_to root_path, notice: "Signed in!" + else + flash[:alert] = "Invalid email or password" + render :new, status: :unprocessable_entity + end + end + + + def destroy + session.delete(:user_id) + reset_session + redirect_to root_path, notice: "Signed out!" + end +end diff --git a/app/controllers/sitemaps_controller.rb b/app/controllers/sitemaps_controller.rb new file mode 100644 index 0000000..83d3174 --- /dev/null +++ b/app/controllers/sitemaps_controller.rb @@ -0,0 +1,51 @@ +class SitemapsController < ApplicationController + before_action :authenticate_user!, only: %i[new edit update create destroy] + allow_unauthenticated_access only: %i[index show] + + def index + @sitemap = Sitemap.all + end + + def new + @sitemap = Sitemap.new + end + + def create + @sitemap = Sitemap.new(sitemap_params) + if @sitemap.save + redirect_to @sitemap + else + render :new + end + end + + def show + @sitemap = Sitemap.find(params[:id]) + end + + def edit + @sitemap = Sitemap.find(params[:id]) + end + + def update + @sitemap = Sitemap.find(params[:id]) + if @sitemap.update(sitemap_params) + redirect_to @sitemap + else + render :edit + end + end + + def destroy + @sitemap = Sitemap.find(params[:id]) + @sitemap.destroy + redirect_to sitemaps_path + end + + private + + def sitemap_params + params.require(:sitemap).permit(:text) + end +end + diff --git a/app/controllers/updates_controller.rb b/app/controllers/updates_controller.rb new file mode 100644 index 0000000..5f55134 --- /dev/null +++ b/app/controllers/updates_controller.rb @@ -0,0 +1,2 @@ +class UpdatesController < ApplicationController +end diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb new file mode 100644 index 0000000..5b477a5 --- /dev/null +++ b/app/controllers/welcome_controller.rb @@ -0,0 +1,19 @@ +class WelcomeController < ApplicationController + allow_unauthenticated_access(only: %i[index show]) + def index + @latest_post = Post.order(created_at: :desc).first + + end + def new + end + def edit + end + def destroy + end + def update + end + def show + end + def create + end +end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/app/helpers/articles_helper.rb b/app/helpers/articles_helper.rb new file mode 100644 index 0000000..2968277 --- /dev/null +++ b/app/helpers/articles_helper.rb @@ -0,0 +1,2 @@ +module ArticlesHelper +end diff --git a/app/helpers/blogmap_helper.rb b/app/helpers/blogmap_helper.rb new file mode 100644 index 0000000..1f1b01e --- /dev/null +++ b/app/helpers/blogmap_helper.rb @@ -0,0 +1,2 @@ +module BlogmapHelper +end diff --git a/app/helpers/blogs_helper.rb b/app/helpers/blogs_helper.rb new file mode 100644 index 0000000..cc0dbd2 --- /dev/null +++ b/app/helpers/blogs_helper.rb @@ -0,0 +1,2 @@ +module BlogsHelper +end diff --git a/app/helpers/comments_helper.rb b/app/helpers/comments_helper.rb new file mode 100644 index 0000000..0ec9ca5 --- /dev/null +++ b/app/helpers/comments_helper.rb @@ -0,0 +1,2 @@ +module CommentsHelper +end diff --git a/app/helpers/lists_helper.rb b/app/helpers/lists_helper.rb new file mode 100644 index 0000000..bf2e0db --- /dev/null +++ b/app/helpers/lists_helper.rb @@ -0,0 +1,2 @@ +module ListsHelper +end diff --git a/app/helpers/members_helper.rb b/app/helpers/members_helper.rb new file mode 100644 index 0000000..e3fa623 --- /dev/null +++ b/app/helpers/members_helper.rb @@ -0,0 +1,2 @@ +module MembersHelper +end diff --git a/app/helpers/pages_helper.rb b/app/helpers/pages_helper.rb new file mode 100644 index 0000000..2c057fd --- /dev/null +++ b/app/helpers/pages_helper.rb @@ -0,0 +1,2 @@ +module PagesHelper +end diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb new file mode 100644 index 0000000..a7b8cec --- /dev/null +++ b/app/helpers/posts_helper.rb @@ -0,0 +1,2 @@ +module PostsHelper +end diff --git a/app/helpers/profiles_helper.rb b/app/helpers/profiles_helper.rb new file mode 100644 index 0000000..4e43050 --- /dev/null +++ b/app/helpers/profiles_helper.rb @@ -0,0 +1,2 @@ +module ProfilesHelper +end diff --git a/app/helpers/sitemap_helper.rb b/app/helpers/sitemap_helper.rb new file mode 100644 index 0000000..39a6711 --- /dev/null +++ b/app/helpers/sitemap_helper.rb @@ -0,0 +1,2 @@ +module SitemapHelper +end diff --git a/app/helpers/updates_helper.rb b/app/helpers/updates_helper.rb new file mode 100644 index 0000000..a9af2d4 --- /dev/null +++ b/app/helpers/updates_helper.rb @@ -0,0 +1,2 @@ +module UpdatesHelper +end diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb new file mode 100644 index 0000000..eeead45 --- /dev/null +++ b/app/helpers/welcome_helper.rb @@ -0,0 +1,2 @@ +module WelcomeHelper +end diff --git a/app/javascript/application.js b/app/javascript/application.js new file mode 100644 index 0000000..9ae56c5 --- /dev/null +++ b/app/javascript/application.js @@ -0,0 +1,6 @@ +// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails +import "@hotwired/turbo-rails" +import "controllers" + +import "trix" +import "@rails/actiontext" diff --git a/app/javascript/controllers/application.js b/app/javascript/controllers/application.js new file mode 100644 index 0000000..1213e85 --- /dev/null +++ b/app/javascript/controllers/application.js @@ -0,0 +1,9 @@ +import { Application } from "@hotwired/stimulus" + +const application = Application.start() + +// Configure Stimulus development experience +application.debug = false +window.Stimulus = application + +export { application } diff --git a/app/javascript/controllers/hello_controller.js b/app/javascript/controllers/hello_controller.js new file mode 100644 index 0000000..5975c07 --- /dev/null +++ b/app/javascript/controllers/hello_controller.js @@ -0,0 +1,7 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + connect() { + this.element.textContent = "Hello World!" + } +} diff --git a/app/javascript/controllers/index.js b/app/javascript/controllers/index.js new file mode 100644 index 0000000..1156bf8 --- /dev/null +++ b/app/javascript/controllers/index.js @@ -0,0 +1,4 @@ +// Import and register all your controllers from the importmap via controllers/**/*_controller +import { application } from "controllers/application" +import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading" +eagerLoadControllersFrom("controllers", application) diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb new file mode 100644 index 0000000..d394c3d --- /dev/null +++ b/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +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 diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb new file mode 100644 index 0000000..3c34c81 --- /dev/null +++ b/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: "from@example.com" + layout "mailer" +end diff --git a/app/mailers/passwords_mailer.rb b/app/mailers/passwords_mailer.rb new file mode 100644 index 0000000..4f0ac7f --- /dev/null +++ b/app/mailers/passwords_mailer.rb @@ -0,0 +1,6 @@ +class PasswordsMailer < ApplicationMailer + def reset(user) + @user = user + mail subject: "Reset your password", to: user.email_address + end +end diff --git a/app/models/application_record.rb b/app/models/application_record.rb new file mode 100644 index 0000000..b63caeb --- /dev/null +++ b/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/app/models/article.rb b/app/models/article.rb new file mode 100644 index 0000000..2d35895 --- /dev/null +++ b/app/models/article.rb @@ -0,0 +1,15 @@ +class Article < ApplicationRecord + has_rich_text :text + has_rich_text :mood + has_rich_text :music + has_one_attached :icon_image + + + validates :title, presence: true, + length: { minimum: 5 } + + +end + + + diff --git a/app/models/blog.rb b/app/models/blog.rb new file mode 100644 index 0000000..609c302 --- /dev/null +++ b/app/models/blog.rb @@ -0,0 +1,7 @@ +class Blog < ApplicationRecord + has_rich_text :description + has_many :posts, dependent: :destroy +belongs_to :member + validates :description, presence: true, + length: { minimum: 5 } +end diff --git a/app/models/blogmap.rb b/app/models/blogmap.rb new file mode 100644 index 0000000..2a05b98 --- /dev/null +++ b/app/models/blogmap.rb @@ -0,0 +1,2 @@ +class Blogmap < ApplicationRecord +end diff --git a/app/models/comment.rb b/app/models/comment.rb new file mode 100644 index 0000000..31e6039 --- /dev/null +++ b/app/models/comment.rb @@ -0,0 +1,6 @@ +class Comment < ApplicationRecord + belongs_to :post + belongs_to :user, optional: true + has_rich_text :body +end + diff --git a/app/models/concerns/.keep b/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/models/current.rb b/app/models/current.rb new file mode 100644 index 0000000..2bef56d --- /dev/null +++ b/app/models/current.rb @@ -0,0 +1,4 @@ +class Current < ActiveSupport::CurrentAttributes + attribute :session + delegate :user, to: :session, allow_nil: true +end diff --git a/app/models/list.rb b/app/models/list.rb new file mode 100644 index 0000000..513b963 --- /dev/null +++ b/app/models/list.rb @@ -0,0 +1,2 @@ +class List < ApplicationRecord +end diff --git a/app/models/member.rb b/app/models/member.rb new file mode 100644 index 0000000..6c9eabd --- /dev/null +++ b/app/models/member.rb @@ -0,0 +1,12 @@ +class Member < ApplicationRecord + belongs_to :user + has_one_attached :avatar_image + has_rich_text :bio + + has_many :blogs + has_many :posts + + validates :name, presence: true, + length: { minimum: 1 } + validates :avatar_image, presence:true +end diff --git a/app/models/page.rb b/app/models/page.rb new file mode 100644 index 0000000..13bde31 --- /dev/null +++ b/app/models/page.rb @@ -0,0 +1,10 @@ +class Page < ApplicationRecord +belongs_to :member +has_rich_text :body +validates :title, presence: true, + length: { minimum: 3 } +validates :body, presence: true, + length: { minimum: 5 } + + +end diff --git a/app/models/post.rb b/app/models/post.rb new file mode 100644 index 0000000..b6fd594 --- /dev/null +++ b/app/models/post.rb @@ -0,0 +1,13 @@ +class Post < ApplicationRecord +belongs_to :blog +has_one_attached :icon_image +has_many :comments + has_rich_text :text + has_rich_text :mood + has_rich_text :music + validates :post_title, presence: true, + length: { minimum: 5 } + validates :text, presence: true, + length: { minimum: 5 } + validates :icon_image, presence:true +end diff --git a/app/models/profile.rb b/app/models/profile.rb new file mode 100644 index 0000000..1916066 --- /dev/null +++ b/app/models/profile.rb @@ -0,0 +1,5 @@ +class Profile < ApplicationRecord + belongs_to :user + has_one_attached :avatar_image + has_rich_text :bio +end diff --git a/app/models/session.rb b/app/models/session.rb new file mode 100644 index 0000000..cf376fb --- /dev/null +++ b/app/models/session.rb @@ -0,0 +1,3 @@ +class Session < ApplicationRecord + belongs_to :user +end diff --git a/app/models/sitemap.rb b/app/models/sitemap.rb new file mode 100644 index 0000000..fcf83da --- /dev/null +++ b/app/models/sitemap.rb @@ -0,0 +1,5 @@ +class Sitemap < ApplicationRecord + has_rich_text :text + has_many :sitemaps, dependent: :destroy + +end diff --git a/app/models/update.rb b/app/models/update.rb new file mode 100644 index 0000000..f733719 --- /dev/null +++ b/app/models/update.rb @@ -0,0 +1,2 @@ +class Update < ApplicationRecord +end diff --git a/app/models/user.rb b/app/models/user.rb new file mode 100644 index 0000000..c266222 --- /dev/null +++ b/app/models/user.rb @@ -0,0 +1,10 @@ +class User < ApplicationRecord + has_secure_password + has_many :sessions, dependent: :destroy + has_many :members + normalizes :email_address, with: ->(e) { e.strip.downcase } +end + +def build_default_profile + create_profile # Creates an empty profile for the new user + end diff --git a/app/views/articles/_form.html.erb b/app/views/articles/_form.html.erb new file mode 100644 index 0000000..a457d46 --- /dev/null +++ b/app/views/articles/_form.html.erb @@ -0,0 +1,28 @@ +<%= form_with model: @article do |form| %> + <% if form.object.errors.any? %> +

<%= form.object.errors.full_messages.first %>

+ <% end %> + + +

+ <%= form.label :title %>
+ <%= form.text_field :title %> +

+ +

+ <%= form.label :text %>
+ <%= form.rich_textarea :text %> +

+

+ <%= form.label :mood %>
+ <%= form.rich_textarea :mood %> +

+

+ <%= form.label :music %>
+ <%= form.rich_textarea :music %> +

+

+ <%= form.submit %> +

+ +<% end %> diff --git a/app/views/articles/edit.html.erb b/app/views/articles/edit.html.erb new file mode 100644 index 0000000..07ceba2 --- /dev/null +++ b/app/views/articles/edit.html.erb @@ -0,0 +1,28 @@ +
+<%= link_to 'Back', articles_path %> +<%= form_with(model: @article, local: true) do |form| %> +<%= form.label :icon_image, style: "display: block" %> +<%= form.file_field :icon_image, accept: "image/*" %> +

+ <%= form.label :title %>
+ <%= form.text_field :title %> +

+ +

+ <%= form.label :text %>
+ <%= form.rich_textarea :text %> +

+

+ <%= form.label :mood %>
+ <%= form.rich_textarea :mood %> +

+

+ <%= form.label :music %>
+ <%= form.rich_textarea :music %> +

+

+ <%= form.submit %> +

+ +<% end %> +
diff --git a/app/views/articles/feed.xml.builder b/app/views/articles/feed.xml.builder new file mode 100644 index 0000000..b24d4c8 --- /dev/null +++ b/app/views/articles/feed.xml.builder @@ -0,0 +1,19 @@ +xml.instruct! :xml, version: "1.0" +xml.rss :version => "2.0" do + xml.channel do + xml.title "AgnestheAlien" + xml.description "Agnes the Alien's blog" + xml.link root_url + + Article.order('created_at DESC').each do |article| + xml.item do + xml.title article.title + xml.description article.text.to_plain_text[0,150] + xml.pubDate article.created_at.rfc2822 + xml.link article_url(article) + xml.guid article_url(article) + end + end + end +end + diff --git a/app/views/articles/index.html.erb b/app/views/articles/index.html.erb new file mode 100644 index 0000000..2295935 --- /dev/null +++ b/app/views/articles/index.html.erb @@ -0,0 +1,20 @@ +<% if current_user %> + +<%= link_to 'New Poast', new_article_path(@article) %>

<% end %>
+ +<% @articles.each do |article| %> + + <%= article.title %> +
+ <%= link_to 'View', article_path(article) %>
+<% if current_user %> +| + + <%= link_to 'Edit', edit_article_path(article) %> + <%= link_to 'Destroy', article_path(article), data: { + turbo_method: :delete, + turbo_confirm: "Are you sure?" + } %> + <% end %> +


+ <% end %> diff --git a/app/views/articles/new.html.erb b/app/views/articles/new.html.erb new file mode 100644 index 0000000..9032c2a --- /dev/null +++ b/app/views/articles/new.html.erb @@ -0,0 +1,32 @@ +<% if current_user %> +
+

New Article

+ <%= link_to 'Back', articles_path %> + <%= form_with scope: :article, url: articles_path, local: true do |form| %> + <%= form.label :icon_image, style: "display: block" %> + <%= form.file_field :icon_image, accept: "image/*" %> + +

+ <%= form.label 'Name' %>
+ <%= form.text_field :title %> +

+ +

+ <%= form.label 'Bio' %>
+ <%= form.rich_text_area :text %> +

+

+ <%= form.label 'Pronouns' %>
+ <%= form.rich_text_area :mood %> +

+

+ <%= form.label 'Current Mood' %>
+ <%= form.rich_text_area :music %> +

+

+ <%= form.submit %> +

+ <% end %> +
+<% end %> + diff --git a/app/views/articles/rss.rss.builder b/app/views/articles/rss.rss.builder new file mode 100644 index 0000000..8f8d4cb --- /dev/null +++ b/app/views/articles/rss.rss.builder @@ -0,0 +1,23 @@ + +xml.instruct! :xml, version: "1.0", encoding: "UTF-8" + +xml.rss(version: "2.0", "xmlns:atom" => "http://www.w3.org/2005/Atom") do + xml.channel do + xml.title "Agnes the Alien's blog" + xml.link articles_url + xml.description "Agnes the Alien's blog at galaxy" + xml.language "en-us" + + @articles.each do |article| + xml.item do + xml.title article.title + xml.link article_url(article) + xml.guid article_url(article) + xml.tag!('description', article.text.to_s) + xml.tag!('pubDate', article.created_at.rfc2822) + + end + end + end + end + diff --git a/app/views/articles/show.html.erb b/app/views/articles/show.html.erb new file mode 100644 index 0000000..328d67d --- /dev/null +++ b/app/views/articles/show.html.erb @@ -0,0 +1,37 @@ +
+ +<%= link_to 'Back', articles_path %>
+<% if current_user %> + <%= link_to 'Edit', edit_article_path(@article) %> + <% end %> +
+ +<%= image_tag @article.icon_image if @article.icon_image.attached? %> +

+ Name: + <%= @article.title %> +

+
+

+ + <%= @article.text %> +

+

+<% if @article.music.present? %> + Currently Listening To...: + <%= @article.music %> +

+ <% end %> +<% if @article.mood.present? %> +

+ Current Mood: + <%= @article.mood %> +

+ <% end %> + +
+ +
+ + +<%= link_to 'Back', articles_path %> diff --git a/app/views/blogmap/index.html.erb b/app/views/blogmap/index.html.erb new file mode 100644 index 0000000..8723997 --- /dev/null +++ b/app/views/blogmap/index.html.erb @@ -0,0 +1,9 @@ +
    + <% @blogs.each do |blog| %> +
  • + <%= link_to blog.member.name, member_path(blog.member) %> — + <%= link_to blog.title, member_blog_path(blog.member, blog) %>

    Description: <%= truncate(blog.description.to_plain_text, length: 400) %> +
  • + +
    <% end %> +
diff --git a/app/views/blogs/edit.html.erb b/app/views/blogs/edit.html.erb new file mode 100644 index 0000000..7a94739 --- /dev/null +++ b/app/views/blogs/edit.html.erb @@ -0,0 +1,21 @@ +

Edit your blog!

+ +<%= form_with model: [@member, @blog] do |form| %> + <%= form.label :title %>
+ <%= form.text_area :title %> +

+ +

+ <%= form.label :links %>
+ <%= form.text_area :links %> +

+ +

+ <%= form.label :description %>
+ <%= form.rich_text_area :description %> +

+ + + <%= form.submit %> + <% end %> +
diff --git a/app/views/blogs/index.html.erb b/app/views/blogs/index.html.erb new file mode 100644 index 0000000..8723997 --- /dev/null +++ b/app/views/blogs/index.html.erb @@ -0,0 +1,9 @@ +
    + <% @blogs.each do |blog| %> +
  • + <%= link_to blog.member.name, member_path(blog.member) %> — + <%= link_to blog.title, member_blog_path(blog.member, blog) %>

    Description: <%= truncate(blog.description.to_plain_text, length: 400) %> +
  • + +
    <% end %> +
diff --git a/app/views/blogs/list.html.erb b/app/views/blogs/list.html.erb new file mode 100644 index 0000000..8723997 --- /dev/null +++ b/app/views/blogs/list.html.erb @@ -0,0 +1,9 @@ +
    + <% @blogs.each do |blog| %> +
  • + <%= link_to blog.member.name, member_path(blog.member) %> — + <%= link_to blog.title, member_blog_path(blog.member, blog) %>

    Description: <%= truncate(blog.description.to_plain_text, length: 400) %> +
  • + +
    <% end %> +
diff --git a/app/views/blogs/new.html.erb b/app/views/blogs/new.html.erb new file mode 100644 index 0000000..999b2df --- /dev/null +++ b/app/views/blogs/new.html.erb @@ -0,0 +1,23 @@ +

Create your blog!

+ +<%= form_with model: [@member, @blog] do |form| %> + <%= form.label :title %>
+ <%= form.text_area :title %> +

+ +

+ <%= form.label :links %>
+ <%= form.text_area :links %> +

+ +

+ <%= form.label :description %>
+ <%= form.rich_text_area :description %> +

+ + + <%= form.submit %> + <% end %> +
+ + diff --git a/app/views/blogs/show.html.erb b/app/views/blogs/show.html.erb new file mode 100644 index 0000000..e587bce --- /dev/null +++ b/app/views/blogs/show.html.erb @@ -0,0 +1,39 @@ +
+ <% if current_user %> + <%= link_to "Edit", edit_member_blog_path %> | <%= link_to "New Post", new_member_blog_post_path(@blog.member, @blog) %>


<%= button_to "Destroy", + member_blog_path(@blog.member, @blog), + method: :delete, + data: { confirm: "Are you sure?" } %> + <% end %> + + + <% if @blog.title.present? %> +

<%= @blog.title %>

+ <% end %> + + <%= @blog.description %> +
+ <% @posts.each do |post| %> +
<%= post.created_at %> | + Title: <%= post.post_title %>

+ <% if post.icon_image.attached? %> + <%= image_tag post.icon_image, width: "100", height: "100" %> + <% else %> +

No avatar image available.

+ <% end %>
+ Content: + <%= truncate(post.text.to_plain_text, length: 400) %> +
+ <%= link_to 'Show', member_blog_post_path(@member, @blog, post) %> +<% if current_user %> + + <%= link_to 'Edit', edit_member_blog_post_path(@member, @blog, post) %> + <%= link_to 'Destroy', member_blog_post_path(@member, @blog, post), data: { + turbo_method: :delete + } %> + <% end %> +
+ <% end %> + +
+ diff --git a/app/views/comments/_comment.html.erb b/app/views/comments/_comment.html.erb new file mode 100644 index 0000000..758e36e --- /dev/null +++ b/app/views/comments/_comment.html.erb @@ -0,0 +1,21 @@ +

+ Name: + <%= comment.commenter %> +

+<% if comment.website.present? %> +

Website: + <%= comment.website %> +

+ <% end %> +

+ Comment: + <%= comment.body %>

+ +<% if current_user %> +<%= link_to "Destroy Comment", + member_blog_post_comment_path(@member, @blog, @post, comment), + data: { turbo_method: :delete, turbo_confirm: "Are you sure?" } %> + + + <% end %> +
diff --git a/app/views/layouts/action_text/contents/_content.html.erb b/app/views/layouts/action_text/contents/_content.html.erb new file mode 100644 index 0000000..9e3c0d0 --- /dev/null +++ b/app/views/layouts/action_text/contents/_content.html.erb @@ -0,0 +1,3 @@ +
+ <%= yield -%> +
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb new file mode 100644 index 0000000..172cf5c --- /dev/null +++ b/app/views/layouts/application.html.erb @@ -0,0 +1,60 @@ + + + + <%= content_for(:title) || "KissingComputer" %> + + + + + <%= csrf_meta_tags %> + <%= csp_meta_tag %> + + + <%= yield :head %> + + <%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %> + <%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %> + + + + + + + + + <%# Includes all stylesheet files in app/assets/stylesheets %> + <%= stylesheet_link_tag :app, "data-turbo-track": "reload" %> + <%= javascript_importmap_tags %> + <%= javascript_include_tag "application", "data-turbolinks-track" => true %> + + + + +

+

An emoji of a computer with kiss marks. K I S S I N G C O M P U T E R

+

+
+
+ <% if current_user %> + <%= link_to 'Sign Out', sign_out_path, data: { turbo_method: :delete } %> + + <% else %> + <%= link_to "Sign In", new_session_path %> + <% end %> + +
+ +

+ +
+<%= yield %> + +
+ + + + + + diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb new file mode 100644 index 0000000..3aac900 --- /dev/null +++ b/app/views/layouts/mailer.html.erb @@ -0,0 +1,13 @@ + + + + + + + + + <%= yield %> + + diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb new file mode 100644 index 0000000..37f0bdd --- /dev/null +++ b/app/views/layouts/mailer.text.erb @@ -0,0 +1 @@ +<%= yield %> diff --git a/app/views/members/edit.html.erb b/app/views/members/edit.html.erb new file mode 100644 index 0000000..c2cbc7e --- /dev/null +++ b/app/views/members/edit.html.erb @@ -0,0 +1,56 @@ +EDIT MEMBER! + +
+<%= form_with model: (@member) do |form| %> + + <%= form.label :avatar_image %>
+ <%= form.file_field :avatar_image %> +

+ +

+ <%= form.label :name %>
+ <%= form.text_area :name %> +

+ +

+ <%= form.label :age %>
+ <%= form.text_area :age %> +

+

+ +

+ <%= form.label :birthday %>
+ <%= form.text_area :birthday %> +

+

+ <%= form.label :bio %>
+ <%= form.rich_text_area :bio %> +

+

+ <%= form.label :links %>
+ <%= form.rich_text_area :links %> +

+ +

+ <%= form.label :pronouns %>
+ <%= form.text_area :pronouns %>
+

+

+ <%= form.label :system_role %>
+ <%= form.text_area :system_role %>
+

+ +

Interests

+ +

<%= form.label :tv_interests %> + <%= form.text_area :tv_interests %> +


+

<%= form.label :music_interests %> +<%= form.text_area :music_interests %> +


+<%= form.label :other_interests %> +<%= form.text_area :other_interests %> +


+ <%= form.submit %> + <% end %> +
diff --git a/app/views/members/index.html.erb b/app/views/members/index.html.erb new file mode 100644 index 0000000..5abfd4d --- /dev/null +++ b/app/views/members/index.html.erb @@ -0,0 +1,42 @@ +

+ <% if current_user %>
Create a new profile?


<% end %> +
+ + + + + + + + + + <% @members.each do |member| %> +
+
+ + + + + + + + + + <% end %> + +
NameAvatar
<%=link_to member.name, member_path(member) %> + <% if member.avatar_image.attached? %> + <%= image_tag member.avatar_image, alt: "#{member.name}'s avatar", width: "100", height: "100" %> + <% else %> +

No avatar image available.

+ <% end %> +

<%= truncate(member.bio.to_plain_text, length: 100) %>

+ <% if current_user %> +
<%= link_to 'Edit', edit_member_path(member) %><%= link_to 'Destroy', member_path(member), data: { + turbo_method: :delete + } %> + <% end %> +
+ +
+
diff --git a/app/views/members/new.html.erb b/app/views/members/new.html.erb new file mode 100644 index 0000000..290ba74 --- /dev/null +++ b/app/views/members/new.html.erb @@ -0,0 +1,44 @@ +CREATE A NEW MEMBER! + +
+<%= form_with model: @member, local: true do |form| %> + + <%= form.label :avatar_image %>
+ <%= form.file_field :avatar_image %> +

+ +

+ <%= form.label :name %>
+ <%= form.text_area :name %> +

+ +

+ <%= form.label :age %>
+ <%= form.text_area :age %> +

+

+ +

+ <%= form.label :birthday %>
+ <%= form.text_area :birthday %> +

+

+ <%= form.label :bio %>
+ <%= form.rich_text_area :bio %> +

+

+ <%= form.label :links %>
+ <%= form.rich_text_area :links %> +

+ +

+ <%= form.label :pronouns %>
+ <%= form.text_area :pronouns %>
+

+

+ <%= form.label :system_role %>
+ <%= form.text_area :system_role %>
+

+ <%= form.submit %> + <% end %> +
diff --git a/app/views/members/show.html.erb b/app/views/members/show.html.erb new file mode 100644 index 0000000..971d9d9 --- /dev/null +++ b/app/views/members/show.html.erb @@ -0,0 +1,75 @@ +
+ <%= link_to 'Back', members_path %> <% if current_user %> | + <%= link_to 'Edit', edit_member_path(@member) %> | <%= link_to "Create blog", new_member_blog_path(@member) %> + <% end %>
+
+ +
+
+ <% if @member.avatar_image.attached? %> +
+ <%= image_tag @member.avatar_image %> +
+ <% end %> + +

Name: <%= @member.name %>

+

Pronouns: <%= @member.pronouns %>

+

Age: <%= @member.age %>

+ <% if @member.birthday.present? %> +

Birthday: <%= @member.birthday %>

+ <% end %> + <% if @member.system_role.present? %> +

System Role: <%= @member.system_role %>

+ <% end %> + <% if @member.links.present? %> +

Links: <%= @member.links.html_safe %>

+<% end %> +
+ +
Interests...
+ + + + + + + + + <% if @member.tv_interests.present? %> + + + + + <% end %> + <% if @member.music_interests.present? %> + + + + + <% end %> + <% if @member.other_interests.present? %> + + + + + <% end %> + +
..
TV<%= @member.tv_interests %>
Music<%= @member.music_interests %>
Other<%= @member.other_interests %>
+
+ +
+ + +

about me...

+ <%= @member.bio %> +
+
+ diff --git a/app/views/pages/edit.html.erb b/app/views/pages/edit.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/pages/index.html.erb b/app/views/pages/index.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/pages/new.html.erb b/app/views/pages/new.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/pages/show.html.erb b/app/views/pages/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/passwords_mailer/reset.html.erb b/app/views/passwords_mailer/reset.html.erb new file mode 100644 index 0000000..1b09154 --- /dev/null +++ b/app/views/passwords_mailer/reset.html.erb @@ -0,0 +1,6 @@ +

+ You can reset your password on + <%= link_to "this password reset page", edit_password_url(@user.password_reset_token) %>. + + This link will expire in <%= distance_of_time_in_words(0, @user.password_reset_token_expires_in) %>. +

diff --git a/app/views/passwords_mailer/reset.text.erb b/app/views/passwords_mailer/reset.text.erb new file mode 100644 index 0000000..aecee82 --- /dev/null +++ b/app/views/passwords_mailer/reset.text.erb @@ -0,0 +1,4 @@ +You can reset your password on +<%= edit_password_url(@user.password_reset_token) %> + +This link will expire in <%= distance_of_time_in_words(0, @user.password_reset_token_expires_in) %>. diff --git a/app/views/posts/edit.html.erb b/app/views/posts/edit.html.erb new file mode 100644 index 0000000..b2914b9 --- /dev/null +++ b/app/views/posts/edit.html.erb @@ -0,0 +1,34 @@ + +
+

New Post

+ +<%= form_with model: [@member, @blog, @post] do |f| %> +
+ <%= f.label :post_title %> + <%= f.text_area :post_title %> +
+ +
+ <%= f.label :text %> + <%= f.rich_text_area :text %> +
+ +
+ <%= f.label :mood %> + <%= f.text_area :mood %> +
+ +
+ <%= f.label :music %> + <%= f.text_area :music %> +
+ +
+ <%= f.label :icon_image %> + <%= f.file_field :icon_image %> +
+ + <%= f.submit "Create Post" %> +<% end %> + +
diff --git a/app/views/posts/index.html.erb b/app/views/posts/index.html.erb new file mode 100644 index 0000000..46345fe --- /dev/null +++ b/app/views/posts/index.html.erb @@ -0,0 +1,26 @@ + +
+

My Posts

+<%= link_to "Back", members_path %> +<% @posts.each do |post| %> +
<%= post.created_at %> | + Title: <%= post.post_title %>

+ <% if post.icon_image.attached? %> + <%= image_tag post.icon_image, width: "100", height: "100" %> + <% else %> +

No avatar image available.

+ <% end %>
+ Content: + <%= truncate(post.text.to_plain_text, length: 400) %> +
+ <%= link_to 'Show', member_blog_post_path(@member, @blog, post) %> +<% if current_user %> + + <%= link_to 'Edit', edit_member_blog_post_path(@member, @blog, post) %> + <%= link_to 'Destroy', member_blog_post_path(@member, @blog, post), data: { + turbo_method: :delete + } %> + <% end %> +
+ <% end %> + diff --git a/app/views/posts/new.html.erb b/app/views/posts/new.html.erb new file mode 100644 index 0000000..73cbb72 --- /dev/null +++ b/app/views/posts/new.html.erb @@ -0,0 +1,36 @@ + +
+

New Post

+ +<%= form_with model: [@member, @blog, @post] do |f| %> +
+ <%= f.label :post_title %> + <%= f.text_area :post_title %> +
+ +
+ <%= f.label :text %> + <%= f.rich_text_area :text %> +
+ +
+ <%= f.label :mood %> + <%= f.text_area :mood %> +
+ +
+ <%= f.label :music %> + <%= f.text_area :music %> +
+ +
+ <%= f.label :icon_image %> + <%= f.file_field :icon_image %> +
+ + <%= f.submit "Create Post" %> +<% end %> + +
+ + diff --git a/app/views/posts/show.html.erb b/app/views/posts/show.html.erb new file mode 100644 index 0000000..63143d1 --- /dev/null +++ b/app/views/posts/show.html.erb @@ -0,0 +1,39 @@ +<%= link_to 'Back', member_blog_posts_path %>
+<%= image_tag @post.icon_image if @post.icon_image.attached? %> +

+ Post Title: + <%= @post.post_title %> +

+ +

+ Content: + <%= @post.text %> +

+

+ Currently Listening To...: + <%= @post.music %> +

+

+ Current Mood: + <%= @post.mood %> +


+
+

Comments

+ <%= render @post.comments %> +add a comment... + <%= form_with( + model: [@post.blog.member, @post.blog, @post, Comment.new], + local: true + ) do |form| %> + + <%= form.label :commenter %>
+ <%= form.text_field :commenter %> +
+ <%= form.label :body %>
+ <%= form.rich_text_area :body %> + + <%= form.submit %> + <% end %> +
+ + diff --git a/app/views/profiles/edit.html.erb b/app/views/profiles/edit.html.erb new file mode 100644 index 0000000..e40b47f --- /dev/null +++ b/app/views/profiles/edit.html.erb @@ -0,0 +1,38 @@ +

Edit Profile

+
+<%= form_with model: (@profile) do |form| %> + <% if @profile.errors.any? %> +

Oopsiesssssss u fucked up

+ <% end %> + +

+ <%= form.label :avatar_image %>
+ <%= form.file_field :avatar_image %> +

+ +

+ <%= form.label :name %>
+ <%= form.text_area :name %> +

+ +

+ <%= form.label :bio %>
+ <%= form.rich_text_area :bio %> +

+ +

+ <%= form.label :age %>
+ <%= form.text_area :age %>
+

+ +

+ <%= form.label :pronouns %>
+ <%= form.text_area :pronouns %>
+

+ + <%= form.label :website %>
+ <%= form.text_area :website %>
+

+ <%= form.submit %> + <% end %> +
diff --git a/app/views/profiles/index.html.erb b/app/views/profiles/index.html.erb new file mode 100644 index 0000000..8ffed85 --- /dev/null +++ b/app/views/profiles/index.html.erb @@ -0,0 +1,31 @@ +

Profiles

+ + + + + + + + + + <% @profiles.each do |profile| %> + + + + + + +<% if current_user %> + + <% end %> +<% end %> + + +
NameAvatarActions
| <%= profile.name %> + <% if profile.avatar_image.attached? %> + <%= image_tag profile.avatar_image, alt: "#{profile.name}'s avatar", width: "50", height: "50" %> + <% else %> +

No avatar image available.

+ <% end %> +
<%= link_to 'Show', profile_path(profile) %><%= link_to 'Edit', edit_profile_path(profile) %>
+ diff --git a/app/views/profiles/new.html.erb b/app/views/profiles/new.html.erb new file mode 100644 index 0000000..e7841f1 --- /dev/null +++ b/app/views/profiles/new.html.erb @@ -0,0 +1,38 @@ + +<% if current_user %> +

create profile

+<%= form_with scope: :profile, url: profiles_path, local: true do |form| %> + +
+

+ <%= form.label :avatar_image %>
+ <%= form.file_field :avatar_image %> +

+ +

+ <%= form.label :name %>
+ <%= form.text_area :name %> +

+ +

+ <%= form.label :bio %>
+ <%= form.rich_text_area :bio %> +

+ +

+ <%= form.label :age %>
+ <%= form.text_area :age %>
+

+ +

+ <%= form.label :pronouns %>
+ <%= form.text_area :pronouns %>
+

+

+ <%= form.label :website %>
+ <%= form.text_area :website %>
+

+ <%= form.submit %> + <% end %> + <% end %> +
diff --git a/app/views/profiles/show.html.erb b/app/views/profiles/show.html.erb new file mode 100644 index 0000000..8555567 --- /dev/null +++ b/app/views/profiles/show.html.erb @@ -0,0 +1,17 @@ +
+ +<%= link_to 'Back', articles_path %>
+
+ + + +
+
+<%= image_tag @member.avatar_image if @member.avatar_image.attached? %> +
  • Name: <%= @member.name %>
  • +
  • Pronouns: <%= @member.pronouns %>
  • +
  • Age: <%= @member.birthday %>
  • +
    +

    about me...

    +<%= @member.bio %> +
    diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb new file mode 100644 index 0000000..015620e --- /dev/null +++ b/app/views/pwa/manifest.json.erb @@ -0,0 +1,22 @@ +{ + "name": "Galaxy", + "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": "Galaxy.", + "theme_color": "red", + "background_color": "red" +} diff --git a/app/views/pwa/service-worker.js b/app/views/pwa/service-worker.js new file mode 100644 index 0000000..b3a13fb --- /dev/null +++ b/app/views/pwa/service-worker.js @@ -0,0 +1,26 @@ +// 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) +// } +// }) +// ) +// }) diff --git a/app/views/sessions/new.html.erb b/app/views/sessions/new.html.erb new file mode 100644 index 0000000..ff641c4 --- /dev/null +++ b/app/views/sessions/new.html.erb @@ -0,0 +1,11 @@ +<%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %> +<%= tag.div(flash[:notice], style: "color:green") if flash[:notice] %> + +<%= form_with url: session_path do |form| %> + <%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %>
    + <%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %>
    + <%= form.submit "Sign in" %> +<% end %> +
    + +<%= link_to "Forgot password?", new_password_path %> diff --git a/app/views/sitemaps/edit.html.erb b/app/views/sitemaps/edit.html.erb new file mode 100644 index 0000000..b4fa79d --- /dev/null +++ b/app/views/sitemaps/edit.html.erb @@ -0,0 +1,7 @@ +

    Edit

    + +<%= form_with model: @sitemap, local: true do |form| %> + + <%= form.rich_text_area :text %> + <%= form.submit %> + <% end %> diff --git a/app/views/sitemaps/index.html.erb b/app/views/sitemaps/index.html.erb new file mode 100644 index 0000000..5d44bed --- /dev/null +++ b/app/views/sitemaps/index.html.erb @@ -0,0 +1,17 @@ +

    Sitemap

    +<% @sitemap.each do |sitemap| %> + + <%= sitemap.text %> +<% if current_user %> + + <%= link_to 'Edit', edit_sitemap_path(sitemap) %> + <%= link_to "Delete", + sitemaps_path(@sitemap), + data: { + turbo_method: :delete, + turbo_confirm: "Are you sure?" + } %> + + <% end %> + <% end %> + diff --git a/app/views/sitemaps/new.html.erb b/app/views/sitemaps/new.html.erb new file mode 100644 index 0000000..377b34b --- /dev/null +++ b/app/views/sitemaps/new.html.erb @@ -0,0 +1,7 @@ +

    New

    + +<%= form_with model: @sitemap, url: sitemaps_path, local: true do |form| %> + + <%= form.rich_text_area :text %> + <%= form.submit %> + <% end %> diff --git a/app/views/sitemaps/show.html.erb b/app/views/sitemaps/show.html.erb new file mode 100644 index 0000000..e69de29 diff --git a/app/views/welcome/index.html.erb b/app/views/welcome/index.html.erb new file mode 100644 index 0000000..c00be76 --- /dev/null +++ b/app/views/welcome/index.html.erb @@ -0,0 +1,43 @@ +
    +
    + +
    +

    Latest Post....

    +<% if @latest_post %> +

    <%= @latest_post.post_title %>

    <%=@latest_post.created_at %> +

    <%= truncate(@latest_post.text.to_plain_text, length: 200) %>

    +

    By: <%= @latest_post.blog.member.name %> | Blog: <%= @latest_post.blog.title %>

    + <%= link_to 'Read More', member_blog_post_path(@latest_post.blog.member, @latest_post.blog, @latest_post) %> +<% else %> +

    No posts yet.

    +<% end %> +
    + +
    +

    Welcome...

    +a 88x31 site button, with a radial pink and green gradient. in the middle, there is a graphic of a computer with kiss marks.
    +Hi! I'm Agnes (Agnes the Alien!). I'm a freakdyke alien in its mid 20s trying to create a little home on the web. Here, you will find fandom thoughts and events, personal thoughts and life goings-on, my writing and creativity, and just about anything. This website is an eternal work in progress :) Feel free to look around!

    NPC - The Negative Spirit // rainbow 🌈 green & pink // Cutie Connection Binturong // 🛸 If I was in Doom Patrol, I'd be a Negative Spirit. 🛸 // Additional Tags: Vivisection // Evil Yuri ★ Age Gap + +
    PICLOG!!

    +
    +
    + + +
    + +
    + + + +
    + + +

    FUN!

    +
    The moon today
    .
    .
    +
    +
    +
    +

    Guestbook

    + +
    +
    diff --git a/bin/brakeman b/bin/brakeman new file mode 100755 index 0000000..ace1c9b --- /dev/null +++ b/bin/brakeman @@ -0,0 +1,7 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +ARGV.unshift("--ensure-latest") + +load Gem.bin_path("brakeman", "brakeman") diff --git a/bin/bundler-audit b/bin/bundler-audit new file mode 100755 index 0000000..e2ef226 --- /dev/null +++ b/bin/bundler-audit @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +require_relative "../config/boot" +require "bundler/audit/cli" + +ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check") +Bundler::Audit::CLI.start diff --git a/bin/ci b/bin/ci new file mode 100755 index 0000000..4137ad5 --- /dev/null +++ b/bin/ci @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby +require_relative "../config/boot" +require "active_support/continuous_integration" + +CI = ActiveSupport::ContinuousIntegration +require_relative "../config/ci.rb" diff --git a/bin/dev b/bin/dev new file mode 100755 index 0000000..5f91c20 --- /dev/null +++ b/bin/dev @@ -0,0 +1,2 @@ +#!/usr/bin/env ruby +exec "./bin/rails", "server", *ARGV diff --git a/bin/docker-entrypoint b/bin/docker-entrypoint new file mode 100755 index 0000000..ed31659 --- /dev/null +++ b/bin/docker-entrypoint @@ -0,0 +1,8 @@ +#!/bin/bash -e + +# If running the rails server then create or migrate existing database +if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then + ./bin/rails db:prepare +fi + +exec "${@}" diff --git a/bin/importmap b/bin/importmap new file mode 100755 index 0000000..36502ab --- /dev/null +++ b/bin/importmap @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby + +require_relative "../config/application" +require "importmap/commands" diff --git a/bin/jobs b/bin/jobs new file mode 100755 index 0000000..dcf59f3 --- /dev/null +++ b/bin/jobs @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby + +require_relative "../config/environment" +require "solid_queue/cli" + +SolidQueue::Cli.start(ARGV) diff --git a/bin/kamal b/bin/kamal new file mode 100755 index 0000000..cbe59b9 --- /dev/null +++ b/bin/kamal @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby +# frozen_string_literal: true + +# +# This file was generated by Bundler. +# +# The application 'kamal' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) + +bundle_binstub = File.expand_path("bundle", __dir__) + +if File.file?(bundle_binstub) + if File.read(bundle_binstub, 300).include?("This file was generated by Bundler") + load(bundle_binstub) + else + abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run. +Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.") + end +end + +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("kamal", "kamal") diff --git a/bin/rails b/bin/rails new file mode 100755 index 0000000..efc0377 --- /dev/null +++ b/bin/rails @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +APP_PATH = File.expand_path("../config/application", __dir__) +require_relative "../config/boot" +require "rails/commands" diff --git a/bin/rake b/bin/rake new file mode 100755 index 0000000..4fbf10b --- /dev/null +++ b/bin/rake @@ -0,0 +1,4 @@ +#!/usr/bin/env ruby +require_relative "../config/boot" +require "rake" +Rake.application.run diff --git a/bin/rubocop b/bin/rubocop new file mode 100755 index 0000000..5a20504 --- /dev/null +++ b/bin/rubocop @@ -0,0 +1,8 @@ +#!/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") diff --git a/bin/setup b/bin/setup new file mode 100755 index 0000000..81be011 --- /dev/null +++ b/bin/setup @@ -0,0 +1,35 @@ +#!/usr/bin/env ruby +require "fileutils" + +APP_ROOT = File.expand_path("..", __dir__) + +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("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" + system! "bin/rails db:reset" if ARGV.include?("--reset") + + puts "\n== Removing old logs and tempfiles ==" + system! "bin/rails log:clear tmp:clear" + + unless ARGV.include?("--skip-server") + puts "\n== Starting development server ==" + STDOUT.flush # flush the output before exec(2) so that it displays + exec "bin/dev" + end +end diff --git a/bin/thrust b/bin/thrust new file mode 100755 index 0000000..36bde2d --- /dev/null +++ b/bin/thrust @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby +require "rubygems" +require "bundler/setup" + +load Gem.bin_path("thruster", "thrust") diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..4a3c09a --- /dev/null +++ b/config.ru @@ -0,0 +1,6 @@ +# This file is used by Rack-based servers to start the application. + +require_relative "config/environment" + +run Rails.application +Rails.application.load_server diff --git a/config/application.rb b/config/application.rb new file mode 100644 index 0000000..e9f4108 --- /dev/null +++ b/config/application.rb @@ -0,0 +1,27 @@ +require_relative "boot" + +require "rails/all" + +# Require the gems listed in Gemfile, including any gems +# you've limited to :test, :development, or :production. +Bundler.require(*Rails.groups) + +module KissingComputer + class Application < Rails::Application + # Initialize configuration defaults for originally generated Rails version. + config.load_defaults 8.1 + + # 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 diff --git a/config/boot.rb b/config/boot.rb new file mode 100644 index 0000000..988a5dd --- /dev/null +++ b/config/boot.rb @@ -0,0 +1,4 @@ +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. diff --git a/config/bundler-audit.yml b/config/bundler-audit.yml new file mode 100644 index 0000000..e74b3af --- /dev/null +++ b/config/bundler-audit.yml @@ -0,0 +1,5 @@ +# Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit. +# CVEs that are not relevant to the application can be enumerated on the ignore list below. + +ignore: + - CVE-THAT-DOES-NOT-APPLY diff --git a/config/cable.yml b/config/cable.yml new file mode 100644 index 0000000..b9adc5a --- /dev/null +++ b/config/cable.yml @@ -0,0 +1,17 @@ +# Async adapter only works within the same process, so for manually triggering cable updates from a console, +# and seeing results in the browser, you must do so from the web console (running inside the dev process), +# not a terminal started via bin/rails console! Add "console" to any action or any ERB template view +# to make the web console appear. +development: + adapter: async + +test: + adapter: test + +production: + adapter: solid_cable + connects_to: + database: + writing: cable + polling_interval: 0.1.seconds + message_retention: 1.day diff --git a/config/cache.yml b/config/cache.yml new file mode 100644 index 0000000..e20236f --- /dev/null +++ b/config/cache.yml @@ -0,0 +1,16 @@ +default: &default + database: cache + store_options: + # Cap age of oldest cache entry to fulfill retention policies + # max_age: <%= 60.days.to_i %> + max_size: <%= 256.megabytes %> + namespace: <%= Rails.env %> + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/config/ci.rb b/config/ci.rb new file mode 100644 index 0000000..e56a92e --- /dev/null +++ b/config/ci.rb @@ -0,0 +1,23 @@ +# Run using bin/ci + +CI.run do + step "Setup", "bin/setup --skip-server" + + step "Style: Ruby", "bin/rubocop" + + step "Security: Gem audit", "bin/bundler-audit" + step "Security: Importmap vulnerability audit", "bin/importmap audit" + step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error" + + step "Tests: Rails", "bin/rails test" + step "Tests: System", "bin/rails test:system" + step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant" + + # Optional: set a green GitHub commit status to unblock PR merge. + # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`. + # if success? + # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff" + # else + # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again." + # end +end diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc new file mode 100644 index 0000000..6ccf09e --- /dev/null +++ b/config/credentials.yml.enc @@ -0,0 +1 @@ +gmTYs49qp2xhxHCKegYT5VVWYljwcajBxDsAOP0gkkKbOoOnTofa0OQZBftCwpQrFhzfxO/rSdSRj4B8VwCZqSI3ZacdOOYqounut1LcSKIi3W1NL5Or/3JN8+PfXx4G2Uw9W9LFL6Hgd5AgLeTrCwSmwAnn/3AqnXSIxfyn81wnsRgrhjfrV0Db7dXYt9kupIlosXUXdkXmd4teXW5zGkiOaYHVoLz2aDsG0yb1Xs3o9LI8cb7vIc0ZjX5XAXbaQwf/UWFdvl9/0A8kWLx1mFKmeNH7Hhp7u1zD20H59QRtg1XP2ALKjFhcfFOPBWT8EEIcAQM+AQUziYANmrJUc6rMlWXL+cSFH1lznclcsnxouJheb+wyCRF2jDdY+TZd12tkco/PGOx5n+uwqFuBGzhQvbdUlYUcKFW1FgruIxafzLSyB/x+JbRpIKzR/nMNSqoMZhBCcKv5n7DBsTkgOSwjDZkwdScYoEgkW3s70oxBpjzYGxamQLQC--JT0Gb0BOQH7FUbwc--1+5NNKn2F5VrSefCJHKWnQ== \ No newline at end of file diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 0000000..693252b --- /dev/null +++ b/config/database.yml @@ -0,0 +1,41 @@ +# SQLite. Versions 3.8.0 and up are supported. +# gem install sqlite3 +# +# Ensure the SQLite 3 gem is defined in your Gemfile +# gem "sqlite3" +# +default: &default + adapter: sqlite3 + max_connections: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> + timeout: 5000 + +development: + <<: *default + database: storage/development.sqlite3 + +# 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: storage/test.sqlite3 + + +# Store production database in the storage/ directory, which by default +# is mounted as a persistent Docker volume in config/deploy.yml. +production: + primary: + <<: *default + database: storage/production.sqlite3 + cache: + <<: *default + database: storage/production_cache.sqlite3 + migrations_paths: db/cache_migrate + queue: + <<: *default + database: storage/production_queue.sqlite3 + migrations_paths: db/queue_migrate + cable: + <<: *default + database: storage/production_cable.sqlite3 + migrations_paths: db/cable_migrate diff --git a/config/deploy.yml b/config/deploy.yml new file mode 100644 index 0000000..0c1e0c8 --- /dev/null +++ b/config/deploy.yml @@ -0,0 +1,126 @@ +<% require "dotenv"; Dotenv.load(".env") %> +# Name of your application. Used to uniquely configure containers. +service: systemspace + +# Name of the container image (use your-user/app-name on external registries). +image: aggieonline/systemspace + +# Deploy to these servers. +servers: + web: + - 192.168.4.36 + + + # job: + # hosts: + # - 192.168.0.1 + # cmd: bin/jobs + +# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server. +# If used with Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption. +# +# Using an SSL proxy like this requires turning on config.assume_ssl and config.force_ssl in production.rb! +# +# Don't use this when deploying to multiple web servers (then you have to terminate SSL at your load balancer). +# +proxy: + ssl: false + host: sonnet.city + app_port: 3000 + +# Where you keep your container images. +registry: + # Alternatives: hub.docker.com / registry.digitalocean.com / ghcr.io / ... + + # Needed for authenticated registries. + username: aggieonline + + # Always use an access token rather than real password when possible. + password: + - KAMAL_REGISTRY_PASSWORD + +# Inject ENV variables into containers (secrets come from .kamal/secrets). +env: + secret: + - RAILS_MASTER_KEY + - KAMAL_REGISTRY_PASSWORD + clear: + # Run the Solid Queue Supervisor inside the web server's Puma process to do jobs. + # When you start using multiple servers, you should split out job processing to a dedicated machine. + SOLID_QUEUE_IN_PUMA: true + + # Set number of processes dedicated to Solid Queue (default: 1) + # JOB_CONCURRENCY: 3 + + # Set number of cores available to the application on each server (default: 1). + # WEB_CONCURRENCY: 2 + + # Match this to any external database server to configure Active Record correctly + # Use galaxy-db for a db accessory server on same machine via local kamal docker network. + # DB_HOST: 192.168.0.2 + + # Log everything from Rails + # RAILS_LOG_LEVEL: debug + +# Aliases are triggered with "bin/kamal ". You can overwrite arguments on invocation: +# "bin/kamal logs -r job" will tail logs from the first server in the job section. +aliases: + console: app exec --interactive --reuse "bin/rails console" + shell: app exec --interactive --reuse "bash" + logs: app logs -f + dbc: app exec --interactive --reuse "bin/rails dbconsole --include-password" + +# Use a persistent storage volume for sqlite database files and local Active Storage files. +# Recommended to change this to a mounted volume path that is backed up off server. +volumes: + - "/home/pj/sonnets/storage:/rails/storage" + +# Bridge fingerprinted assets, like JS and CSS, between versions to avoid +# hitting 404 on in-flight requests. Combines all files from new and old +# version inside the asset_path. +# asset_path: /rails/public/assets + + +# Configure the image builder. +builder: + arch: amd64 + + + # # Build image via remote server (useful for faster amd64 builds on arm64 computers) + # remote: ssh://docker@docker-builder-server + # + # # Pass arguments and secrets to the Docker build process + # args: + # RUBY_VERSION: ruby-3.4.7 + # secrets: + # - GITHUB_TOKEN + # - RAILS_MASTER_KEY + +# Use a different ssh user than root +# ssh: +# user: app + +# Use accessory services (secrets come from .kamal/secrets). +# accessories: +# db: +# image: mysql:8.0 +# host: 192.168.0.2 +# # Change to 3306 to expose port to the world instead of just local network. +# port: "127.0.0.1:3306:3306" +# env: +# clear: +# MYSQL_ROOT_HOST: '%' +# secret: +# - MYSQL_ROOT_PASSWORD +# files: +# - config/mysql/production.cnf:/etc/mysql/my.cnf +# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql +# directories: +# - data:/var/lib/mysql +# redis: +# image: valkey/valkey:8 +# host: 192.168.0.2 +# port: 6379 +# directories: +# - data:/data + diff --git a/config/environment.rb b/config/environment.rb new file mode 100644 index 0000000..cac5315 --- /dev/null +++ b/config/environment.rb @@ -0,0 +1,5 @@ +# Load the Rails application. +require_relative "application" + +# Initialize the Rails application. +Rails.application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb new file mode 100644 index 0000000..75243c3 --- /dev/null +++ b/config/environments/development.rb @@ -0,0 +1,78 @@ +require "active_support/core_ext/integer/time" + +Rails.application.configure do + # Settings specified here will take precedence over those in config/application.rb. + + # Make code changes take effect immediately without server restart. + 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 Action Controller caching. By default Action Controller caching is disabled. + # Run rails dev:cache to toggle Action Controller 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.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" } + else + config.action_controller.perform_caching = false + end + + # Change to :null_store to avoid any caching. + config.cache_store = :memory_store + + # 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 + + # Make template changes take effect immediately. + config.action_mailer.perform_caching = false + + # Set localhost to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "localhost", port: 3000 } + + # Print deprecation notices to the Rails logger. + config.active_support.deprecation = :log + + # 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 + + # Append comments with runtime information tags to SQL queries in logs. + config.active_record.query_log_tags_enabled = true + + # Highlight code that enqueued background job in logs. + config.active_job.verbose_enqueue_logs = true + + # Highlight code that triggered redirect in logs. + config.action_dispatch.verbose_redirect_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 + + # Uncomment if you wish to allow Action Cable access from any origin. + # config.action_cable.disable_request_forgery_protection = 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 diff --git a/config/environments/production.rb b/config/environments/production.rb new file mode 100644 index 0000000..a3f4d74 --- /dev/null +++ b/config/environments/production.rb @@ -0,0 +1,90 @@ +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 for better performance and memory savings (ignored by Rake tasks). + config.eager_load = true + + # Full error reports are disabled. + config.consider_all_requests_local = false + + # Turn on fragment caching in view templates. + config.action_controller.perform_caching = true + + # Cache assets for far-future expiry since they are all digest stamped. + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" } + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.asset_host = "http://assets.example.com" + + # 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. + config.assume_ssl = true + + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. + config.force_ssl = false + + # Skip http-to-https redirect for the default health check endpoint. + config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } } + + # Log to STDOUT with the current request id as a default log tag. + config.log_tags = [ :request_id ] + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT) + + # Change to "debug" to log everything (including potentially personally-identifiable information!). + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info") + + # Prevent health checks from clogging up the logs. + config.silence_healthcheck_path = "/up" + + # Don't log any deprecations. + config.active_support.report_deprecations = false + + # Replace the default in-process memory cache store with a durable alternative. + config.cache_store = :solid_cache_store + + # Replace the default in-process and non-durable queuing backend for Active Job. + config.active_job.queue_adapter = :solid_queue + config.solid_queue.connects_to = { database: { writing: :queue } } + + # 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 + + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } + + # Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit. + # config.action_mailer.smtp_settings = { + # user_name: Rails.application.credentials.dig(:smtp, :user_name), + # password: Rails.application.credentials.dig(:smtp, :password), + # address: "smtp.example.com", + # port: 587, + # authentication: :plain + # } + + # 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 + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false + + # Only use :id for inspections in production. + config.active_record.attributes_for_inspect = [ :id ] + + # 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 diff --git a/config/environments/test.rb b/config/environments/test.rb new file mode 100644 index 0000000..c2095b1 --- /dev/null +++ b/config/environments/test.rb @@ -0,0 +1,53 @@ +# 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=3600" } + + # Show full error reports. + config.consider_all_requests_local = true + 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 + + # 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 + + # Set host to be used by links generated in mailer templates. + config.action_mailer.default_url_options = { host: "example.com" } + + # Print deprecation notices to the stderr. + config.active_support.deprecation = :stderr + + # 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 diff --git a/config/importmap.rb b/config/importmap.rb new file mode 100644 index 0000000..6ed7577 --- /dev/null +++ b/config/importmap.rb @@ -0,0 +1,9 @@ +# Pin npm packages by running ./bin/importmap + +pin "application" +pin "@hotwired/turbo-rails", to: "turbo.min.js" +pin "@hotwired/stimulus", to: "stimulus.min.js" +pin "@hotwired/stimulus-loading", to: "stimulus-loading.js" +pin_all_from "app/javascript/controllers", under: "controllers" +pin "trix" +pin "@rails/actiontext", to: "actiontext.esm.js" diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb new file mode 100644 index 0000000..4873244 --- /dev/null +++ b/config/initializers/assets.rb @@ -0,0 +1,7 @@ +# 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 diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb new file mode 100644 index 0000000..d51d713 --- /dev/null +++ b/config/initializers/content_security_policy.rb @@ -0,0 +1,29 @@ +# 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) +# +# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag` +# # if the corresponding directives are specified in `content_security_policy_nonce_directives`. +# # config.content_security_policy_nonce_auto = true +# +# # Report violations without enforcing the policy. +# # config.content_security_policy_report_only = true +# end diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb new file mode 100644 index 0000000..c0b717f --- /dev/null +++ b/config/initializers/filter_parameter_logging.rb @@ -0,0 +1,8 @@ +# 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, :cvv, :cvc +] diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb new file mode 100644 index 0000000..3860f65 --- /dev/null +++ b/config/initializers/inflections.rb @@ -0,0 +1,16 @@ +# 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 diff --git a/config/initializers/session_store.rb b/config/initializers/session_store.rb new file mode 100644 index 0000000..5587a3d --- /dev/null +++ b/config/initializers/session_store.rb @@ -0,0 +1,5 @@ +Rails.application.config.session_store :cookie_store, + key: '_your_app_session', + secure: Rails.env.production?, + httponly: true, + same_site: :strict # diff --git a/config/locales/en.yml b/config/locales/en.yml new file mode 100644 index 0000000..6c349ae --- /dev/null +++ b/config/locales/en.yml @@ -0,0 +1,31 @@ +# 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" diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 0000000..38c4b86 --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,42 @@ +# 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. +# +# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You +# should only set this value when you want to run 2 or more workers. The +# default is already 1. You can set it to `auto` to automatically start a worker +# for each available processor. +# +# 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 +# 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 + +# Run the Solid Queue supervisor inside of Puma for single-server deployments. +plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"] + +# 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"] diff --git a/config/queue.yml b/config/queue.yml new file mode 100644 index 0000000..9eace59 --- /dev/null +++ b/config/queue.yml @@ -0,0 +1,18 @@ +default: &default + dispatchers: + - polling_interval: 1 + batch_size: 500 + workers: + - queues: "*" + threads: 3 + processes: <%= ENV.fetch("JOB_CONCURRENCY", 1) %> + polling_interval: 0.1 + +development: + <<: *default + +test: + <<: *default + +production: + <<: *default diff --git a/config/recurring.yml b/config/recurring.yml new file mode 100644 index 0000000..b4207f9 --- /dev/null +++ b/config/recurring.yml @@ -0,0 +1,15 @@ +# examples: +# periodic_cleanup: +# class: CleanSoftDeletedRecordsJob +# queue: background +# args: [ 1000, { batch_size: 500 } ] +# schedule: every hour +# periodic_cleanup_with_command: +# command: "SoftDeletedRecord.due.delete_all" +# priority: 2 +# schedule: at 5am every day + +production: + clear_solid_queue_finished_jobs: + command: "SolidQueue::Job.clear_finished_in_batches(sleep_between_batches: 0.3)" + schedule: every hour at minute 12 diff --git a/config/routes.rb b/config/routes.rb new file mode 100644 index 0000000..8dd3744 --- /dev/null +++ b/config/routes.rb @@ -0,0 +1,26 @@ +Rails.application.routes.draw do + # + get "up" => "rails/health#show", as: :rails_health_check + # + root "welcome#index" + + resource :session, only: %i[new create destroy] + resources :passwords, param: :token + + get "/login", to: "sessions#new" + post "/login", to: "sessions#create" + delete "/sign_out", to: "sessions#destroy", as: :sign_out + + get "feed", to: "articles#feed", format: "xml", as: :feed + resources :articles + resources :blogmap + resources :sitemaps + resources :members do + resources :pages + resources :blogs do + resources :posts do + resources :comments, only: [:create, :destroy] + end + end + end +end diff --git a/config/storage.yml b/config/storage.yml new file mode 100644 index 0000000..927dc53 --- /dev/null +++ b/config/storage.yml @@ -0,0 +1,27 @@ +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 %> + +# mirror: +# service: Mirror +# primary: local +# mirrors: [ amazon, google, microsoft ] diff --git a/lib/tasks/.keep b/lib/tasks/.keep new file mode 100644 index 0000000..e69de29 diff --git a/log/.keep b/log/.keep new file mode 100644 index 0000000..e69de29 diff --git a/public/400.html b/public/400.html new file mode 100644 index 0000000..640de03 --- /dev/null +++ b/public/400.html @@ -0,0 +1,135 @@ + + + + + + + The server cannot process the request due to a client error (400 Bad Request) + + + + + + + + + + + + + +
    +
    + +
    +
    +

    The server cannot process the request due to a client error. Please check the request and try again. If you're the application owner check the logs for more information.

    +
    +
    + + + + diff --git a/public/404.html b/public/404.html new file mode 100644 index 0000000..d7f0f14 --- /dev/null +++ b/public/404.html @@ -0,0 +1,135 @@ + + + + + + + The page you were looking for doesn't exist (404 Not found) + + + + + + + + + + + + + +
    +
    + +
    +
    +

    The page you were looking for doesn't exist. You may have mistyped the address or the page may have moved. If you're the application owner check the logs for more information.

    +
    +
    + + + + diff --git a/public/406-unsupported-browser.html b/public/406-unsupported-browser.html new file mode 100644 index 0000000..43d2811 --- /dev/null +++ b/public/406-unsupported-browser.html @@ -0,0 +1,135 @@ + + + + + + + Your browser is not supported (406 Not Acceptable) + + + + + + + + + + + + + +
    +
    + +
    +
    +

    Your browser is not supported.
    Please upgrade your browser to continue.

    +
    +
    + + + + diff --git a/public/422.html b/public/422.html new file mode 100644 index 0000000..f12fb4a --- /dev/null +++ b/public/422.html @@ -0,0 +1,135 @@ + + + + + + + The change you wanted was rejected (422 Unprocessable Entity) + + + + + + + + + + + + + +
    +
    + +
    +
    +

    The change you wanted was rejected. Maybe you tried to change something you didn't have access to. If you're the application owner check the logs for more information.

    +
    +
    + + + + diff --git a/public/500.html b/public/500.html new file mode 100644 index 0000000..e4eb18a --- /dev/null +++ b/public/500.html @@ -0,0 +1,135 @@ + + + + + + + We're sorry, but something went wrong (500 Internal Server Error) + + + + + + + + + + + + + +
    +
    + +
    +
    +

    We're sorry, but something went wrong.
    If you're the application owner check the logs for more information.

    +
    +
    + + + + diff --git a/public/button.png b/public/button.png new file mode 100644 index 0000000000000000000000000000000000000000..7fbbf0b2200394a9da538f69bb8e940148d5b772 GIT binary patch literal 2272 zcmV<62p{)}P)w{Op0wQfe5cRJbH8G0v5KTx7mGTf25qyv!MjnZYQr-p$qG+ig z?}8!;8jQTun3x#iA10uvfof@_Ac**YUa!}?^Y{DB%Y(EYRzNr5s!4DsM8KxL00cl?cF5+Xpv+fSY4B zs?;Qkv90KqijdQ>do$8jP|ujeBz(gn(n{gw4EKIgT8Ku}r1 z1h>HEnkGQ0(^0JioDHa>WK?WS1J6(m6e|y{?~8I3RE1|4A?DERIlDA*bR?Lz{OkkyY`?#Rlt>EO_fW9`=GnZr_bf0 zDoMQznba$5hRY=lUDCs#eDDMCPVFYh;18xBok5TFURDM@0*jSFIj2Qg_4$WR*z>oe z=ixmooq}h|?|^=5mh#wwg{3ZFgh~n~*j!^j$O_awQmGEpu>c8_`ySXr$rhZPI6^46 z_tt&vvj#u|w6^#eswUN&3!`o`tvLwvqEK&4s+eJu7jrED+xEk7*U&p*!SX5ui>sD} z3m6sxZCnVJ0ZPCGlFH8dZ=JBOq6M(B^EEJk*%~-p_dZNqx|PRXT2g92C9n**lUVQ+ zDBW)zMM_|1U#i!EixZ`Rrb#(9K>{w?hJc*~O+j;k^Wvw2b=sauQH!L^I_zW`!3x#J zF1l8sEQ0~#SUmP5+&gp-R4si;DA+~?d*LD^21^Pi^)hS$_`Qbj+qIHKFPAuqjcah@ z2$?br1aRU5j z;dBPPaPf<-MUaB&qMEFM0aJ}ds+iz%8_T^imLfXffaU+FAbl<+$UEtaUE!3=XWnI~Nn-;g2gv<7T3g*6quG_}Bt`cz7 zJXEi=2q25__^|R{&4-oevZ7P1jt9?OQ3IbI{th}{sBz(<9gr==v5q5Tf=)H{E&SIQ z3zwE91gX=!7p&&9k4V7Xb`W5%f@NMD;KjaJJp+;PR!S;YgG>r0$gFAxExh@cq8Y4U zl>t=r8R%Msf~*!eQZU;Ds#n>Cvq>4{D~Fo@a$QexZS&2bSgCgZoUql5=v_g=7q+lD9>J!eupfE}P0 zOuz*S`h^Tk-QWjY*{zsUv>j&}80@$n3b1@mW)%};l~G_OL4CFc2^#w^yuO72_h=-* z(rW{t3fN+t7di=t6llT@?)&3hrJpwdXZzcG!1vL1Z-DL7z(3&VpIq>1>r8+durH5IcZE_Tx<#kz2P zS$Qz0X(410D!XXxH3eo?S1}m1E0$H(o`E5=CV_n+`&MObMc?qVh_LhE^F`w!o?F;a zrcPY8+*$vk{lj`f{SC2j^WdDGia7(s6I~d45n=A8%^LkC z*qHk&#RdT$KCn0JN4Ru(#}&Y~{AJa1H-@{L7S?|7$N?*y*F*$Z!BabwUTeq(k*p%y z75iu(Z2M*x9F2b#-hOacZ!{K_ztQf(){*ye^e)e< + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/kissingcomputer.png b/public/kissingcomputer.png new file mode 100644 index 0000000000000000000000000000000000000000..21defce9271adbff80b5b8c6f35f1f28a1b75bea GIT binary patch literal 11002 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 literal 0 HcmV?d00001 diff --git a/public/robots.txt b/public/robots.txt new file mode 100644 index 0000000..c19f78a --- /dev/null +++ b/public/robots.txt @@ -0,0 +1 @@ +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file diff --git a/public/updates.html b/public/updates.html new file mode 100644 index 0000000..557ae63 --- /dev/null +++ b/public/updates.html @@ -0,0 +1,10 @@ + + + + + +UPDATES: added guestbook, more widgets diff --git a/script/.keep b/script/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb new file mode 100644 index 0000000..cee29fd --- /dev/null +++ b/test/application_system_test_case.rb @@ -0,0 +1,5 @@ +require "test_helper" + +class ApplicationSystemTestCase < ActionDispatch::SystemTestCase + driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ] +end diff --git a/test/controllers/.keep b/test/controllers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/controllers/articles_controller_test.rb b/test/controllers/articles_controller_test.rb new file mode 100644 index 0000000..0a82cbb --- /dev/null +++ b/test/controllers/articles_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ArticlesControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/blogmap_controller_test.rb b/test/controllers/blogmap_controller_test.rb new file mode 100644 index 0000000..93a5afc --- /dev/null +++ b/test/controllers/blogmap_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class BlogmapControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/blogs_controller_test.rb b/test/controllers/blogs_controller_test.rb new file mode 100644 index 0000000..b8c1554 --- /dev/null +++ b/test/controllers/blogs_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class BlogsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/comments_controller_test.rb b/test/controllers/comments_controller_test.rb new file mode 100644 index 0000000..3f25e01 --- /dev/null +++ b/test/controllers/comments_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class CommentsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/lists_controller_test.rb b/test/controllers/lists_controller_test.rb new file mode 100644 index 0000000..e7081e3 --- /dev/null +++ b/test/controllers/lists_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ListsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/members_controller_test.rb b/test/controllers/members_controller_test.rb new file mode 100644 index 0000000..d355b39 --- /dev/null +++ b/test/controllers/members_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class MembersControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/pages_controller_test.rb b/test/controllers/pages_controller_test.rb new file mode 100644 index 0000000..257c27c --- /dev/null +++ b/test/controllers/pages_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class PagesControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/passwords_controller_test.rb b/test/controllers/passwords_controller_test.rb new file mode 100644 index 0000000..e1a1b03 --- /dev/null +++ b/test/controllers/passwords_controller_test.rb @@ -0,0 +1,67 @@ +require "test_helper" + +class PasswordsControllerTest < ActionDispatch::IntegrationTest + setup { @user = User.take } + + test "new" do + get new_password_path + assert_response :success + end + + test "create" do + post passwords_path, params: { email_address: @user.email_address } + assert_enqueued_email_with PasswordsMailer, :reset, args: [ @user ] + assert_redirected_to new_session_path + + follow_redirect! + assert_notice "reset instructions sent" + end + + test "create for an unknown user redirects but sends no mail" do + post passwords_path, params: { email_address: "missing-user@example.com" } + assert_enqueued_emails 0 + assert_redirected_to new_session_path + + follow_redirect! + assert_notice "reset instructions sent" + end + + test "edit" do + get edit_password_path(@user.password_reset_token) + assert_response :success + end + + test "edit with invalid password reset token" do + get edit_password_path("invalid token") + assert_redirected_to new_password_path + + follow_redirect! + assert_notice "reset link is invalid" + end + + test "update" do + assert_changes -> { @user.reload.password_digest } do + put password_path(@user.password_reset_token), params: { password: "new", password_confirmation: "new" } + assert_redirected_to new_session_path + end + + follow_redirect! + assert_notice "Password has been reset" + end + + test "update with non matching passwords" do + token = @user.password_reset_token + assert_no_changes -> { @user.reload.password_digest } do + put password_path(token), params: { password: "no", password_confirmation: "match" } + assert_redirected_to edit_password_path(token) + end + + follow_redirect! + assert_notice "Passwords did not match" + end + + private + def assert_notice(text) + assert_select "div", /#{text}/ + end +end diff --git a/test/controllers/posts_controller_test.rb b/test/controllers/posts_controller_test.rb new file mode 100644 index 0000000..9034df0 --- /dev/null +++ b/test/controllers/posts_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class PostsControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/profiles_controller_test.rb b/test/controllers/profiles_controller_test.rb new file mode 100644 index 0000000..2c4ab0b --- /dev/null +++ b/test/controllers/profiles_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ProfilesControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/sessions_controller_test.rb b/test/controllers/sessions_controller_test.rb new file mode 100644 index 0000000..07d72ef --- /dev/null +++ b/test/controllers/sessions_controller_test.rb @@ -0,0 +1,33 @@ +require "test_helper" + +class SessionsControllerTest < ActionDispatch::IntegrationTest + setup { @user = User.take } + + test "new" do + get new_session_path + assert_response :success + end + + test "create with valid credentials" do + post session_path, params: { email_address: @user.email_address, password: "password" } + + assert_redirected_to root_path + assert cookies[:session_id] + end + + test "create with invalid credentials" do + post session_path, params: { email_address: @user.email_address, password: "wrong" } + + assert_redirected_to new_session_path + assert_nil cookies[:session_id] + end + + test "destroy" do + sign_in_as(User.take) + + delete session_path + + assert_redirected_to new_session_path + assert_empty cookies[:session_id] + end +end diff --git a/test/controllers/sitemap_controller_test.rb b/test/controllers/sitemap_controller_test.rb new file mode 100644 index 0000000..fc8e5ac --- /dev/null +++ b/test/controllers/sitemap_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class SitemapControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/updates_controller_test.rb b/test/controllers/updates_controller_test.rb new file mode 100644 index 0000000..6298412 --- /dev/null +++ b/test/controllers/updates_controller_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class UpdatesControllerTest < ActionDispatch::IntegrationTest + # test "the truth" do + # assert true + # end +end diff --git a/test/controllers/welcome_controller_test.rb b/test/controllers/welcome_controller_test.rb new file mode 100644 index 0000000..76c560c --- /dev/null +++ b/test/controllers/welcome_controller_test.rb @@ -0,0 +1,8 @@ +require "test_helper" + +class WelcomeControllerTest < ActionDispatch::IntegrationTest + test "should get index" do + get welcome_index_url + assert_response :success + end +end diff --git a/test/fixtures/action_text/rich_texts.yml b/test/fixtures/action_text/rich_texts.yml new file mode 100644 index 0000000..8b371ea --- /dev/null +++ b/test/fixtures/action_text/rich_texts.yml @@ -0,0 +1,4 @@ +# one: +# record: name_of_fixture (ClassOfFixture) +# name: content +# body:

    In a million stars!

    diff --git a/test/fixtures/articles.yml b/test/fixtures/articles.yml new file mode 100644 index 0000000..67df8c2 --- /dev/null +++ b/test/fixtures/articles.yml @@ -0,0 +1,13 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + title: MyString + text: MyText + mood: MyText + music: MyText + +two: + title: MyString + text: MyText + mood: MyText + music: MyText diff --git a/test/fixtures/blogmaps.yml b/test/fixtures/blogmaps.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/blogmaps.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/blogs.yml b/test/fixtures/blogs.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/blogs.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/comments.yml b/test/fixtures/comments.yml new file mode 100644 index 0000000..0deb955 --- /dev/null +++ b/test/fixtures/comments.yml @@ -0,0 +1,13 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + commenter: MyString + website: MyString + body: MyText + article: one + +two: + commenter: MyString + website: MyString + body: MyText + article: two diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/fixtures/lists.yml b/test/fixtures/lists.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/lists.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/members.yml b/test/fixtures/members.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/members.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/pages.yml b/test/fixtures/pages.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/pages.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/posts.yml b/test/fixtures/posts.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/posts.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/profiles.yml b/test/fixtures/profiles.yml new file mode 100644 index 0000000..35c3c34 --- /dev/null +++ b/test/fixtures/profiles.yml @@ -0,0 +1,15 @@ +# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html + +one: + bio: MyText + avatar: MyString + location: MyString + website: MyString + user: one + +two: + bio: MyText + avatar: MyString + location: MyString + website: MyString + user: two diff --git a/test/fixtures/sitemaps.yml b/test/fixtures/sitemaps.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/sitemaps.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/updates.yml b/test/fixtures/updates.yml new file mode 100644 index 0000000..d7a3329 --- /dev/null +++ b/test/fixtures/updates.yml @@ -0,0 +1,11 @@ +# 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 diff --git a/test/fixtures/users.yml b/test/fixtures/users.yml new file mode 100644 index 0000000..0951563 --- /dev/null +++ b/test/fixtures/users.yml @@ -0,0 +1,9 @@ +<% password_digest = BCrypt::Password.create("password") %> + +one: + email_address: one@example.com + password_digest: <%= password_digest %> + +two: + email_address: two@example.com + password_digest: <%= password_digest %> diff --git a/test/helpers/.keep b/test/helpers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/integration/.keep b/test/integration/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/mailers/.keep b/test/mailers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/mailers/previews/passwords_mailer_preview.rb b/test/mailers/previews/passwords_mailer_preview.rb new file mode 100644 index 0000000..01d07ec --- /dev/null +++ b/test/mailers/previews/passwords_mailer_preview.rb @@ -0,0 +1,7 @@ +# Preview all emails at http://localhost:3000/rails/mailers/passwords_mailer +class PasswordsMailerPreview < ActionMailer::Preview + # Preview this email at http://localhost:3000/rails/mailers/passwords_mailer/reset + def reset + PasswordsMailer.reset(User.take) + end +end diff --git a/test/models/.keep b/test/models/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/models/article_test.rb b/test/models/article_test.rb new file mode 100644 index 0000000..9c9ba95 --- /dev/null +++ b/test/models/article_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ArticleTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/blog_test.rb b/test/models/blog_test.rb new file mode 100644 index 0000000..0bef141 --- /dev/null +++ b/test/models/blog_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class BlogTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/blogmap_test.rb b/test/models/blogmap_test.rb new file mode 100644 index 0000000..760005a --- /dev/null +++ b/test/models/blogmap_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class BlogmapTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/comment_test.rb b/test/models/comment_test.rb new file mode 100644 index 0000000..5a6feda --- /dev/null +++ b/test/models/comment_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class CommentTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/list_test.rb b/test/models/list_test.rb new file mode 100644 index 0000000..042a894 --- /dev/null +++ b/test/models/list_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ListTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/member_test.rb b/test/models/member_test.rb new file mode 100644 index 0000000..4fec230 --- /dev/null +++ b/test/models/member_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class MemberTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/page_test.rb b/test/models/page_test.rb new file mode 100644 index 0000000..fa25544 --- /dev/null +++ b/test/models/page_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class PageTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/post_test.rb b/test/models/post_test.rb new file mode 100644 index 0000000..ff155c4 --- /dev/null +++ b/test/models/post_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class PostTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/profile_test.rb b/test/models/profile_test.rb new file mode 100644 index 0000000..701636f --- /dev/null +++ b/test/models/profile_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class ProfileTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/sitemap_test.rb b/test/models/sitemap_test.rb new file mode 100644 index 0000000..8eb6b39 --- /dev/null +++ b/test/models/sitemap_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class SitemapTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/update_test.rb b/test/models/update_test.rb new file mode 100644 index 0000000..27bc4e9 --- /dev/null +++ b/test/models/update_test.rb @@ -0,0 +1,7 @@ +require "test_helper" + +class UpdateTest < ActiveSupport::TestCase + # test "the truth" do + # assert true + # end +end diff --git a/test/models/user_test.rb b/test/models/user_test.rb new file mode 100644 index 0000000..83445c4 --- /dev/null +++ b/test/models/user_test.rb @@ -0,0 +1,8 @@ +require "test_helper" + +class UserTest < ActiveSupport::TestCase + test "downcases and strips email_address" do + user = User.new(email_address: " DOWNCASED@EXAMPLE.COM ") + assert_equal("downcased@example.com", user.email_address) + end +end diff --git a/test/system/.keep b/test/system/.keep new file mode 100644 index 0000000..e69de29 diff --git a/test/test_helper.rb b/test/test_helper.rb new file mode 100644 index 0000000..85c54c6 --- /dev/null +++ b/test/test_helper.rb @@ -0,0 +1,16 @@ +ENV["RAILS_ENV"] ||= "test" +require_relative "../config/environment" +require "rails/test_help" +require_relative "test_helpers/session_test_helper" + +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 diff --git a/test/test_helpers/session_test_helper.rb b/test/test_helpers/session_test_helper.rb new file mode 100644 index 0000000..0686378 --- /dev/null +++ b/test/test_helpers/session_test_helper.rb @@ -0,0 +1,19 @@ +module SessionTestHelper + def sign_in_as(user) + Current.session = user.sessions.create! + + ActionDispatch::TestRequest.create.cookie_jar.tap do |cookie_jar| + cookie_jar.signed[:session_id] = Current.session.id + cookies["session_id"] = cookie_jar[:session_id] + end + end + + def sign_out + Current.session&.destroy! + cookies.delete("session_id") + end +end + +ActiveSupport.on_load(:action_dispatch_integration_test) do + include SessionTestHelper +end diff --git a/tmp/.keep b/tmp/.keep new file mode 100644 index 0000000..e69de29 diff --git a/tmp/pids/.keep b/tmp/pids/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/.keep b/vendor/.keep new file mode 100644 index 0000000..e69de29 diff --git a/vendor/javascript/.keep b/vendor/javascript/.keep new file mode 100644 index 0000000..e69de29