Initial commit

Seto Elkahfi committed Apr 11, 2026 at 15:37 UTC 80e971239b2fc0dc4863172d597d786871cae29b
112 files changed +5598
.dockerignore new
+51
@@ -0,0 +1,51 @@
1 +# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2 +
3 +# Ignore git directory.
4 +/.git/
5 +/.gitignore
6 +
7 +# Ignore bundler config.
8 +/.bundle
9 +
10 +# Ignore all environment files.
11 +/.env*
12 +
13 +# Ignore all default key files.
14 +/config/master.key
15 +/config/credentials/*.key
16 +
17 +# Ignore all logfiles and tempfiles.
18 +/log/*
19 +/tmp/*
20 +!/log/.keep
21 +!/tmp/.keep
22 +
23 +# Ignore pidfiles, but keep the directory.
24 +/tmp/pids/*
25 +!/tmp/pids/.keep
26 +
27 +# Ignore storage (uploaded files in development and any SQLite databases).
28 +/storage/*
29 +!/storage/.keep
30 +/tmp/storage/*
31 +!/tmp/storage/.keep
32 +
33 +# Ignore assets.
34 +/node_modules/
35 +/app/assets/builds/*
36 +!/app/assets/builds/.keep
37 +/public/assets
38 +
39 +# Ignore CI service files.
40 +/.github
41 +
42 +# Ignore Kamal files.
43 +/config/deploy*.yml
44 +/.kamal
45 +
46 +# Ignore development files
47 +/.devcontainer
48 +
49 +# Ignore Docker-related files
50 +/.dockerignore
51 +/Dockerfile*
.env.example new
+70
@@ -0,0 +1,70 @@
1 +# =============================================================================
2 +# siGit si — Environment Variables
3 +# Copy this file to .env and fill in the values before running the app.
4 +#
5 +# cp .env.example .env
6 +#
7 +# .env is git-ignored. Never commit real secrets.
8 +# =============================================================================
9 +
10 +
11 +# -----------------------------------------------------------------------------
12 +# smbCloud Auth (required)
13 +# Register your application at https://smbcloud.xyz to obtain these values.
14 +# -----------------------------------------------------------------------------
15 +
16 +# Your smbCloud app identifier
17 +SMBCLOUD_APP_ID=your-app-id-here
18 +
19 +# Your smbCloud app secret
20 +SMBCLOUD_APP_SECRET=your-app-secret-here
21 +
22 +# Auth environment: "production" (default) or "dev" (local smbCloud Auth server)
23 +SMBCLOUD_ENVIRONMENT=production
24 +
25 +
26 +# -----------------------------------------------------------------------------
27 +# Database (PostgreSQL)
28 +# The defaults below work with a local Postgres.app installation.
29 +# -----------------------------------------------------------------------------
30 +
31 +# Full connection URL takes precedence over individual vars when set.
32 +# DATABASE_URL=postgres://sigitsi:password@localhost/sigitsi_development
33 +
34 +# Individual vars (used when DATABASE_URL is not set)
35 +# DB_HOST=localhost
36 +# DB_PORT=5432
37 +# DB_USERNAME=sigitsi
38 +# DB_PASSWORD=
39 +
40 +
41 +# -----------------------------------------------------------------------------
42 +# Git repository storage
43 +# Bare repos are stored under this directory, organised as:
44 +# <SIGITSI_REPOS_PATH>/<username>/<reponame>.git
45 +#
46 +# Defaults to Rails.root/repos when not set.
47 +# -----------------------------------------------------------------------------
48 +
49 +# SIGITSI_REPOS_PATH=/var/sigitsi/repos
50 +
51 +
52 +# -----------------------------------------------------------------------------
53 +# Rails
54 +# -----------------------------------------------------------------------------
55 +
56 +# Must be set to a long random string in production.
57 +# Generate one with: bin/rails secret
58 +SECRET_KEY_BASE=
59 +
60 +# "development", "test", or "production"
61 +RAILS_ENV=development
62 +
63 +# Number of Puma threads (also controls DB connection pool size)
64 +RAILS_MAX_THREADS=5
65 +
66 +# Set to "1" to serve static files from public/ in production
67 +# RAILS_SERVE_STATIC_FILES=1
68 +
69 +# Set to "1" to write logs to stdout in production (recommended for containers)
70 +# RAILS_LOG_TO_STDOUT=1
.github/dependabot.yml new
+12
@@ -0,0 +1,12 @@
1 +version: 2
2 +updates:
3 +- package-ecosystem: bundler
4 + directory: "/"
5 + schedule:
6 + interval: weekly
7 + open-pull-requests-limit: 10
8 +- package-ecosystem: github-actions
9 + directory: "/"
10 + schedule:
11 + interval: weekly
12 + open-pull-requests-limit: 10
.github/workflows/ci.yml new
+67
@@ -0,0 +1,67 @@
1 +name: CI
2 +
3 +on:
4 + pull_request:
5 + push:
6 + branches: [ main ]
7 +
8 +jobs:
9 + scan_ruby:
10 + runs-on: ubuntu-latest
11 +
12 + steps:
13 + - name: Checkout code
14 + uses: actions/checkout@v6
15 +
16 + - name: Set up Ruby
17 + uses: ruby/setup-ruby@v1
18 + with:
19 + bundler-cache: true
20 +
21 + - name: Scan for common Rails security vulnerabilities using static analysis
22 + run: bin/brakeman --no-pager
23 +
24 + - name: Scan for known security vulnerabilities in gems used
25 + run: bin/bundler-audit
26 +
27 + scan_js:
28 + runs-on: ubuntu-latest
29 +
30 + steps:
31 + - name: Checkout code
32 + uses: actions/checkout@v6
33 +
34 + - name: Set up Ruby
35 + uses: ruby/setup-ruby@v1
36 + with:
37 + bundler-cache: true
38 +
39 + - name: Scan for security vulnerabilities in JavaScript dependencies
40 + run: bin/importmap audit
41 +
42 + lint:
43 + runs-on: ubuntu-latest
44 + env:
45 + RUBOCOP_CACHE_ROOT: tmp/rubocop
46 + steps:
47 + - name: Checkout code
48 + uses: actions/checkout@v6
49 +
50 + - name: Set up Ruby
51 + uses: ruby/setup-ruby@v1
52 + with:
53 + bundler-cache: true
54 +
55 + - name: Prepare RuboCop cache
56 + uses: actions/cache@v4
57 + env:
58 + DEPENDENCIES_HASH: ${{ hashFiles('.ruby-version', '**/.rubocop.yml', '**/.rubocop_todo.yml', 'Gemfile.lock') }}
59 + with:
60 + path: ${{ env.RUBOCOP_CACHE_ROOT }}
61 + key: rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-${{ github.ref_name == github.event.repository.default_branch && github.run_id || 'default' }}
62 + restore-keys: |
63 + rubocop-${{ runner.os }}-${{ env.DEPENDENCIES_HASH }}-
64 +
65 + - name: Lint code for consistent style
66 + run: bin/rubocop -f github
67 +
.gitignore new
+38
@@ -0,0 +1,38 @@
1 +# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 +
3 +# Ignore bundler config.
4 +/.bundle
5 +
6 +# Ignore all environment files.
7 +/.env*
8 +!/.env.example
9 +
10 +# Ignore all default key files.
11 +/config/master.key
12 +/config/credentials/*.key
13 +
14 +# Ignore all logfiles and tempfiles.
15 +/log/*
16 +/tmp/*
17 +!/log/.keep
18 +!/tmp/.keep
19 +
20 +# Ignore pidfiles, but keep the directory.
21 +/tmp/pids/*
22 +!/tmp/pids/.keep
23 +
24 +# Ignore storage (uploaded files in development and any SQLite databases).
25 +/storage/*
26 +!/storage/.keep
27 +/tmp/storage/*
28 +!/tmp/storage/.keep
29 +
30 +# Ignore precompiled assets (rebuild with `rails assets:precompile`).
31 +/public/assets
32 +
33 +# Ignore Tailwind CSS build output (rebuild with `rails tailwindcss:build`).
34 +/app/assets/builds/*
35 +!/app/assets/builds/.keep
36 +
37 +# Ignore node_modules.
38 +/node_modules/
.rubocop.yml new
+8
@@ -0,0 +1,8 @@
1 +# Omakase Ruby styling for Rails
2 +inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3 +
4 +# Overwrite or add rules to create your own house style
5 +#
6 +# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7 +# Layout/SpaceInsideArrayLiteralBrackets:
8 +# Enabled: false
.ruby-version new
+1
@@ -0,0 +1 @@
1 +ruby-3.4.2
Dockerfile new
+77
@@ -0,0 +1,77 @@
1 +# syntax=docker/dockerfile:1
2 +# check=error=true
3 +
4 +# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
5 +# docker build -t sigitsi .
6 +# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name sigitsi sigitsi
7 +
8 +# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
9 +
10 +# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
11 +ARG RUBY_VERSION=3.4.2
12 +FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
13 +
14 +# Rails app lives here
15 +WORKDIR /rails
16 +
17 +# Install base packages
18 +RUN apt-get update -qq && \
19 + apt-get install --no-install-recommends -y curl libjemalloc2 libvips postgresql-client && \
20 + ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so && \
21 + rm -rf /var/lib/apt/lists /var/cache/apt/archives
22 +
23 +# Set production environment variables and enable jemalloc for reduced memory usage and latency.
24 +ENV RAILS_ENV="production" \
25 + BUNDLE_DEPLOYMENT="1" \
26 + BUNDLE_PATH="/usr/local/bundle" \
27 + BUNDLE_WITHOUT="development" \
28 + LD_PRELOAD="/usr/local/lib/libjemalloc.so"
29 +
30 +# Throw-away build stage to reduce size of final image
31 +FROM base AS build
32 +
33 +# Install packages needed to build gems
34 +RUN apt-get update -qq && \
35 + apt-get install --no-install-recommends -y build-essential git libpq-dev libvips libyaml-dev pkg-config && \
36 + rm -rf /var/lib/apt/lists /var/cache/apt/archives
37 +
38 +# Install application gems
39 +COPY vendor/* ./vendor/
40 +COPY Gemfile Gemfile.lock ./
41 +
42 +RUN bundle install && \
43 + rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
44 + # -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
45 + bundle exec bootsnap precompile -j 1 --gemfile
46 +
47 +# Copy application code
48 +COPY . .
49 +
50 +# Precompile bootsnap code for faster boot times.
51 +# -j 1 disable parallel compilation to avoid a QEMU bug: https://github.com/rails/bootsnap/issues/495
52 +RUN bundle exec bootsnap precompile -j 1 app/ lib/
53 +
54 +# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
55 +RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
56 +
57 +
58 +
59 +
60 +# Final stage for app image
61 +FROM base
62 +
63 +# Run and own only the runtime files as a non-root user for security
64 +RUN groupadd --system --gid 1000 rails && \
65 + useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash
66 +USER 1000:1000
67 +
68 +# Copy built artifacts: gems, application
69 +COPY --chown=rails:rails --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
70 +COPY --chown=rails:rails --from=build /rails /rails
71 +
72 +# Entrypoint prepares the database.
73 +ENTRYPOINT ["/rails/bin/docker-entrypoint"]
74 +
75 +# Start server via Thruster by default, this can be overwritten at runtime
76 +EXPOSE 80
77 +CMD ["./bin/thrust", "./bin/rails", "server"]
Gemfile new
+71
@@ -0,0 +1,71 @@
1 +source "https://rubygems.org"
2 +
3 +# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
4 +gem "rails", "~> 8.1.3"
5 +# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
6 +gem "propshaft"
7 +# Use postgresql as the database for Active Record
8 +gem "pg", "~> 1.1"
9 +# Use the Puma web server [https://github.com/puma/puma]
10 +gem "puma", ">= 5.0"
11 +# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
12 +gem "importmap-rails"
13 +# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
14 +gem "turbo-rails"
15 +# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
16 +gem "stimulus-rails"
17 +# Use Tailwind CSS [https://github.com/rails/tailwindcss-rails]
18 +gem "tailwindcss-rails"
19 +# Build JSON APIs with ease [https://github.com/rails/jbuilder]
20 +gem "jbuilder"
21 +
22 +# smbCloud Auth — native Rust/Magnus extension for login, signup, me, logout
23 +gem "smbcloud-auth", path: "../smbcloud-cli/sdk/gems/auth"
24 +
25 +# Markdown rendering for README files
26 +gem "redcarpet", "~> 3.6"
27 +
28 +# Syntax highlighting for code files
29 +gem "rouge", "~> 4.5"
30 +
31 +# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
32 +# gem "bcrypt", "~> 3.1.7"
33 +
34 +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
35 +gem "tzinfo-data", platforms: %i[ windows jruby ]
36 +
37 +# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
38 +gem "solid_cache"
39 +gem "solid_queue"
40 +gem "solid_cable"
41 +
42 +# Reduces boot times through caching; required in config/boot.rb
43 +gem "bootsnap", require: false
44 +
45 +# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
46 +gem "kamal", require: false
47 +
48 +# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
49 +gem "thruster", require: false
50 +
51 +# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
52 +gem "image_processing", "~> 1.2"
53 +
54 +group :development, :test do
55 + # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
56 + gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
57 +
58 + # Audits gems for known security defects (use config/bundler-audit.yml to ignore issues)
59 + gem "bundler-audit", require: false
60 +
61 + # Static analysis for security vulnerabilities [https://brakemanscanner.org/]
62 + gem "brakeman", require: false
63 +
64 + # Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
65 + gem "rubocop-rails-omakase", require: false
66 +end
67 +
68 +group :development do
69 + # Use console on exceptions pages [https://github.com/rails/web-console]
70 + gem "web-console"
71 +end
Gemfile.lock new
+377
@@ -0,0 +1,377 @@
1 +PATH
2 + remote: ../smbcloud-cli/sdk/gems/auth
3 + specs:
4 + smbcloud-auth (0.3.33)
5 + json
6 + rb_sys (~> 0.9.91)
7 +
8 +GEM
9 + remote: https://rubygems.org/
10 + specs:
11 + action_text-trix (2.1.18)
12 + railties
13 + actioncable (8.1.3)
14 + actionpack (= 8.1.3)
15 + activesupport (= 8.1.3)
16 + nio4r (~> 2.0)
17 + websocket-driver (>= 0.6.1)
18 + zeitwerk (~> 2.6)
19 + actionmailbox (8.1.3)
20 + actionpack (= 8.1.3)
21 + activejob (= 8.1.3)
22 + activerecord (= 8.1.3)
23 + activestorage (= 8.1.3)
24 + activesupport (= 8.1.3)
25 + mail (>= 2.8.0)
26 + actionmailer (8.1.3)
27 + actionpack (= 8.1.3)
28 + actionview (= 8.1.3)
29 + activejob (= 8.1.3)
30 + activesupport (= 8.1.3)
31 + mail (>= 2.8.0)
32 + rails-dom-testing (~> 2.2)
33 + actionpack (8.1.3)
34 + actionview (= 8.1.3)
35 + activesupport (= 8.1.3)
36 + nokogiri (>= 1.8.5)
37 + rack (>= 2.2.4)
38 + rack-session (>= 1.0.1)
39 + rack-test (>= 0.6.3)
40 + rails-dom-testing (~> 2.2)
41 + rails-html-sanitizer (~> 1.6)
42 + useragent (~> 0.16)
43 + actiontext (8.1.3)
44 + action_text-trix (~> 2.1.15)
45 + actionpack (= 8.1.3)
46 + activerecord (= 8.1.3)
47 + activestorage (= 8.1.3)
48 + activesupport (= 8.1.3)
49 + globalid (>= 0.6.0)
50 + nokogiri (>= 1.8.5)
51 + actionview (8.1.3)
52 + activesupport (= 8.1.3)
53 + builder (~> 3.1)
54 + erubi (~> 1.11)
55 + rails-dom-testing (~> 2.2)
56 + rails-html-sanitizer (~> 1.6)
57 + activejob (8.1.3)
58 + activesupport (= 8.1.3)
59 + globalid (>= 0.3.6)
60 + activemodel (8.1.3)
61 + activesupport (= 8.1.3)
62 + activerecord (8.1.3)
63 + activemodel (= 8.1.3)
64 + activesupport (= 8.1.3)
65 + timeout (>= 0.4.0)
66 + activestorage (8.1.3)
67 + actionpack (= 8.1.3)
68 + activejob (= 8.1.3)
69 + activerecord (= 8.1.3)
70 + activesupport (= 8.1.3)
71 + marcel (~> 1.0)
72 + activesupport (8.1.3)
73 + base64
74 + bigdecimal
75 + concurrent-ruby (~> 1.0, >= 1.3.1)
76 + connection_pool (>= 2.2.5)
77 + drb
78 + i18n (>= 1.6, < 2)
79 + json
80 + logger (>= 1.4.2)
81 + minitest (>= 5.1)
82 + securerandom (>= 0.3)
83 + tzinfo (~> 2.0, >= 2.0.5)
84 + uri (>= 0.13.1)
85 + ast (2.4.3)
86 + base64 (0.3.0)
87 + bcrypt_pbkdf (1.1.2)
88 + bigdecimal (4.1.1)
89 + bindex (0.8.1)
90 + bootsnap (1.23.0)
91 + msgpack (~> 1.2)
92 + brakeman (8.0.4)
93 + racc
94 + builder (3.3.0)
95 + bundler-audit (0.9.3)
96 + bundler (>= 1.2.0)
97 + thor (~> 1.0)
98 + concurrent-ruby (1.3.6)
99 + connection_pool (3.0.2)
100 + crass (1.0.6)
101 + date (3.5.1)
102 + debug (1.11.1)
103 + irb (~> 1.10)
104 + reline (>= 0.3.8)
105 + dotenv (3.2.0)
106 + drb (2.2.3)
107 + ed25519 (1.4.0)
108 + erb (6.0.2)
109 + erubi (1.13.1)
110 + et-orbi (1.4.0)
111 + tzinfo
112 + ffi (1.17.4-arm64-darwin)
113 + fugit (1.12.1)
114 + et-orbi (~> 1.4)
115 + raabro (~> 1.4)
116 + globalid (1.3.0)
117 + activesupport (>= 6.1)
118 + i18n (1.14.8)
119 + concurrent-ruby (~> 1.0)
120 + image_processing (1.14.0)
121 + mini_magick (>= 4.9.5, < 6)
122 + ruby-vips (>= 2.0.17, < 3)
123 + importmap-rails (2.2.3)
124 + actionpack (>= 6.0.0)
125 + activesupport (>= 6.0.0)
126 + railties (>= 6.0.0)
127 + io-console (0.8.2)
128 + irb (1.17.0)
129 + pp (>= 0.6.0)
130 + prism (>= 1.3.0)
131 + rdoc (>= 4.0.0)
132 + reline (>= 0.4.2)
133 + jbuilder (2.14.1)
134 + actionview (>= 7.0.0)
135 + activesupport (>= 7.0.0)
136 + json (2.19.3)
137 + kamal (2.11.0)
138 + activesupport (>= 7.0)
139 + base64 (~> 0.2)
140 + bcrypt_pbkdf (~> 1.0)
141 + concurrent-ruby (~> 1.2)
142 + dotenv (~> 3.1)
143 + ed25519 (~> 1.4)
144 + net-ssh (~> 7.3)
145 + sshkit (>= 1.23.0, < 2.0)
146 + thor (~> 1.3)
147 + zeitwerk (>= 2.6.18, < 3.0)
148 + language_server-protocol (3.17.0.5)
149 + lint_roller (1.1.0)
150 + logger (1.7.0)
151 + loofah (2.25.1)
152 + crass (~> 1.0.2)
153 + nokogiri (>= 1.12.0)
154 + mail (2.9.0)
155 + logger
156 + mini_mime (>= 0.1.1)
157 + net-imap
158 + net-pop
159 + net-smtp
160 + marcel (1.1.0)
161 + mini_magick (5.3.1)
162 + logger
163 + mini_mime (1.1.5)
164 + minitest (6.0.3)
165 + drb (~> 2.0)
166 + prism (~> 1.5)
167 + msgpack (1.8.0)
168 + net-imap (0.6.3)
169 + date
170 + net-protocol
171 + net-pop (0.1.2)
172 + net-protocol
173 + net-protocol (0.2.2)
174 + timeout
175 + net-scp (4.1.0)
176 + net-ssh (>= 2.6.5, < 8.0.0)
177 + net-sftp (4.0.0)
178 + net-ssh (>= 5.0.0, < 8.0.0)
179 + net-smtp (0.5.1)
180 + net-protocol
181 + net-ssh (7.3.2)
182 + nio4r (2.7.5)
183 + nokogiri (1.19.2-arm64-darwin)
184 + racc (~> 1.4)
185 + ostruct (0.6.3)
186 + parallel (2.0.1)
187 + parser (3.3.11.1)
188 + ast (~> 2.4.1)
189 + racc
190 + pg (1.6.3-arm64-darwin)
191 + pp (0.6.3)
192 + prettyprint
193 + prettyprint (0.2.0)
194 + prism (1.9.0)
195 + propshaft (1.3.1)
196 + actionpack (>= 7.0.0)
197 + activesupport (>= 7.0.0)
198 + rack
199 + psych (5.3.1)
200 + date
201 + stringio
202 + puma (8.0.0)
203 + nio4r (~> 2.0)
204 + raabro (1.4.0)
205 + racc (1.8.1)
206 + rack (3.2.6)
207 + rack-session (2.1.2)
208 + base64 (>= 0.1.0)
209 + rack (>= 3.0.0)
210 + rack-test (2.2.0)
211 + rack (>= 1.3)
212 + rackup (2.3.1)
213 + rack (>= 3)
214 + rails (8.1.3)
215 + actioncable (= 8.1.3)
216 + actionmailbox (= 8.1.3)
217 + actionmailer (= 8.1.3)
218 + actionpack (= 8.1.3)
219 + actiontext (= 8.1.3)
220 + actionview (= 8.1.3)
221 + activejob (= 8.1.3)
222 + activemodel (= 8.1.3)
223 + activerecord (= 8.1.3)
224 + activestorage (= 8.1.3)
225 + activesupport (= 8.1.3)
226 + bundler (>= 1.15.0)
227 + railties (= 8.1.3)
228 + rails-dom-testing (2.3.0)
229 + activesupport (>= 5.0.0)
230 + minitest
231 + nokogiri (>= 1.6)
232 + rails-html-sanitizer (1.7.0)
233 + loofah (~> 2.25)
234 + 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)
235 + railties (8.1.3)
236 + actionpack (= 8.1.3)
237 + activesupport (= 8.1.3)
238 + irb (~> 1.13)
239 + rackup (>= 1.0.0)
240 + rake (>= 12.2)
241 + thor (~> 1.0, >= 1.2.2)
242 + tsort (>= 0.2)
243 + zeitwerk (~> 2.6)
244 + rainbow (3.1.1)
245 + rake (13.3.1)
246 + rake-compiler-dock (1.11.0)
247 + rb_sys (0.9.126)
248 + json (>= 2)
249 + rake-compiler-dock (= 1.11.0)
250 + rdoc (7.2.0)
251 + erb
252 + psych (>= 4.0.0)
253 + tsort
254 + redcarpet (3.6.1)
255 + regexp_parser (2.12.0)
256 + reline (0.6.3)
257 + io-console (~> 0.5)
258 + rouge (4.7.0)
259 + rubocop (1.86.1)
260 + json (~> 2.3)
261 + language_server-protocol (~> 3.17.0.2)
262 + lint_roller (~> 1.1.0)
263 + parallel (>= 1.10)
264 + parser (>= 3.3.0.2)
265 + rainbow (>= 2.2.2, < 4.0)
266 + regexp_parser (>= 2.9.3, < 3.0)
267 + rubocop-ast (>= 1.49.0, < 2.0)
268 + ruby-progressbar (~> 1.7)
269 + unicode-display_width (>= 2.4.0, < 4.0)
270 + rubocop-ast (1.49.1)
271 + parser (>= 3.3.7.2)
272 + prism (~> 1.7)
273 + rubocop-performance (1.26.1)
274 + lint_roller (~> 1.1)
275 + rubocop (>= 1.75.0, < 2.0)
276 + rubocop-ast (>= 1.47.1, < 2.0)
277 + rubocop-rails (2.34.3)
278 + activesupport (>= 4.2.0)
279 + lint_roller (~> 1.1)
280 + rack (>= 1.1)
281 + rubocop (>= 1.75.0, < 2.0)
282 + rubocop-ast (>= 1.44.0, < 2.0)
283 + rubocop-rails-omakase (1.1.0)
284 + rubocop (>= 1.72)
285 + rubocop-performance (>= 1.24)
286 + rubocop-rails (>= 2.30)
287 + ruby-progressbar (1.13.0)
288 + ruby-vips (2.3.0)
289 + ffi (~> 1.12)
290 + logger
291 + securerandom (0.4.1)
292 + solid_cable (3.0.12)
293 + actioncable (>= 7.2)
294 + activejob (>= 7.2)
295 + activerecord (>= 7.2)
296 + railties (>= 7.2)
297 + solid_cache (1.0.10)
298 + activejob (>= 7.2)
299 + activerecord (>= 7.2)
300 + railties (>= 7.2)
301 + solid_queue (1.4.0)
302 + activejob (>= 7.1)
303 + activerecord (>= 7.1)
304 + concurrent-ruby (>= 1.3.1)
305 + fugit (~> 1.11)
306 + railties (>= 7.1)
307 + thor (>= 1.3.1)
308 + sshkit (1.25.0)
309 + base64
310 + logger
311 + net-scp (>= 1.1.2)
312 + net-sftp (>= 2.1.2)
313 + net-ssh (>= 2.8.0)
314 + ostruct
315 + stimulus-rails (1.3.4)
316 + railties (>= 6.0.0)
317 + stringio (3.2.0)
318 + tailwindcss-rails (3.3.2)
319 + railties (>= 7.0.0)
320 + tailwindcss-ruby (~> 3.0)
321 + tailwindcss-ruby (3.4.19-arm64-darwin)
322 + thor (1.5.0)
323 + thruster (0.1.20-arm64-darwin)
324 + timeout (0.6.1)
325 + tsort (0.2.0)
326 + turbo-rails (2.0.23)
327 + actionpack (>= 7.1.0)
328 + railties (>= 7.1.0)
329 + tzinfo (2.0.6)
330 + concurrent-ruby (~> 1.0)
331 + unicode-display_width (3.2.0)
332 + unicode-emoji (~> 4.1)
333 + unicode-emoji (4.2.0)
334 + uri (1.1.1)
335 + useragent (0.16.11)
336 + web-console (4.3.0)
337 + actionview (>= 8.0.0)
338 + bindex (>= 0.4.0)
339 + railties (>= 8.0.0)
340 + websocket-driver (0.8.0)
341 + base64
342 + websocket-extensions (>= 0.1.0)
343 + websocket-extensions (0.1.5)
344 + zeitwerk (2.7.5)
345 +
346 +PLATFORMS
347 + arm64-darwin
348 +
349 +DEPENDENCIES
350 + bootsnap
351 + brakeman
352 + bundler-audit
353 + debug
354 + image_processing (~> 1.2)
355 + importmap-rails
356 + jbuilder
357 + kamal
358 + pg (~> 1.1)
359 + propshaft
360 + puma (>= 5.0)
361 + rails (~> 8.1.3)
362 + redcarpet (~> 3.6)
363 + rouge (~> 4.5)
364 + rubocop-rails-omakase
365 + smbcloud-auth!
366 + solid_cable
367 + solid_cache
368 + solid_queue
369 + stimulus-rails
370 + tailwindcss-rails
371 + thruster
372 + turbo-rails
373 + tzinfo-data
374 + web-console
375 +
376 +BUNDLED WITH
377 + 2.7.2
README.md new
+1
@@ -0,0 +1 @@
1 +# siGit sí!
Rakefile new
+6
@@ -0,0 +1,6 @@
1 +# Add your own tasks in files placed in lib/tasks ending in .rake,
2 +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 +
4 +require_relative "config/application"
5 +
6 +Rails.application.load_tasks
app/assets/builds/.keep
app/assets/images/.keep
app/assets/stylesheets/application.css new
+10
@@ -0,0 +1,10 @@
1 +/*
2 + * This is a manifest file that'll be compiled into application.css.
3 + *
4 + * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
5 + * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
6 + * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
7 + * depending on specificity.
8 + *
9 + * Consider organizing styles into separate files for maintainability.
10 + */
app/assets/stylesheets/application.tailwind.css new
+164
@@ -0,0 +1,164 @@
1 +@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
2 +@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');
3 +
4 +@tailwind base;
5 +@tailwind components;
6 +@tailwind utilities;
7 +
8 +@layer base {
9 + html { @apply antialiased; }
10 + body { @apply bg-surface-900 text-gray-300 font-sans text-sm leading-relaxed; }
11 + a { @apply text-brand-500; }
12 + code { @apply font-mono text-xs; }
13 +}
14 +
15 +@layer components {
16 + .nav-link {
17 + @apply text-gray-400 hover:text-gray-100 text-sm font-medium transition-colors duration-150;
18 + }
19 +
20 + .btn-primary {
21 + @apply inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white text-sm
22 + font-medium rounded hover:bg-brand-400 transition-colors duration-150 cursor-pointer;
23 + }
24 + .btn-secondary {
25 + @apply inline-flex items-center gap-2 px-4 py-2 bg-surface-700 text-gray-300 text-sm
26 + font-medium rounded border border-surface-500 hover:bg-surface-600
27 + transition-colors duration-150 cursor-pointer;
28 + }
29 + .btn-danger {
30 + @apply inline-flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm
31 + font-medium rounded hover:bg-red-500 transition-colors duration-150 cursor-pointer;
32 + }
33 + .btn-ghost {
34 + @apply inline-flex items-center gap-2 px-3 py-1.5 text-gray-400 text-sm
35 + font-medium rounded hover:bg-surface-700 transition-colors duration-150 cursor-pointer;
36 + }
37 +
38 + .form-input {
39 + @apply w-full px-3 py-2 border border-surface-500 rounded text-sm text-gray-200
40 + bg-surface-800 placeholder-gray-500 focus:outline-none focus:ring-2
41 + focus:ring-brand-500 focus:border-transparent transition-all duration-150;
42 + }
43 + .form-label {
44 + @apply block text-sm font-medium text-gray-300 mb-1;
45 + }
46 +
47 + .card {
48 + @apply bg-surface-700 border border-surface-500 rounded-sm;
49 + }
50 +
51 + .code-container {
52 + @apply bg-surface-800 border border-surface-500 rounded-sm font-mono text-xs overflow-x-auto;
53 + }
54 +
55 + .file-row {
56 + @apply flex items-center gap-3 px-4 py-2.5 border-b border-surface-600
57 + hover:bg-surface-600 transition-colors duration-100 text-sm;
58 + }
59 + .file-row:last-child { @apply border-b-0; }
60 +
61 + .breadcrumb-item {
62 + @apply text-brand-500 hover:underline text-sm;
63 + }
64 +
65 + .commit-row {
66 + @apply flex items-start justify-between px-4 py-3 border-b border-surface-600
67 + hover:bg-surface-600 transition-colors duration-100;
68 + }
69 + .commit-row:last-child { @apply border-b-0; }
70 +
71 + .badge {
72 + @apply inline-flex items-center px-2 py-0.5 rounded text-xs font-medium;
73 + }
74 + .badge-gray { @apply badge bg-surface-600 text-gray-300; }
75 + .badge-blue { @apply badge bg-brand-500/10 text-brand-400; }
76 +
77 + .tab-item {
78 + @apply px-4 py-2.5 text-sm font-medium text-gray-500 border-b-2 border-transparent
79 + hover:text-gray-300 hover:border-gray-600 transition-all duration-150;
80 + }
81 + .tab-item.active {
82 + @apply text-gray-100 border-brand-500;
83 + }
84 +
85 + .prose-readme h1 { @apply text-2xl font-semibold mb-4 mt-6 pb-2 border-b border-surface-600; }
86 + .prose-readme h2 { @apply text-xl font-semibold mb-3 mt-5 pb-2 border-b border-surface-600; }
87 + .prose-readme h3 { @apply text-lg font-medium mb-2 mt-4; }
88 + .prose-readme p { @apply mb-4 leading-7; }
89 + .prose-readme ul { @apply list-disc pl-6 mb-4 space-y-1; }
90 + .prose-readme ol { @apply list-decimal pl-6 mb-4 space-y-1; }
91 + .prose-readme li { @apply leading-7; }
92 + .prose-readme a { @apply text-brand-500 hover:underline; }
93 + .prose-readme code { @apply bg-surface-600 px-1.5 py-0.5 rounded text-xs font-mono text-gray-200; }
94 + .prose-readme pre { @apply bg-surface-800 border border-surface-500 rounded-sm p-4 overflow-x-auto mb-4; }
95 + .prose-readme pre code { @apply bg-transparent p-0; }
96 + .prose-readme table { @apply w-full mb-4 border-collapse border border-surface-500; }
97 + .prose-readme th { @apply bg-surface-600 border border-surface-500 px-3 py-2 text-left font-medium text-sm; }
98 + .prose-readme td { @apply border border-surface-500 px-3 py-2 text-sm; }
99 + .prose-readme blockquote { @apply border-l-4 border-surface-500 pl-4 italic text-gray-400 my-4; }
100 + .prose-readme hr { @apply border-surface-600 my-6; }
101 + .prose-readme img { @apply max-w-full; }
102 +
103 + .diff-add { @apply bg-green-900/30 text-green-300; }
104 + .diff-remove { @apply bg-red-900/30 text-red-300; }
105 + .diff-header { @apply bg-blue-900/30 text-blue-300; }
106 +}
107 +
108 +.highlight .c { color: #8b949e; font-style: italic }
109 +.highlight .err { color: #f85149; background-color: #3d1117 }
110 +.highlight .k { color: #ff7b72; font-weight: bold }
111 +.highlight .o { color: #ff7b72 }
112 +.highlight .cm { color: #8b949e; font-style: italic }
113 +.highlight .cp { color: #ff7b72 }
114 +.highlight .c1 { color: #8b949e; font-style: italic }
115 +.highlight .cs { color: #8b949e; font-weight: bold; font-style: italic }
116 +.highlight .gd { color: #ffa198; background-color: #3d1117 }
117 +.highlight .ge { font-style: italic }
118 +.highlight .gr { color: #f85149 }
119 +.highlight .gh { color: #79c0ff; font-weight: bold }
120 +.highlight .gi { color: #aff5b4; background-color: #1a4721 }
121 +.highlight .go { color: #8b949e }
122 +.highlight .gp { color: #8b949e }
123 +.highlight .gs { font-weight: bold }
124 +.highlight .gu { color: #79c0ff }
125 +.highlight .gt { color: #f85149 }
126 +.highlight .kc { color: #ff7b72; font-weight: bold }
127 +.highlight .kd { color: #ff7b72; font-weight: bold }
128 +.highlight .kp { color: #ff7b72; font-weight: bold }
129 +.highlight .kr { color: #ff7b72; font-weight: bold }
130 +.highlight .kt { color: #ffa657; font-weight: bold }
131 +.highlight .m { color: #79c0ff }
132 +.highlight .s { color: #a5d6ff }
133 +.highlight .na { color: #79c0ff }
134 +.highlight .nb { color: #ffa657 }
135 +.highlight .nc { color: #ffa657; font-weight: bold }
136 +.highlight .no { color: #79c0ff }
137 +.highlight .ni { color: #d2a8ff }
138 +.highlight .ne { color: #ffa657; font-weight: bold }
139 +.highlight .nf { color: #d2a8ff; font-weight: bold }
140 +.highlight .nn { color: #ffa657 }
141 +.highlight .nt { color: #7ee787 }
142 +.highlight .nv { color: #ffa657 }
143 +.highlight .ow { color: #ff7b72; font-weight: bold }
144 +.highlight .w { color: #484f58 }
145 +.highlight .mf { color: #79c0ff }
146 +.highlight .mh { color: #79c0ff }
147 +.highlight .mi { color: #79c0ff }
148 +.highlight .mo { color: #79c0ff }
149 +.highlight .sb { color: #a5d6ff }
150 +.highlight .sc { color: #a5d6ff }
151 +.highlight .sd { color: #a5d6ff }
152 +.highlight .s2 { color: #a5d6ff }
153 +.highlight .se { color: #79c0ff }
154 +.highlight .sh { color: #a5d6ff }
155 +.highlight .si { color: #a5d6ff }
156 +.highlight .sx { color: #a5d6ff }
157 +.highlight .sr { color: #7ee787 }
158 +.highlight .s1 { color: #a5d6ff }
159 +.highlight .ss { color: #79c0ff }
160 +.highlight .bp { color: #79c0ff }
161 +.highlight .vc { color: #ffa657 }
162 +.highlight .vg { color: #ffa657 }
163 +.highlight .vi { color: #ffa657 }
164 +.highlight .il { color: #79c0ff }
app/controllers/application_controller.rb new
+28
@@ -0,0 +1,28 @@
1 +class ApplicationController < ActionController::Base
2 + include ActionView::Helpers::SanitizeHelper
3 +
4 + # Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
5 + allow_browser versions: :modern
6 +
7 + # Changes to the importmap will invalidate the etag for HTML responses
8 + stale_when_importmap_changes
9 +
10 + helper_method :current_user, :signed_in?
11 +
12 + private
13 +
14 + def current_user
15 + @current_user ||= User.find_by(id: session[:user_id]) if session[:user_id]
16 + end
17 +
18 + def signed_in?
19 + current_user.present?
20 + end
21 +
22 + def require_sign_in!
23 + unless signed_in?
24 + session[:return_to] = request.fullpath
25 + redirect_to signin_path, alert: "Please sign in to continue."
26 + end
27 + end
28 +end
app/controllers/blobs_controller.rb new
+76
@@ -0,0 +1,76 @@
1 +class BlobsController < ApplicationController
2 + before_action :load_owner
3 + before_action :load_repository
4 + before_action :ensure_can_read!
5 +
6 + def show
7 + @branch = params[:branch]
8 + @file_path = params[:path]
9 + @path_parts = @file_path.to_s.split("/").reject(&:blank?)
10 +
11 + content = GitRepositoryService.file_content(@repository.disk_path, @branch, @file_path)
12 + if content.nil?
13 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
14 + return
15 + end
16 +
17 + @raw_content = content
18 + @filename = File.basename(@file_path)
19 + @extension = File.extname(@filename).delete_prefix(".")
20 + @is_binary = content.encoding != Encoding::UTF_8 || !content.valid_encoding? || binary_content?(content)
21 + @file_size = content.bytesize
22 +
23 + unless @is_binary
24 + @highlighted = highlight_code(content, @filename)
25 + @line_count = content.lines.count
26 + end
27 + end
28 +
29 + def raw
30 + @branch = params[:branch]
31 + @file_path = params[:path]
32 +
33 + content = GitRepositoryService.file_content(@repository.disk_path, @branch, @file_path)
34 + if content.nil?
35 + head :not_found
36 + return
37 + end
38 +
39 + send_data content,
40 + type: "text/plain; charset=utf-8",
41 + disposition: "inline",
42 + filename: File.basename(@file_path)
43 + end
44 +
45 + private
46 +
47 + def load_owner
48 + @owner = User.find_by!(username: params[:username])
49 + rescue ActiveRecord::RecordNotFound
50 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
51 + end
52 +
53 + def load_repository
54 + @repository = @owner.repositories.find_by!(name: params[:repository])
55 + rescue ActiveRecord::RecordNotFound
56 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
57 + end
58 +
59 + def ensure_can_read!
60 + unless !@repository.is_private || (signed_in? && current_user == @owner)
61 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
62 + end
63 + end
64 +
65 + def binary_content?(content)
66 + content.bytes.first(8192).include?(0)
67 + end
68 +
69 + def highlight_code(content, filename)
70 + lexer = Rouge::Lexer.guess(filename: filename, source: content)
71 + formatter = Rouge::Formatters::HTML.new
72 + formatter.format(lexer.lex(content)).html_safe
73 + rescue StandardError
74 + Rouge::Formatters::HTML.new.format(Rouge::Lexers::PlainText.new.lex(content)).html_safe
75 + end
76 +end
app/controllers/commits_controller.rb new
+58
@@ -0,0 +1,58 @@
1 +class CommitsController < ApplicationController
2 + before_action :load_owner
3 + before_action :load_repository
4 + before_action :ensure_can_read!
5 +
6 + def index
7 + @branch = params[:branch] || @repository.default_branch
8 + @page = (params[:page] || 1).to_i
9 + @per_page = 20
10 + @offset = (@page - 1) * @per_page
11 +
12 + unless @repository.initialized? && GitRepositoryService.branch_exists?(@repository.disk_path, @branch)
13 + redirect_to repository_path(@owner.username, @repository.name)
14 + return
15 + end
16 +
17 + @commits = GitRepositoryService.commits(
18 + @repository.disk_path, @branch,
19 + limit: @per_page, offset: @offset
20 + )
21 + @total = GitRepositoryService.commit_count(@repository.disk_path, @branch)
22 + @total_pages = (@total.to_f / @per_page).ceil
23 + end
24 +
25 + def show
26 + @sha = params[:sha]
27 +
28 + unless @repository.initialized?
29 + redirect_to repository_path(@owner.username, @repository.name)
30 + return
31 + end
32 +
33 + @commit = GitRepositoryService.commit(@repository.disk_path, @sha)
34 + if @commit.nil?
35 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
36 + end
37 + end
38 +
39 + private
40 +
41 + def load_owner
42 + @owner = User.find_by!(username: params[:username])
43 + rescue ActiveRecord::RecordNotFound
44 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
45 + end
46 +
47 + def load_repository
48 + @repository = @owner.repositories.find_by!(name: params[:repository])
49 + rescue ActiveRecord::RecordNotFound
50 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
51 + end
52 +
53 + def ensure_can_read!
54 + unless !@repository.is_private || (signed_in? && current_user == @owner)
55 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
56 + end
57 + end
58 +end
app/controllers/concerns/.keep
app/controllers/dev/panel_controller.rb new
+35
@@ -0,0 +1,35 @@
1 +# frozen_string_literal: true
2 +
3 +module Dev
4 + class PanelController < ApplicationController
5 + CACHE_KEY = "dev:smbcloud_environment"
6 + VALID_ENVIRONMENTS = %w[dev production].freeze
7 +
8 + skip_before_action :require_sign_in!, raise: false
9 + skip_before_action :verify_authenticity_token
10 +
11 + # GET /dev/environment
12 + def show
13 + render json: { environment: current_environment }
14 + end
15 +
16 + # PUT /dev/environment
17 + def update
18 + env = params[:environment].to_s.strip.downcase
19 +
20 + unless VALID_ENVIRONMENTS.include?(env)
21 + return render json: { error: "Invalid environment. Must be one of: #{VALID_ENVIRONMENTS.join(', ')}" },
22 + status: :unprocessable_entity
23 + end
24 +
25 + Rails.cache.write(CACHE_KEY, env, expires_in: 24.hours)
26 + render json: { environment: env }
27 + end
28 +
29 + private
30 +
31 + def current_environment
32 + Rails.cache.read(CACHE_KEY) || ENV.fetch("SMBCLOUD_ENVIRONMENT", "dev")
33 + end
34 + end
35 +end
app/controllers/pages_controller.rb new
+8
@@ -0,0 +1,8 @@
1 +class PagesController < ApplicationController
2 + def home
3 + if signed_in?
4 + @repositories = current_user.repositories.order(updated_at: :desc).limit(10)
5 + render :dashboard
6 + end
7 + end
8 +end
app/controllers/registrations_controller.rb new
+70
@@ -0,0 +1,70 @@
1 +# frozen_string_literal: true
2 +
3 +class RegistrationsController < ApplicationController
4 + before_action :redirect_if_signed_in
5 +
6 + # GET /auth/signup
7 + def new
8 + end
9 +
10 + # POST /auth/signup
11 + def create
12 + email = params[:email].to_s.strip.downcase
13 + password = params[:password].to_s
14 + password_confirm = params[:password_confirmation].to_s
15 +
16 + if email.blank? || password.blank?
17 + flash.now[:alert] = "Email and password are required."
18 + return render :new, status: :unprocessable_entity
19 + end
20 +
21 + if password != password_confirm
22 + flash.now[:alert] = "Passwords do not match."
23 + return render :new, status: :unprocessable_entity
24 + end
25 +
26 + if password.length < 8
27 + flash.now[:alert] = "Password must be at least 8 characters."
28 + return render :new, status: :unprocessable_entity
29 + end
30 +
31 + # Step 1 — create the account on smbCloud
32 + SmbcloudAuthService.signup(email: email, password: password)
33 +
34 + # Step 2 — log straight in
35 + access_token = SmbcloudAuthService.login(email: email, password: password)
36 + profile = SmbcloudAuthService.me(access_token: access_token)
37 + user = User.find_or_create_from_smbcloud(profile.merge(access_token: access_token))
38 +
39 + reset_session
40 + session[:user_id] = user.id
41 +
42 + redirect_to root_path, notice: "Welcome to siGit, #{user.display_name_or_username}!"
43 +
44 + rescue SmbcloudAuthService::AccountIncompleteError
45 + # Account created but requires email verification before first login
46 + redirect_to signin_path,
47 + notice: "Account created. Check your email to verify it, then sign in."
48 +
49 + rescue SmbcloudAuthService::AuthenticationError => e
50 + flash.now[:alert] = e.message.presence || "Sign-up failed. Please try again."
51 + render :new, status: :unprocessable_entity
52 +
53 + rescue KeyError => e
54 + Rails.logger.error("smbCloud configuration error during signup: #{e.message}")
55 + flash.now[:alert] = "Authentication service is not configured. Please contact support."
56 + render :new, status: :internal_server_error
57 +
58 + rescue => e
59 + Rails.logger.error("Unexpected signup error for #{email.inspect}: #{e.message}\n" \
60 + "#{e.backtrace.first(5).join("\n")}")
61 + flash.now[:alert] = "An unexpected error occurred. Please try again."
62 + render :new, status: :internal_server_error
63 + end
64 +
65 + private
66 +
67 + def redirect_if_signed_in
68 + redirect_to root_path, notice: "You are already signed in." if signed_in?
69 + end
70 +end
app/controllers/repositories_controller.rb new
+115
@@ -0,0 +1,115 @@
1 +class RepositoriesController < ApplicationController
2 + before_action :require_sign_in!, only: [ :new, :create ]
3 + before_action :load_owner, only: [ :show, :tree ]
4 + before_action :load_repository, only: [ :show, :tree ]
5 + before_action :ensure_can_read!, only: [ :show, :tree ]
6 +
7 + def new
8 + @repository = Repository.new
9 + end
10 +
11 + def create
12 + @repository = current_user.repositories.new(repository_params)
13 + @repository.disk_path = GitRepositoryService.repo_path(
14 + current_user.username, @repository.name
15 + )
16 +
17 + if @repository.save
18 + GitRepositoryService.create_bare_repo(current_user.username, @repository.name)
19 + GitRepositoryService.initialize_with_readme(
20 + current_user.username, @repository.name,
21 + default_branch: @repository.default_branch
22 + )
23 + redirect_to repository_path(current_user.username, @repository.name),
24 + notice: "Repository created successfully."
25 + else
26 + render :new, status: :unprocessable_entity
27 + end
28 + rescue => e
29 + Rails.logger.error("Repo create error: #{e.message}")
30 + @repository.errors.add(:base, "Failed to initialize repository on disk.")
31 + render :new, status: :unprocessable_entity
32 + end
33 +
34 + def show
35 + branch = params[:branch] || @repository.default_branch
36 + @branch = branch
37 + @branches = GitRepositoryService.branches(@repository.disk_path) rescue []
38 +
39 + unless @repository.initialized? && GitRepositoryService.branch_exists?(@repository.disk_path, branch)
40 + @empty = true
41 + return
42 + end
43 +
44 + @tree = GitRepositoryService.list_tree(@repository.disk_path, branch)
45 + readme = GitRepositoryService.readme_content(@repository.disk_path, branch)
46 + if readme
47 + @readme_html = render_markdown(readme[:content])
48 + @readme_filename = readme[:filename]
49 + end
50 + @commit_count = GitRepositoryService.commit_count(@repository.disk_path, branch)
51 + @recent_commits = GitRepositoryService.commits(@repository.disk_path, branch, limit: 3)
52 + end
53 +
54 + def tree
55 + branch = params[:branch] || @repository.default_branch
56 + @branch = branch
57 + tree_path = params[:path]
58 +
59 + unless @repository.initialized? && GitRepositoryService.branch_exists?(@repository.disk_path, branch)
60 + redirect_to repository_path(@owner.username, @repository.name)
61 + return
62 + end
63 +
64 + @tree = GitRepositoryService.list_tree(@repository.disk_path, branch, tree_path)
65 + @current_path = tree_path
66 + @path_parts = tree_path.to_s.split("/").reject(&:blank?)
67 +
68 + # If it's actually a file, redirect to the blob view
69 + if @tree.empty?
70 + redirect_to repository_blob_path(@owner.username, @repository.name, branch, tree_path)
71 + end
72 + end
73 +
74 + private
75 +
76 + def repository_params
77 + params.require(:repository).permit(:name, :description, :default_branch, :is_private)
78 + end
79 +
80 + def load_owner
81 + @owner = User.find_by!(username: params[:username])
82 + rescue ActiveRecord::RecordNotFound
83 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
84 + end
85 +
86 + def load_repository
87 + @repository = @owner.repositories.find_by!(name: params[:repository])
88 + rescue ActiveRecord::RecordNotFound
89 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
90 + end
91 +
92 + def ensure_can_read!
93 + unless !@repository.is_private || (signed_in? && current_user == @owner)
94 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
95 + end
96 + end
97 +
98 + def render_markdown(text)
99 + renderer = Redcarpet::Render::HTML.new(
100 + hard_wrap: false,
101 + link_attributes: { target: "_blank", rel: "noopener noreferrer" },
102 + no_images: false,
103 + safe_links_only: true
104 + )
105 + markdown = Redcarpet::Markdown.new(
106 + renderer,
107 + autolink: true,
108 + tables: true,
109 + fenced_code_blocks: true,
110 + strikethrough: true,
111 + space_after_headers: true
112 + )
113 + markdown.render(text).html_safe
114 + end
115 +end
app/controllers/sessions_controller.rb new
+80
@@ -0,0 +1,80 @@
1 +# frozen_string_literal: true
2 +
3 +class SessionsController < ApplicationController
4 + before_action :redirect_if_signed_in, only: [:new, :create]
5 +
6 + # GET /auth/smbcloud
7 + # Shows the email/password sign-in form.
8 + def new
9 + end
10 +
11 + # POST /auth/smbcloud
12 + # Authenticates against smbCloud Auth using the native gem, then
13 + # fetches the user's profile and upserts a local User record.
14 + def create
15 + email = params[:email].to_s.strip
16 + password = params[:password].to_s
17 +
18 + if email.blank? || password.blank?
19 + flash.now[:alert] = "Email and password are required."
20 + render :new, status: :unprocessable_entity
21 + return
22 + end
23 +
24 + # Step 1 — authenticate; raises SmbcloudAuthService::AuthenticationError on failure
25 + access_token = SmbcloudAuthService.login(email: email, password: password)
26 +
27 + # Step 2 — fetch profile: { id: Integer, email: String, created_at:, updated_at: }
28 + profile = SmbcloudAuthService.me(access_token: access_token)
29 +
30 + # Step 3 — upsert local user
31 + user = User.find_or_create_from_smbcloud(profile.merge(access_token: access_token))
32 +
33 + # Step 4 — establish session
34 + reset_session
35 + session[:user_id] = user.id
36 +
37 + return_to = session.delete(:return_to)
38 + redirect_to(return_to || root_path, notice: "Welcome, #{user.display_name_or_username}!")
39 +
40 + rescue SmbcloudAuthService::AccountNotFoundError
41 + flash.now[:alert] = "No account found for that email address."
42 + render :new, status: :unprocessable_entity
43 +
44 + rescue SmbcloudAuthService::AccountIncompleteError => e
45 + flash.now[:alert] = e.message.presence ||
46 + "Your account is not yet active. Please check your email for a verification link."
47 + render :new, status: :unprocessable_entity
48 +
49 + rescue SmbcloudAuthService::AuthenticationError => e
50 + Rails.logger.warn("smbCloud auth error for #{email.inspect}: #{e.message}")
51 + flash.now[:alert] = "Sign-in failed. Please check your credentials and try again."
52 + render :new, status: :unprocessable_entity
53 +
54 + rescue KeyError => e
55 + # Missing SMBCLOUD_APP_ID / SMBCLOUD_APP_SECRET env vars
56 + Rails.logger.error("smbCloud configuration error: #{e.message}")
57 + flash.now[:alert] = "Authentication service is not configured. Please contact support."
58 + render :new, status: :internal_server_error
59 +
60 + rescue => e
61 + Rails.logger.error("Unexpected sign-in error for #{email.inspect}: #{e.message}\n" \
62 + "#{e.backtrace.first(5).join("\n")}")
63 + flash.now[:alert] = "An unexpected error occurred. Please try again."
64 + render :new, status: :internal_server_error
65 + end
66 +
67 + # DELETE /auth/signout
68 + def destroy
69 + access_token = current_user&.access_token
70 + SmbcloudAuthService.logout(access_token: access_token) if access_token.present?
71 + reset_session
72 + redirect_to root_path, notice: "You have been signed out."
73 + end
74 +
75 + private
76 +
77 + def redirect_if_signed_in
78 + redirect_to root_path, notice: "You are already signed in." if signed_in?
79 + end
80 +end
app/controllers/users_controller.rb new
+33
@@ -0,0 +1,33 @@
1 +class UsersController < ApplicationController
2 + before_action :require_sign_in!, only: [ :settings, :update_settings ]
3 +
4 + def show
5 + @profile_user = User.find_by!(username: params[:username])
6 + @repositories = if signed_in? && current_user == @profile_user
7 + @profile_user.repositories.order(updated_at: :desc)
8 + else
9 + @profile_user.repositories.where(is_private: false).order(updated_at: :desc)
10 + end
11 + rescue ActiveRecord::RecordNotFound
12 + render file: Rails.public_path.join("404.html"), status: :not_found, layout: false
13 + end
14 +
15 + def settings
16 + @user = current_user
17 + end
18 +
19 + def update_settings
20 + @user = current_user
21 + if @user.update(user_settings_params)
22 + redirect_to settings_path, notice: "Settings updated."
23 + else
24 + render :settings, status: :unprocessable_entity
25 + end
26 + end
27 +
28 + private
29 +
30 + def user_settings_params
31 + params.require(:user).permit(:display_name, :avatar_url)
32 + end
33 +end
app/helpers/application_helper.rb new
+2
@@ -0,0 +1,2 @@
1 +module ApplicationHelper
2 +end
app/javascript/application.js new
+2
@@ -0,0 +1,2 @@
1 +import "@hotwired/turbo-rails"
2 +import "controllers"
app/javascript/controllers/application.js new
+9
@@ -0,0 +1,9 @@
1 +import { Application } from "@hotwired/stimulus"
2 +
3 +const application = Application.start()
4 +
5 +// Configure Stimulus development experience
6 +application.debug = false
7 +window.Stimulus = application
8 +
9 +export { application }
app/javascript/controllers/dev_panel_controller.js new
+113
@@ -0,0 +1,113 @@
1 +import { Controller } from "@hotwired/stimulus"
2 +
3 +const PRESETS = [
4 + { label: "Dev", env: "dev", dot: "bg-amber-400" },
5 + { label: "Production", env: "production", dot: "bg-emerald-400" },
6 +]
7 +
8 +export default class extends Controller {
9 + static targets = ["panel"]
10 + static values = { open: Boolean, environment: String, loading: Boolean }
11 +
12 + connect() {
13 + this.loadEnvironment()
14 + }
15 +
16 + toggle() {
17 + this.openValue = !this.openValue
18 + this.render()
19 + }
20 +
21 + async select(event) {
22 + const env = event.currentTarget.dataset.env
23 + if (env === this.environmentValue || this.loadingValue) return
24 + this.loadingValue = true
25 + this.render()
26 + try {
27 + const res = await fetch("/dev/environment", {
28 + method: "PUT",
29 + headers: { "Content-Type": "application/json", "X-CSRF-Token": this.csrfToken },
30 + body: JSON.stringify({ environment: env }),
31 + })
32 + const data = await res.json()
33 + this.environmentValue = data.environment
34 + } catch (_) {}
35 + finally {
36 + this.loadingValue = false
37 + this.render()
38 + }
39 + }
40 +
41 + async loadEnvironment() {
42 + try {
43 + const res = await fetch("/dev/environment")
44 + const data = await res.json()
45 + this.environmentValue = data.environment
46 + } catch (_) {
47 + this.environmentValue = "dev"
48 + }
49 + this.render()
50 + }
51 +
52 + render() {
53 + const panel = this.panelTarget
54 + const current = this.environmentValue
55 + const loading = this.loadingValue
56 +
57 + if (!this.openValue) {
58 + panel.classList.add("hidden")
59 + panel.innerHTML = ""
60 + return
61 + }
62 +
63 + panel.classList.remove("hidden")
64 +
65 + const rows = PRESETS.map((p, i) => {
66 + const isActive = p.env === current
67 + const isLast = i === PRESETS.length - 1
68 + const activeBg = isActive ? "bg-brand-500/10" : "hover:bg-surface-600"
69 + const border = isLast ? "" : "border-b border-surface-600"
70 + const checkFill = isActive ? "bg-brand-500 border-brand-500" : "border-surface-400"
71 + const labelCol = isActive ? "text-brand-400" : "text-gray-200"
72 + const check = isActive
73 + ? `<svg class="w-2.5 h-2.5 text-white" viewBox="0 0 12 12" fill="currentColor"><path d="M10.28 2.28a.75.75 0 0 0-1.06 0L4.5 7 2.78 5.28a.75.75 0 0 0-1.06 1.06l2.25 2.25a.75.75 0 0 0 1.06 0l5.25-5.25a.75.75 0 0 0 0-1.06Z"/></svg>`
74 + : ""
75 + const dot = isActive
76 + ? `<span class="ml-auto h-1.5 w-1.5 rounded-full ${p.dot}"></span>`
77 + : ""
78 + return `<button data-env="${p.env}"
79 + data-action="click->dev-panel#select"
80 + ${loading ? "disabled" : ""}
81 + class="flex w-full items-center gap-3 px-3 py-2.5 text-left transition ${border} ${activeBg} disabled:opacity-50">
82 + <span class="flex h-4 w-4 shrink-0 items-center justify-center rounded-full border ${checkFill}">${check}</span>
83 + <div class="min-w-0">
84 + <p class="text-sm font-medium leading-tight ${labelCol}">${p.label}</p>
85 + <p class="mt-0.5 text-[11px] text-gray-500">${p.env}</p>
86 + </div>
87 + ${dot}
88 + </button>`
89 + }).join("")
90 +
91 + panel.innerHTML = `
92 + <div class="w-52 overflow-hidden rounded border border-surface-500 bg-surface-700 shadow-xl">
93 + <div class="flex items-center justify-between px-3 py-2 border-b border-surface-600">
94 + <div class="flex items-center gap-2">
95 + <span class="rounded bg-brand-500/10 px-1.5 py-0.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-brand-400">dev</span>
96 + <span class="text-xs text-gray-400">Auth Target</span>
97 + </div>
98 + <button data-action="click->dev-panel#toggle"
99 + class="rounded p-0.5 text-gray-500 hover:bg-surface-600 hover:text-gray-300 transition-colors">
100 + <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
101 + <path d="M3.72 3.72a.75.75 0 0 1 1.06 0L8 6.94l3.22-3.22a.75.75 1 1 1 1.06 1.06L9.06 8l3.22 3.22a.75.75 0 1 1-1.06 1.06L8 9.06l-3.22 3.22a.75.75 0 0 1-1.06-1.06L6.94 8 3.72 4.78a.75.75 0 0 1 0-1.06z"/>
102 + </svg>
103 + </button>
104 + </div>
105 + <div>${rows}</div>
106 + </div>
107 + `
108 + }
109 +
110 + get csrfToken() {
111 + return document.querySelector("meta[name=csrf-token]")?.content ?? ""
112 + }
113 +}
app/javascript/controllers/index.js new
+3
@@ -0,0 +1,3 @@
1 +import { application } from "controllers/application"
2 +import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
3 +eagerLoadControllersFrom("controllers", application)
app/jobs/application_job.rb new
+7
@@ -0,0 +1,7 @@
1 +class ApplicationJob < ActiveJob::Base
2 + # Automatically retry jobs that encountered a deadlock
3 + # retry_on ActiveRecord::Deadlocked
4 +
5 + # Most jobs are safe to ignore if the underlying records are no longer available
6 + # discard_on ActiveJob::DeserializationError
7 +end
app/mailers/application_mailer.rb new
+4
@@ -0,0 +1,4 @@
1 +class ApplicationMailer < ActionMailer::Base
2 + default from: "from@example.com"
3 + layout "mailer"
4 +end
app/models/application_record.rb new
+3
@@ -0,0 +1,3 @@
1 +class ApplicationRecord < ActiveRecord::Base
2 + primary_abstract_class
3 +end
app/models/concerns/.keep
app/models/repository.rb new
+43
@@ -0,0 +1,43 @@
1 +class Repository < ApplicationRecord
2 + belongs_to :user
3 +
4 + validates :name, presence: true,
5 + format: {
6 + with: /\A(?!\.)[a-zA-Z0-9_.\-]+(?<!\.)(?<!\.\.)\z/,
7 + message: "may only contain letters, numbers, hyphens, underscores, and dots; must not start or end with a dot; must not contain consecutive dots"
8 + },
9 + uniqueness: { scope: :user_id, case_sensitive: false }
10 + validates :default_branch, presence: true
11 +
12 + validate :no_consecutive_dots_in_name
13 + validate :no_leading_hyphen_in_name
14 +
15 + def to_param
16 + name
17 + end
18 +
19 + def full_name
20 + "#{user.username}/#{name}"
21 + end
22 +
23 + def git_path
24 + disk_path
25 + end
26 +
27 + def initialized?
28 + return false if git_path.blank?
29 + Dir.exist?(git_path) && File.exist?(File.join(git_path, "HEAD"))
30 + end
31 +
32 + private
33 +
34 + def no_consecutive_dots_in_name
35 + return if name.blank?
36 + errors.add(:name, "must not contain consecutive dots") if name.include?("..")
37 + end
38 +
39 + def no_leading_hyphen_in_name
40 + return if name.blank?
41 + errors.add(:name, "must not start with a hyphen") if name.start_with?("-")
42 + end
43 +end
app/models/ssh_key.rb new
+7
@@ -0,0 +1,7 @@
1 +class SshKey < ApplicationRecord
2 + belongs_to :user
3 +
4 + validates :title, presence: true
5 + validates :key_text, presence: true
6 + validates :fingerprint, presence: true, uniqueness: { scope: :user_id }
7 +end
app/models/user.rb new
+104
@@ -0,0 +1,104 @@
1 +# frozen_string_literal: true
2 +
3 +class User < ApplicationRecord
4 + has_many :repositories, dependent: :destroy
5 + has_many :ssh_keys, dependent: :destroy
6 +
7 + validates :smbcloud_id,
8 + presence: true,
9 + uniqueness: true,
10 + numericality: { only_integer: true, greater_than: 0 }
11 +
12 + validates :email,
13 + presence: true,
14 + uniqueness: { case_sensitive: false },
15 + format: { with: URI::MailTo::EMAIL_REGEXP, message: "is not a valid email address" }
16 +
17 + validates :username,
18 + presence: true,
19 + uniqueness: { case_sensitive: false },
20 + format: {
21 + with: /\A[a-z0-9][a-z0-9\-]{0,37}[a-z0-9]?\z|\A[a-z0-9]\z/,
22 + message: "may only contain lowercase letters, numbers, and hyphens, and cannot start or end with a hyphen"
23 + },
24 + length: { minimum: 1, maximum: 39 }
25 +
26 + # ---------------------------------------------------------------------------
27 + # URL helpers
28 + # ---------------------------------------------------------------------------
29 +
30 + def to_param
31 + username
32 + end
33 +
34 + # ---------------------------------------------------------------------------
35 + # Display helpers
36 + # ---------------------------------------------------------------------------
37 +
38 + def display_name_or_username
39 + display_name.presence || username
40 + end
41 +
42 + def avatar_url_or_default
43 + return avatar_url if avatar_url.present?
44 +
45 + encoded_name = URI.encode_www_form_component(display_name_or_username)
46 + "https://ui-avatars.com/api/?name=#{encoded_name}&background=0057B8&color=fff&size=128"
47 + end
48 +
49 + # ---------------------------------------------------------------------------
50 + # smbCloud Auth integration
51 + # ---------------------------------------------------------------------------
52 +
53 + # Upserts a user record from the data returned by:
54 + # 1. SmbcloudAuthService.me(access_token:)
55 + # → { id: Integer, email: String, created_at: String, updated_at: String }
56 + # 2. The access_token passed through from login.
57 + #
58 + # Accepts either string or symbol keys.
59 + #
60 + # Returns the persisted User. Raises ActiveRecord::RecordInvalid on failure.
61 + def self.find_or_create_from_smbcloud(userinfo, access_token: nil)
62 + smbcloud_id = Integer(userinfo[:id] || userinfo["id"])
63 + email = (userinfo[:email] || userinfo["email"]).to_s.strip.downcase
64 +
65 + user = find_or_initialize_by(smbcloud_id: smbcloud_id)
66 +
67 + # Always sync email and token in case they changed on the auth server.
68 + user.email = email if email.present?
69 + user.access_token = access_token if access_token.present?
70 +
71 + # Derive a username only for new records.
72 + user.username = generate_username_from_email(email) if user.new_record?
73 +
74 + user.save!
75 + user
76 + end
77 +
78 + # ---------------------------------------------------------------------------
79 + # Private helpers
80 + # ---------------------------------------------------------------------------
81 +
82 + def self.generate_username_from_email(email)
83 + base = email.to_s
84 + .split("@")
85 + .first
86 + .to_s
87 + .downcase
88 + .gsub(/[^a-z0-9\-]/, "-") # replace non-slug chars with hyphens
89 + .gsub(/-{2,}/, "-") # collapse consecutive hyphens
90 + .gsub(/\A-+|-+\z/, "") # strip leading/trailing hyphens
91 + .slice(0, 39)
92 + .presence || "user"
93 +
94 + return base unless exists?(username: base)
95 +
96 + # Append a random 4-char suffix until we find an available handle.
97 + loop do
98 + suffix = SecureRandom.alphanumeric(4).downcase
99 + candidate = "#{base.slice(0, 34)}-#{suffix}"
100 + break candidate unless exists?(username: candidate)
101 + end
102 + end
103 + private_class_method :generate_username_from_email
104 +end
app/services/git_repository_service.rb new
+132
@@ -0,0 +1,132 @@
1 +require "open3"
2 +require "fileutils"
3 +
4 +class GitRepositoryService
5 + REPOS_BASE = ENV.fetch("SIGITSI_REPOS_PATH", Rails.root.join("repos").to_s)
6 +
7 + def self.repo_path(username, reponame)
8 + File.join(REPOS_BASE, username, "#{reponame}.git")
9 + end
10 +
11 + def self.create_bare_repo(username, reponame)
12 + path = repo_path(username, reponame)
13 + FileUtils.mkdir_p(path)
14 + _stdout, _stderr, status = Open3.capture3("git", "init", "--bare", path)
15 + raise "git init failed" unless status.success?
16 + path
17 + end
18 +
19 + def self.initialize_with_readme(username, reponame, default_branch: "main")
20 + bare_path = repo_path(username, reponame)
21 + Dir.mktmpdir do |tmpdir|
22 + system("git", "-C", tmpdir, "init", "-b", default_branch, exception: true)
23 + system("git", "-C", tmpdir, "config", "user.email", "sigitsi@localhost", exception: true)
24 + system("git", "-C", tmpdir, "config", "user.name", "siGit", exception: true)
25 + readme = File.join(tmpdir, "README.md")
26 + File.write(readme, "# #{reponame}\n\nWelcome to #{reponame}.\n")
27 + system("git", "-C", tmpdir, "add", ".", exception: true)
28 + system("git", "-C", tmpdir, "commit", "-m", "Initial commit", exception: true)
29 + system("git", "-C", tmpdir, "remote", "add", "origin", bare_path, exception: true)
30 + system("git", "-C", tmpdir, "push", "origin", default_branch, exception: true)
31 + end
32 + end
33 +
34 + def self.default_branch(path)
35 + out, _err, status = Open3.capture3("git", "--git-dir", path, "symbolic-ref", "--short", "HEAD")
36 + return "main" unless status.success?
37 + out.strip
38 + end
39 +
40 + def self.list_tree(path, branch, tree_path = "")
41 + prefix = tree_path.blank? ? "" : "#{tree_path.chomp("/")}/"
42 + args = ["git", "--git-dir", path, "ls-tree", "--long", "#{branch}:#{prefix}"]
43 + out, _err, status = Open3.capture3(*args)
44 + return [] unless status.success?
45 + out.lines.filter_map do |line|
46 + parts = line.split
47 + next unless parts.length >= 5
48 + mode, type, _sha, _size, name = parts[0], parts[1], parts[2], parts[3], parts[4..]&.join(" ")&.strip
49 + { mode: mode, type: type, name: name, path: prefix + name }
50 + end.sort_by { |e| [e[:type] == "tree" ? 0 : 1, e[:name].downcase] }
51 + end
52 +
53 + def self.file_content(path, branch, file_path)
54 + out, _err, status = Open3.capture3("git", "--git-dir", path, "show", "#{branch}:#{file_path}")
55 + return nil unless status.success?
56 + out
57 + end
58 +
59 + def self.commits(path, branch, limit: 20, offset: 0)
60 + format = "%H%x00%h%x00%s%x00%an%x00%ae%x00%ad%x00%cn"
61 + out, _err, status = Open3.capture3(
62 + "git", "--git-dir", path, "log",
63 + "--format=#{format}", "--date=iso-strict",
64 + "--skip=#{offset}", "-n", limit.to_s,
65 + branch
66 + )
67 + return [] unless status.success?
68 + out.lines.filter_map do |line|
69 + parts = line.chomp.split("\x00")
70 + next unless parts.length == 7
71 + sha, short_sha, subject, author_name, author_email, authored_date, committer_name = parts
72 + {
73 + sha: sha,
74 + short_sha: short_sha,
75 + subject: subject,
76 + author_name: author_name,
77 + author_email: author_email,
78 + authored_date: Time.parse(authored_date),
79 + committer_name: committer_name
80 + }
81 + end
82 + end
83 +
84 + def self.commit(path, sha)
85 + format = "%H%x00%h%x00%s%x00%B%x00%an%x00%ae%x00%ad%x00%T"
86 + out, _err, status = Open3.capture3(
87 + "git", "--git-dir", path, "show",
88 + "--format=#{format}", "--stat", "--no-patch",
89 + sha
90 + )
91 + return nil unless status.success?
92 + lines = out.split("\n")
93 + parts = lines.first.to_s.split("\x00")
94 + return nil unless parts.length == 8
95 + diff_out, _e, _s = Open3.capture3("git", "--git-dir", path, "show", "--format=", sha)
96 + {
97 + sha: parts[0],
98 + short_sha: parts[1],
99 + subject: parts[2],
100 + body: parts[3],
101 + author_name: parts[4],
102 + author_email: parts[5],
103 + authored_date: (Time.parse(parts[6]) rescue nil),
104 + diff: diff_out
105 + }
106 + end
107 +
108 + def self.readme_content(path, branch)
109 + %w[README.md README.txt README readme.md].each do |name|
110 + content = file_content(path, branch, name)
111 + return { content: content, filename: name } if content
112 + end
113 + nil
114 + end
115 +
116 + def self.branch_exists?(path, branch)
117 + _out, _err, status = Open3.capture3("git", "--git-dir", path, "rev-parse", "--verify", branch)
118 + status.success?
119 + end
120 +
121 + def self.branches(path)
122 + out, _err, status = Open3.capture3("git", "--git-dir", path, "branch", "--format=%(refname:short)")
123 + return [] unless status.success?
124 + out.lines.map(&:strip).reject(&:blank?)
125 + end
126 +
127 + def self.commit_count(path, branch)
128 + out, _err, status = Open3.capture3("git", "--git-dir", path, "rev-list", "--count", branch)
129 + return 0 unless status.success?
130 + out.strip.to_i
131 + end
132 +end
app/services/smbcloud_auth_service.rb new
+150
@@ -0,0 +1,150 @@
1 +# frozen_string_literal: true
2 +
3 +# Thin wrapper around the smbcloud-auth native gem.
4 +#
5 +# The gem (`smbcloud-auth`) is a Magnus/Rust extension that provides
6 +# direct credential-based auth against the smbCloud Auth API. It exposes:
7 +#
8 +# client.login(email:, password:)
9 +# → { status: "ready"|"not_found"|"incomplete",
10 +# access_token: String|nil,
11 +# error_code: Integer|nil,
12 +# message: String|nil }
13 +#
14 +# client.me(access_token:)
15 +# → { id: Integer, email: String, created_at: String, updated_at: String }
16 +#
17 +# client.signup(email:, password:)
18 +# client.logout(access_token:)
19 +# client.remove(access_token:)
20 +#
21 +# Required env vars:
22 +# SMBCLOUD_APP_ID – your smbCloud app ID
23 +# SMBCLOUD_APP_SECRET – your smbCloud app secret
24 +# SMBCLOUD_ENVIRONMENT – "production" (default) or "dev"
25 +#
26 +require "auth"
27 +
28 +class SmbcloudAuthService
29 + class AuthenticationError < StandardError
30 + attr_reader :error_code
31 +
32 + def initialize(message, error_code: nil)
33 + super(message)
34 + @error_code = error_code
35 + end
36 + end
37 +
38 + class AccountNotFoundError < AuthenticationError; end
39 + class AccountIncompleteError < AuthenticationError; end
40 +
41 + # ---------------------------------------------------------------------------
42 + # Client factory
43 + # ---------------------------------------------------------------------------
44 +
45 + def self.client
46 + SmbCloud::Auth::Client.new(
47 + environment: smbcloud_environment,
48 + app_id: smbcloud_app_id,
49 + app_secret: smbcloud_app_secret
50 + )
51 + end
52 +
53 + # ---------------------------------------------------------------------------
54 + # Public API
55 + # ---------------------------------------------------------------------------
56 +
57 + # Authenticates an email/password pair.
58 + #
59 + # Returns the access_token String on success.
60 + # Raises AuthenticationError (or a subclass) on failure.
61 + def self.login(email:, password:)
62 + result = client.login(email: email, password: password)
63 +
64 + case result[:status]
65 + when "ready"
66 + result[:access_token]
67 + when "not_found"
68 + raise AccountNotFoundError.new("No account found for that email address.")
69 + when "incomplete"
70 + raise AccountIncompleteError.new(
71 + result[:message] || "Account setup is incomplete. Please check your email.",
72 + error_code: result[:error_code]
73 + )
74 + else
75 + raise AuthenticationError.new("Unexpected authentication response: #{result[:status]}")
76 + end
77 + rescue SmbCloud::Auth::Error => e
78 + raise AuthenticationError.new(e.message, error_code: e.error_code)
79 + end
80 +
81 + # Fetches the current user's profile from the smbCloud Auth API.
82 + #
83 + # Returns a symbolized hash:
84 + # { id: Integer, email: String, created_at: String, updated_at: String }
85 + def self.me(access_token:)
86 + client.me(access_token: access_token)
87 + rescue SmbCloud::Auth::Error => e
88 + raise AuthenticationError.new(e.message, error_code: e.error_code)
89 + end
90 +
91 + # Registers a new account.
92 + #
93 + # Returns the signup result hash on success.
94 + # Raises AuthenticationError on failure.
95 + def self.signup(email:, password:)
96 + client.signup(email: email, password: password)
97 + rescue SmbCloud::Auth::Error => e
98 + raise AuthenticationError.new(e.message, error_code: e.error_code)
99 + end
100 +
101 + # Invalidates the given access_token on the smbCloud Auth server.
102 + def self.logout(access_token:)
103 + client.logout(access_token: access_token)
104 + rescue SmbCloud::Auth::Error => e
105 + Rails.logger.warn("smbCloud logout error (non-fatal): #{e.message}")
106 + false
107 + end
108 +
109 + # Permanently removes the account from smbCloud Auth.
110 + def self.remove(access_token:)
111 + client.remove(access_token: access_token)
112 + rescue SmbCloud::Auth::Error => e
113 + raise AuthenticationError.new(e.message, error_code: e.error_code)
114 + end
115 +
116 + # ---------------------------------------------------------------------------
117 + # Private helpers
118 + # ---------------------------------------------------------------------------
119 +
120 + def self.smbcloud_environment
121 + raw = if Rails.env.development?
122 + Rails.cache.read("dev:smbcloud_environment") ||
123 + ENV.fetch("SMBCLOUD_ENVIRONMENT", "dev")
124 + else
125 + ENV.fetch("SMBCLOUD_ENVIRONMENT", "production")
126 + end.strip.downcase
127 +
128 + case raw
129 + when "dev", "development" then SmbCloud::Auth::Environment::DEV
130 + when "production" then SmbCloud::Auth::Environment::PRODUCTION
131 + else
132 + Rails.logger.warn("Unknown SMBCLOUD_ENVIRONMENT '#{raw}', defaulting to production.")
133 + SmbCloud::Auth::Environment::PRODUCTION
134 + end
135 + end
136 +
137 + def self.smbcloud_app_id
138 + ENV.fetch("SMBCLOUD_APP_ID") do
139 + raise KeyError, "Missing required env var: SMBCLOUD_APP_ID"
140 + end
141 + end
142 +
143 + def self.smbcloud_app_secret
144 + ENV.fetch("SMBCLOUD_APP_SECRET") do
145 + raise KeyError, "Missing required env var: SMBCLOUD_APP_SECRET"
146 + end
147 + end
148 +
149 + private_class_method :client, :smbcloud_environment, :smbcloud_app_id, :smbcloud_app_secret
150 +end
app/views/blobs/show.html.erb new
+63
@@ -0,0 +1,63 @@
1 +<% content_for :title, "#{@filename} · #{@repository.full_name}" %>
2 +
3 +<div class="border-b border-surface-600 bg-surface-800">
4 + <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
5 + <div class="flex items-center gap-2 text-sm mb-4">
6 + <%= link_to @owner.username, user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
7 + <span class="text-gray-500">/</span>
8 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
9 + </div>
10 + <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">
11 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "breadcrumb-item font-medium" %>
12 + <span class="text-gray-500">/</span>
13 + <% @path_parts[0..-2].each_with_index do |part, i| %>
14 + <% partial_path = @path_parts[0..i].join("/") %>
15 + <%= link_to part, repository_tree_path(@owner.username, @repository.name, @branch, partial_path), class: "breadcrumb-item" %>
16 + <span class="text-gray-500">/</span>
17 + <% end %>
18 + <span class="font-medium text-gray-100"><%= @filename %></span>
19 + </nav>
20 + <div class="flex items-center gap-0 -mb-px">
21 + <div class="tab-item active">Code</div>
22 + </div>
23 + </div>
24 +</div>
25 +
26 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
27 + <div class="card">
28 + <div class="px-4 py-2.5 border-b border-surface-600 flex items-center justify-between bg-surface-600">
29 + <div class="flex items-center gap-3 text-xs text-gray-400">
30 + <span class="font-mono badge-gray"><%= @extension.presence || "text" %></span>
31 + <% unless @is_binary %>
32 + <span><%= number_with_delimiter(@line_count) %> lines</span>
33 + <% end %>
34 + <span><%= number_to_human_size(@file_size) %></span>
35 + </div>
36 + <div class="flex items-center gap-2">
37 + <%= link_to "Raw", repository_blob_raw_path(@owner.username, @repository.name, @branch, @file_path),
38 + class: "btn-ghost text-xs py-1 px-2.5", target: "_blank" %>
39 + </div>
40 + </div>
41 +
42 + <% if @is_binary %>
43 + <div class="px-6 py-10 text-center text-sm text-gray-400">
44 + Binary file — <%= number_to_human_size(@file_size) %>
45 + </div>
46 + <% else %>
47 + <div class="code-container rounded-none border-0 relative">
48 + <table class="w-full">
49 + <tbody>
50 + <% @raw_content.lines.each_with_index do |line, i| %>
51 + <tr class="hover:bg-brand-500/10">
52 + <td class="text-right text-gray-500 pr-4 pl-4 py-0 select-none w-10 text-xs border-r border-surface-600 align-top" id="L<%= i+1 %>">
53 + <a href="#L<%= i+1 %>" class="hover:text-brand-500"><%= i+1 %></a>
54 + </td>
55 + <td class="pl-4 pr-4 py-0 font-mono text-xs leading-5 whitespace-pre-wrap break-all text-gray-200"><%= line %></td>
56 + </tr>
57 + <% end %>
58 + </tbody>
59 + </table>
60 + </div>
61 + <% end %>
62 + </div>
63 +</div>
app/views/commits/index.html.erb new
+62
@@ -0,0 +1,62 @@
1 +<% content_for :title, "Commits · #{@repository.full_name}" %>
2 +
3 +<div class="border-b border-surface-600 bg-surface-800">
4 + <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
5 + <div class="flex items-center gap-2 text-sm mb-4">
6 + <%= link_to @owner.username, user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
7 + <span class="text-gray-500">/</span>
8 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
9 + </div>
10 + <div class="flex items-center gap-0 -mb-px">
11 + <%= link_to repository_path(@owner.username, @repository.name), class: "tab-item flex items-center gap-1.5" do %>Code<% end %>
12 + <div class="tab-item active flex items-center gap-1.5">
13 + Commits
14 + <span class="badge-gray"><%= number_with_delimiter(@total) %></span>
15 + </div>
16 + </div>
17 + </div>
18 +</div>
19 +
20 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
21 + <div class="card">
22 + <% @commits.each do |commit| %>
23 + <div class="commit-row">
24 + <div class="min-w-0 flex-1">
25 + <p class="text-sm font-medium text-gray-100 truncate">
26 + <%= link_to commit[:subject],
27 + repository_commit_path(@owner.username, @repository.name, commit[:sha]),
28 + class: "hover:text-brand-500" %>
29 + </p>
30 + <p class="text-xs text-gray-400 mt-0.5">
31 + <span class="font-medium"><%= commit[:author_name] %></span>
32 + committed <%= time_ago_in_words(commit[:authored_date]) %> ago
33 + </p>
34 + </div>
35 + <div class="shrink-0 ml-4 flex items-center gap-3">
36 + <%= link_to commit[:short_sha],
37 + repository_commit_path(@owner.username, @repository.name, commit[:sha]),
38 + class: "font-mono text-xs badge-gray hover:bg-surface-500" %>
39 + </div>
40 + </div>
41 + <% end %>
42 +
43 + <% if @commits.empty? %>
44 + <div class="px-4 py-12 text-center text-sm text-gray-400">No commits yet.</div>
45 + <% end %>
46 + </div>
47 +
48 + <!-- Pagination -->
49 + <% if @total_pages > 1 %>
50 + <div class="mt-6 flex items-center justify-center gap-2">
51 + <% if @page > 1 %>
52 + <%= link_to "← Newer", repository_commits_path(@owner.username, @repository.name, @branch, page: @page - 1),
53 + class: "btn-secondary text-xs" %>
54 + <% end %>
55 + <span class="text-xs text-gray-400">Page <%= @page %> of <%= @total_pages %></span>
56 + <% if @page < @total_pages %>
57 + <%= link_to "Older →", repository_commits_path(@owner.username, @repository.name, @branch, page: @page + 1),
58 + class: "btn-secondary text-xs" %>
59 + <% end %>
60 + </div>
61 + <% end %>
62 +</div>
app/views/commits/show.html.erb new
+44
@@ -0,0 +1,44 @@
1 +<% content_for :title, "#{@commit[:short_sha]} · #{@repository.full_name}" %>
2 +
3 +<div class="border-b border-surface-600 bg-surface-800">
4 + <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-4">
5 + <div class="flex items-center gap-2 text-sm mb-3">
6 + <%= link_to @owner.username, user_profile_path(@owner.username), class: "text-brand-500 hover:underline font-medium" %>
7 + <span class="text-gray-500">/</span>
8 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name), class: "text-brand-500 hover:underline font-semibold" %>
9 + </div>
10 + <h1 class="text-xl font-semibold text-gray-100 mb-1"><%= @commit[:subject] %></h1>
11 + <% if @commit[:body].present? && @commit[:body] != @commit[:subject] %>
12 + <p class="text-sm text-gray-400 whitespace-pre-line mb-3"><%= @commit[:body].delete_prefix(@commit[:subject]).strip %></p>
13 + <% end %>
14 + <div class="flex items-center gap-4 text-xs text-gray-400">
15 + <span><strong class="text-gray-300"><%= @commit[:author_name] %></strong> committed</span>
16 + <% if @commit[:authored_date] %>
17 + <span><%= @commit[:authored_date].strftime("%b %-d, %Y at %H:%M UTC") %></span>
18 + <% end %>
19 + <span class="font-mono badge-gray"><%= @commit[:sha] %></span>
20 + </div>
21 + </div>
22 +</div>
23 +
24 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
25 + <% if @commit[:diff].present? %>
26 + <div class="card">
27 + <div class="px-4 py-2.5 border-b border-surface-600 bg-surface-600 text-xs font-medium text-gray-400">Diff</div>
28 + <div class="code-container rounded-none border-0 font-mono text-xs leading-5 overflow-x-auto">
29 + <% @commit[:diff].lines.each do |line| %>
30 + <% css = if line.start_with?("+") && !line.start_with?("+++")
31 + "diff-add block px-4"
32 + elsif line.start_with?("-") && !line.start_with?("---")
33 + "diff-remove block px-4"
34 + elsif line.start_with?("@@")
35 + "diff-header block px-4"
36 + else
37 + "block px-4 text-gray-400"
38 + end %>
39 + <span class="<%= css %>"><%= line %></span>
40 + <% end %>
41 + </div>
42 + </div>
43 + <% end %>
44 +</div>
app/views/layouts/application.html.erb new
+42
@@ -0,0 +1,42 @@
1 +<!DOCTYPE html>
2 +<html lang="en" class="h-full">
3 + <head>
4 + <meta charset="utf-8">
5 + <meta name="viewport" content="width=device-width, initial-scale=1">
6 + <meta name="color-scheme" content="dark">
7 + <meta name="theme-color" content="#1a1d21">
8 + <meta name="description" content="siGit — quiet Git hosting">
9 + <title><%= content_for?(:title) ? "#{yield(:title)} · siGit" : "siGit" %></title>
10 + <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>
11 + <%= javascript_importmap_tags %>
12 + <%= csrf_meta_tags %>
13 + </head>
14 +
15 + <body class="h-full bg-surface-900">
16 + <%= render "shared/navbar" %>
17 +
18 + <% if notice.present? %>
19 + <div class="bg-green-900/20 border-b border-green-800/40 px-4 py-3 text-sm text-green-300 text-center" role="alert">
20 + <%= notice %>
21 + </div>
22 + <% end %>
23 + <% if alert.present? %>
24 + <div class="bg-amber-900/20 border-b border-amber-800/40 px-4 py-3 text-sm text-amber-300 text-center" role="alert">
25 + <%= alert %>
26 + </div>
27 + <% end %>
28 +
29 + <main>
30 + <%= yield %>
31 + </main>
32 +
33 + <%= render "shared/dev_panel" if Rails.env.development? %>
34 +
35 + <footer class="border-t border-surface-600 mt-16">
36 + <div class="max-w-6xl mx-auto px-4 sm:px-6 py-8 flex items-center justify-between text-xs text-gray-500">
37 + <span>siGit</span>
38 + <span>Made with <a href="https://rubyonrails.org" class="hover:text-gray-300">Rails 8</a></span>
39 + </div>
40 + </footer>
41 + </body>
42 +</html>
app/views/layouts/mailer.html.erb new
+13
@@ -0,0 +1,13 @@
1 +<!DOCTYPE html>
2 +<html>
3 + <head>
4 + <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5 + <style>
6 + /* Email styles need to be inline */
7 + </style>
8 + </head>
9 +
10 + <body>
11 + <%= yield %>
12 + </body>
13 +</html>
app/views/layouts/mailer.text.erb new
+1
@@ -0,0 +1 @@
1 +<%= yield %>
app/views/pages/dashboard.html.erb new
+67
@@ -0,0 +1,67 @@
1 +<% content_for :title, "Dashboard" %>
2 +
3 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-8">
4 + <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">
5 +
6 + <aside class="lg:col-span-1">
7 + <div class="text-center sm:text-left">
8 + <img src="<%= current_user.avatar_url_or_default %>"
9 + alt="<%= current_user.display_name_or_username %>"
10 + class="w-20 h-20 rounded-full border border-surface-600 mx-auto sm:mx-0 mb-4">
11 + <h2 class="font-semibold text-gray-100 text-base"><%= current_user.display_name_or_username %></h2>
12 + <p class="text-sm text-gray-400"><%= current_user.username %></p>
13 + </div>
14 + <div class="mt-6">
15 + <%= link_to new_repository_path, class: "btn-secondary w-full justify-center" do %>
16 + <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
17 + <path d="M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z"/>
18 + </svg>
19 + New repository
20 + <% end %>
21 + </div>
22 + </aside>
23 +
24 + <main class="lg:col-span-3">
25 + <div class="flex items-center justify-between mb-4">
26 + <h1 class="text-base font-semibold text-gray-100">Your repositories</h1>
27 + <%= link_to user_profile_path(current_user.username),
28 + class: "text-xs text-brand-500 hover:underline" do %>View all<% end %>
29 + </div>
30 +
31 + <% if @repositories.any? %>
32 + <div class="card divide-y divide-surface-600">
33 + <% @repositories.each do |repo| %>
34 + <div class="px-4 py-3 hover:bg-surface-600 transition-colors">
35 + <div class="flex items-start justify-between gap-4">
36 + <div class="min-w-0 flex-1">
37 + <%= link_to repository_path(current_user.username, repo.name),
38 + class: "font-medium text-brand-500 hover:underline text-sm" do %><%= repo.name %><% end %>
39 + <% if repo.description.present? %>
40 + <p class="text-xs text-gray-400 mt-0.5 truncate"><%= repo.description %></p>
41 + <% end %>
42 + </div>
43 + <div class="flex items-center gap-3 text-xs text-gray-500 shrink-0">
44 + <% if repo.is_private %>
45 + <span class="badge-gray">Private</span>
46 + <% end %>
47 + <span><%= time_ago_in_words(repo.updated_at) %> ago</span>
48 + </div>
49 + </div>
50 + </div>
51 + <% end %>
52 + </div>
53 + <% else %>
54 + <div class="card px-6 py-12 text-center">
55 + <svg class="w-12 h-12 mx-auto text-gray-600 mb-4" viewBox="0 0 24 24"
56 + fill="none" stroke="currentColor" stroke-width="1">
57 + <path stroke-linecap="round" stroke-linejoin="round"
58 + d="M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"/>
59 + </svg>
60 + <p class="text-sm text-gray-400 mb-4">No repositories yet.</p>
61 + <%= link_to new_repository_path, class: "btn-primary" do %>Create your first repository<% end %>
62 + </div>
63 + <% end %>
64 + </main>
65 +
66 + </div>
67 +</div>
app/views/pages/home.html.erb new
+62
@@ -0,0 +1,62 @@
1 +<% content_for :title, "Welcome" %>
2 +
3 +<div class="min-h-screen bg-surface-900">
4 + <section class="border-b border-surface-600 bg-surface-800">
5 + <div class="max-w-6xl mx-auto px-4 sm:px-6 py-20 sm:py-28">
6 + <div class="max-w-3xl">
7 + <div class="mb-8 inline-flex items-center gap-3 rounded-full border border-surface-500 bg-surface-700 px-3 py-1.5 text-xs font-medium uppercase tracking-[0.18em] text-gray-400">
8 + <img src="/icon.png" alt="siGit" class="h-5 w-auto shrink-0">
9 + <span>Quiet Git hosting</span>
10 + </div>
11 +
12 + <h1 class="max-w-2xl text-4xl font-semibold tracking-tight text-gray-100 sm:text-6xl">
13 + Git hosting that stays out of the way.
14 + </h1>
15 +
16 + <p class="mt-6 max-w-xl text-base leading-7 text-gray-400 sm:text-lg">
17 + siGit gives you repositories, history, diffs, and a calm place to read code.
18 + Nothing loud. Nothing extra.
19 + </p>
20 +
21 + <div class="mt-10 flex flex-col gap-3 sm:flex-row">
22 + <%= link_to "Sign in", signin_path, class: "btn-primary px-6 py-3 text-sm justify-center" %>
23 + <a href="#features" class="btn-secondary px-6 py-3 text-sm justify-center">See what it does</a>
24 + </div>
25 + </div>
26 + </div>
27 + </section>
28 +
29 + <section id="features" class="max-w-6xl mx-auto px-4 sm:px-6 py-16 sm:py-20">
30 + <div class="grid grid-cols-1 gap-px overflow-hidden rounded-sm border border-surface-500 bg-surface-500 sm:grid-cols-3">
31 + <div class="bg-surface-800 p-8 sm:p-10">
32 + <div class="mb-6 flex h-10 w-10 items-center justify-center rounded-sm border border-surface-500 bg-surface-700 text-brand-500">
33 + <span class="text-lg font-semibold">01</span>
34 + </div>
35 + <h2 class="text-lg font-semibold text-gray-100">Host your repos</h2>
36 + <p class="mt-3 text-sm leading-6 text-gray-400">
37 + Create repositories, keep them public or private, and get on with the work.
38 + </p>
39 + </div>
40 +
41 + <div class="bg-surface-800 p-8 sm:p-10">
42 + <div class="mb-6 flex h-10 w-10 items-center justify-center rounded-sm border border-surface-500 bg-surface-700 text-brand-500">
43 + <span class="text-lg font-semibold">02</span>
44 + </div>
45 + <h2 class="text-lg font-semibold text-gray-100">Read your code</h2>
46 + <p class="mt-3 text-sm leading-6 text-gray-400">
47 + Browse files, inspect commits, and read diffs without fighting the interface.
48 + </p>
49 + </div>
50 +
51 + <div class="bg-surface-800 p-8 sm:p-10">
52 + <div class="mb-6 flex h-10 w-10 items-center justify-center rounded-sm border border-surface-500 bg-surface-700 text-brand-500">
53 + <span class="text-lg font-semibold">03</span>
54 + </div>
55 + <h2 class="text-lg font-semibold text-gray-100">Keep it simple</h2>
56 + <p class="mt-3 text-sm leading-6 text-gray-400">
57 + A dark, steady workspace built for long sessions and fewer distractions.
58 + </p>
59 + </div>
60 + </div>
61 + </section>
62 +</div>
app/views/pwa/manifest.json.erb new
+22
@@ -0,0 +1,22 @@
1 +{
2 + "name": "Sigitsi",
3 + "icons": [
4 + {
5 + "src": "/icon.png",
6 + "type": "image/png",
7 + "sizes": "512x512"
8 + },
9 + {
10 + "src": "/icon.png",
11 + "type": "image/png",
12 + "sizes": "512x512",
13 + "purpose": "maskable"
14 + }
15 + ],
16 + "start_url": "/",
17 + "display": "standalone",
18 + "scope": "/",
19 + "description": "Sigitsi.",
20 + "theme_color": "red",
21 + "background_color": "red"
22 +}
app/views/pwa/service-worker.js new
+26
@@ -0,0 +1,26 @@
1 +// Add a service worker for processing Web Push notifications:
2 +//
3 +// self.addEventListener("push", async (event) => {
4 +// const { title, options } = await event.data.json()
5 +// event.waitUntil(self.registration.showNotification(title, options))
6 +// })
7 +//
8 +// self.addEventListener("notificationclick", function(event) {
9 +// event.notification.close()
10 +// event.waitUntil(
11 +// clients.matchAll({ type: "window" }).then((clientList) => {
12 +// for (let i = 0; i < clientList.length; i++) {
13 +// let client = clientList[i]
14 +// let clientPath = (new URL(client.url)).pathname
15 +//
16 +// if (clientPath == event.notification.data.path && "focus" in client) {
17 +// return client.focus()
18 +// }
19 +// }
20 +//
21 +// if (clients.openWindow) {
22 +// return clients.openWindow(event.notification.data.path)
23 +// }
24 +// })
25 +// )
26 +// })
app/views/registrations/new.html.erb new
+69
@@ -0,0 +1,69 @@
1 +<% content_for :title, "Create account" %>
2 +
3 +<div class="min-h-screen bg-surface-900 flex flex-col items-center justify-center px-4 py-16">
4 +
5 + <div class="mb-10 flex flex-col items-center gap-3">
6 + <%= link_to root_path, class: "flex items-center gap-3 text-gray-100 hover:text-brand-500 transition-colors" do %>
7 + <img src="/icon.png" alt="siGit" class="h-9 w-auto">
8 + <span class="text-xl font-semibold tracking-tight">siGit</span>
9 + <% end %>
10 + <p class="text-sm text-gray-500">Create your account</p>
11 + </div>
12 +
13 + <div class="w-full max-w-sm">
14 + <div class="border border-surface-500 rounded bg-surface-700 px-8 py-8">
15 +
16 + <% if flash[:alert].present? %>
17 + <div class="mb-5 flex items-start gap-2.5 rounded border border-red-800/40 bg-red-900/20 px-3.5 py-3 text-sm text-red-400" role="alert">
18 + <svg class="w-4 h-4 mt-0.5 shrink-0" viewBox="0 0 16 16" fill="currentColor">
19 + <path d="M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 3.75a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0v-3.5A.75.75 0 0 0 8 4.75zm0 7.5a.875.875 0 1 0 0-1.75.875.875 0 0 0 0 1.75z"/>
20 + </svg>
21 + <span><%= flash[:alert] %></span>
22 + </div>
23 + <% end %>
24 +
25 + <%= form_tag signup_create_path, method: :post, class: "space-y-5" do %>
26 +
27 + <div>
28 + <label for="email" class="form-label">Email</label>
29 + <input type="email" id="email" name="email"
30 + class="form-input"
31 + autocomplete="email"
32 + value="<%= params[:email].to_s %>"
33 + placeholder="you@example.com"
34 + autofocus required>
35 + </div>
36 +
37 + <div>
38 + <label for="password" class="form-label">Password</label>
39 + <input type="password" id="password" name="password"
40 + class="form-input"
41 + autocomplete="new-password"
42 + minlength="8"
43 + placeholder="At least 8 characters"
44 + required>
45 + </div>
46 +
47 + <div>
48 + <label for="password_confirmation" class="form-label">Confirm password</label>
49 + <input type="password" id="password_confirmation" name="password_confirmation"
50 + class="form-input"
51 + autocomplete="new-password"
52 + placeholder="Same password again"
53 + required>
54 + </div>
55 +
56 + <button type="submit" class="btn-primary w-full justify-center py-2.5 mt-2">
57 + Create account
58 + </button>
59 +
60 + <% end %>
61 + </div>
62 +
63 + <p class="mt-6 text-center text-xs text-gray-500">
64 + Already have an account?
65 + <%= link_to "Sign in", signin_path, class: "text-gray-400 hover:text-gray-200 underline underline-offset-2" %>
66 + </p>
67 + </div>
68 +
69 +</div>
app/views/repositories/new.html.erb new
+80
@@ -0,0 +1,80 @@
1 +<% content_for :title, "New repository" %>
2 +
3 +<div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">
4 + <h1 class="text-xl font-semibold text-gray-100 mb-2">Create a new repository</h1>
5 + <p class="text-sm text-gray-400 mb-8">All your files and their history, in one place.</p>
6 +
7 + <%= form_with model: @repository, url: "/new", method: :post, class: "space-y-6" do |f| %>
8 + <% if @repository.errors.any? %>
9 + <div class="border border-red-800/40 bg-red-900/20 rounded px-4 py-3">
10 + <p class="text-sm font-medium text-red-300 mb-1">Please fix the following errors:</p>
11 + <ul class="list-disc pl-4 space-y-0.5">
12 + <% @repository.errors.full_messages.each do |msg| %>
13 + <li class="text-sm text-red-400"><%= msg %></li>
14 + <% end %>
15 + </ul>
16 + </div>
17 + <% end %>
18 +
19 + <div class="flex items-end gap-2">
20 + <div class="flex-1 min-w-0">
21 + <label class="form-label">Owner</label>
22 + <div class="flex items-center gap-2 form-input bg-surface-700 text-gray-400 cursor-not-allowed">
23 + <img src="<%= current_user.avatar_url_or_default %>" class="w-4 h-4 rounded-full">
24 + <span><%= current_user.username %></span>
25 + </div>
26 + </div>
27 + <div class="flex items-center pb-2.5 text-gray-500 font-light text-lg">/</div>
28 + <div class="flex-1 min-w-0">
29 + <%= f.label :name, "Repository name", class: "form-label" %>
30 + <%= f.text_field :name, class: "form-input", placeholder: "my-project", autofocus: true,
31 + pattern: "[a-zA-Z0-9._-]+",
32 + title: "Letters, numbers, hyphens, underscores, and dots only" %>
33 + </div>
34 + </div>
35 +
36 + <div>
37 + <%= f.label :description, "Description", class: "form-label" %>
38 + <span class="text-xs text-gray-500 ml-1">(optional)</span>
39 + <%= f.text_area :description, class: "form-input", rows: 2,
40 + placeholder: "Short description of your project" %>
41 + </div>
42 +
43 + <div class="border border-surface-500 rounded divide-y divide-surface-600">
44 + <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-surface-600">
45 + <%= f.radio_button :is_private, false, class: "mt-0.5" %>
46 + <div>
47 + <div class="flex items-center gap-2">
48 + <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">
49 + <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
50 + </svg>
51 + <span class="text-sm font-medium text-gray-100">Public</span>
52 + </div>
53 + <p class="text-xs text-gray-400 mt-0.5">Anyone can see this repository.</p>
54 + </div>
55 + </label>
56 + <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-surface-600">
57 + <%= f.radio_button :is_private, true, class: "mt-0.5" %>
58 + <div>
59 + <div class="flex items-center gap-2">
60 + <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">
61 + <path d="M4 4a4 4 0 0 1 8 0v2h.25c.966 0 1.75.784 1.75 1.75v5.5A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-5.5C2 6.784 2.784 6 3.75 6H4Zm8.25 3.5h-8.5a.25.25 0 0 0-.25.25v5.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5.5a.25.25 0 0 0-.25-.25ZM10.5 6V4a2.5 2.5 0 1 0-5 0v2Z"/>
62 + </svg>
63 + <span class="text-sm font-medium text-gray-100">Private</span>
64 + </div>
65 + <p class="text-xs text-gray-400 mt-0.5">Only you can see this repository.</p>
66 + </div>
67 + </label>
68 + </div>
69 +
70 + <div>
71 + <%= f.label :default_branch, "Default branch", class: "form-label" %>
72 + <%= f.text_field :default_branch, class: "form-input max-w-xs", value: "main" %>
73 + </div>
74 +
75 + <div class="pt-2 border-t border-surface-600 flex items-center gap-3">
76 + <%= f.submit "Create repository", class: "btn-primary cursor-pointer" %>
77 + <%= link_to "Cancel", root_path, class: "btn-ghost" %>
78 + </div>
79 + <% end %>
80 +</div>
app/views/repositories/show.html.erb new
+138
@@ -0,0 +1,138 @@
1 +<% content_for :title, @repository.full_name %>
2 +
3 +<div class="border-b border-surface-600 bg-surface-800">
4 + <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
5 +
6 + <div class="flex items-center gap-2 text-sm mb-4">
7 + <svg class="w-4 h-4 text-gray-500" viewBox="0 0 16 16" fill="currentColor">
8 + <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
9 + </svg>
10 + <%= link_to @owner.username, user_profile_path(@owner.username),
11 + class: "text-brand-500 hover:underline font-medium" %>
12 + <span class="text-gray-500">/</span>
13 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
14 + class: "text-brand-500 hover:underline font-semibold" %>
15 + <% if @repository.is_private %>
16 + <span class="badge-gray ml-1">Private</span>
17 + <% end %>
18 + </div>
19 +
20 + <% if @repository.description.present? %>
21 + <p class="text-sm text-gray-400 mb-4"><%= @repository.description %></p>
22 + <% end %>
23 +
24 + <div class="flex items-center gap-0 -mb-px">
25 + <%= link_to repository_path(@owner.username, @repository.name),
26 + class: "tab-item active flex items-center gap-1.5" do %>
27 + <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
28 + <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
29 + </svg>
30 + Code
31 + <% end %>
32 + <% if @repository.initialized? %>
33 + <%= link_to repository_commits_path(@owner.username, @repository.name,
34 + @branch || @repository.default_branch),
35 + class: "tab-item flex items-center gap-1.5" do %>
36 + <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
37 + <path d="M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"/>
38 + </svg>
39 + Commits
40 + <% if @commit_count&.> 0 %>
41 + <span class="badge-gray text-xs"><%= number_with_delimiter(@commit_count) %></span>
42 + <% end %>
43 + <% end %>
44 + <% end %>
45 + </div>
46 + </div>
47 +</div>
48 +
49 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
50 + <% if @empty %>
51 + <div class="card p-8 text-center max-w-2xl mx-auto">
52 + <svg class="w-16 h-16 mx-auto text-gray-600 mb-5" viewBox="0 0 24 24"
53 + fill="none" stroke="currentColor" stroke-width="1"
54 + stroke-linecap="round" stroke-linejoin="round">
55 + <path d="M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7A3.37 3.37 0 0 0 9 18.13V22"/>
56 + </svg>
57 + <h2 class="text-lg font-semibold text-gray-100 mb-2">This repository is empty</h2>
58 + <p class="text-sm text-gray-400 mb-6">Push something and it'll show up here.</p>
59 + <div class="code-container text-left p-4 max-w-lg mx-auto text-xs font-mono space-y-0.5">
60 + <p class="text-gray-500 mb-1"># Clone and push</p>
61 + <p class="text-gray-300">git clone git@sigitsi.com:<%= @owner.username %>/<%= @repository.name %></p>
62 + <p class="text-gray-300">cd <%= @repository.name %></p>
63 + <p class="text-gray-300">echo "# <%= @repository.name %>" &gt; README.md</p>
64 + <p class="text-gray-300">git add . &amp;&amp; git commit -m "Initial commit"</p>
65 + <p class="text-gray-300">git push origin main</p>
66 + </div>
67 + </div>
68 + <% else %>
69 +
70 + <div class="card rounded-b-none border-b-0 px-4 py-2.5
71 + flex items-center justify-between gap-4 bg-surface-600">
72 + <div class="flex items-center gap-3">
73 + <span class="btn-secondary py-1 px-3 text-xs font-mono flex items-center gap-1.5 cursor-default">
74 + <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
75 + <path d="M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"/>
76 + </svg>
77 + <%= @branch %>
78 + </span>
79 + <% if @recent_commits.first %>
80 + <% commit = @recent_commits.first %>
81 + <span class="text-xs text-gray-400">
82 + <%= link_to commit[:short_sha],
83 + repository_commit_path(@owner.username, @repository.name, commit[:sha]),
84 + class: "font-mono text-brand-500 hover:underline" %>
85 + &middot; <%= commit[:subject] %>
86 + &middot; <span class="text-gray-500"><%= time_ago_in_words(commit[:authored_date]) %> ago</span>
87 + </span>
88 + <% end %>
89 + </div>
90 + <div class="flex items-center gap-3 text-xs text-gray-400">
91 + <%= link_to repository_commits_path(@owner.username, @repository.name, @branch),
92 + class: "flex items-center gap-1 hover:text-gray-200" do %>
93 + <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
94 + <path d="M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"/>
95 + </svg>
96 + <%= number_with_delimiter(@commit_count) %> commits
97 + <% end %>
98 + </div>
99 + </div>
100 +
101 + <div class="card rounded-t-none">
102 + <% @tree.each do |entry| %>
103 + <div class="file-row">
104 + <% if entry[:type] == "tree" %>
105 + <svg class="w-4 h-4 text-brand-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">
106 + <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"/>
107 + </svg>
108 + <%= link_to entry[:name],
109 + repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),
110 + class: "text-brand-500 hover:underline font-medium flex-1" %>
111 + <% else %>
112 + <svg class="w-4 h-4 text-gray-500 shrink-0" viewBox="0 0 16 16" fill="currentColor">
113 + <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"/>
114 + </svg>
115 + <%= link_to entry[:name],
116 + repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),
117 + class: "text-gray-200 hover:text-brand-500 hover:underline flex-1" %>
118 + <% end %>
119 + </div>
120 + <% end %>
121 + </div>
122 +
123 + <% if @readme_html %>
124 + <div class="card mt-6">
125 + <div class="px-4 py-3 border-b border-surface-600 flex items-center gap-2 bg-surface-600">
126 + <svg class="w-4 h-4 text-gray-500" viewBox="0 0 16 16" fill="currentColor">
127 + <path d="M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75a.75.75 0 0 1-.75-.75Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9h3.757a3.75 3.75 0 0 1 1.994.574ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"/>
128 + </svg>
129 + <span class="text-xs font-medium text-gray-400"><%= @readme_filename %></span>
130 + </div>
131 + <div class="px-6 py-6 prose-readme">
132 + <%= @readme_html %>
133 + </div>
134 + </div>
135 + <% end %>
136 +
137 + <% end %>
138 +</div>
app/views/repositories/tree.html.erb new
+65
@@ -0,0 +1,65 @@
1 +<% content_for :title, "#{@current_path} · #{@repository.full_name}" %>
2 +
3 +<div class="border-b border-surface-600 bg-surface-800">
4 + <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">
5 +
6 + <div class="flex items-center gap-2 text-sm mb-3">
7 + <%= link_to @owner.username, user_profile_path(@owner.username),
8 + class: "text-brand-500 hover:underline font-medium" %>
9 + <span class="text-gray-500">/</span>
10 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
11 + class: "text-brand-500 hover:underline font-semibold" %>
12 + </div>
13 +
14 + <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">
15 + <%= link_to @repository.name, repository_path(@owner.username, @repository.name),
16 + class: "breadcrumb-item font-medium" %>
17 + <span class="text-gray-500">/</span>
18 + <% @path_parts.each_with_index do |part, i| %>
19 + <% partial_path = @path_parts[0..i].join("/") %>
20 + <% if i < @path_parts.length - 1 %>
21 + <%= link_to part,
22 + repository_tree_path(@owner.username, @repository.name, @branch, partial_path),
23 + class: "breadcrumb-item" %>
24 + <span class="text-gray-500">/</span>
25 + <% else %>
26 + <span class="font-medium text-gray-100"><%= part %></span>
27 + <% end %>
28 + <% end %>
29 + </nav>
30 +
31 + <div class="flex items-center gap-0 -mb-px">
32 + <%= link_to repository_path(@owner.username, @repository.name),
33 + class: "tab-item flex items-center gap-1.5" do %>
34 + <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">
35 + <path d="M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"/>
36 + </svg>
37 + Code
38 + <% end %>
39 + </div>
40 + </div>
41 +</div>
42 +
43 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">
44 + <div class="card">
45 + <% @tree.each do |entry| %>
46 + <div class="file-row">
47 + <% if entry[:type] == "tree" %>
48 + <svg class="w-4 h-4 text-brand-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">
49 + <path d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"/>
50 + </svg>
51 + <%= link_to entry[:name],
52 + repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),
53 + class: "text-brand-500 hover:underline font-medium flex-1" %>
54 + <% else %>
55 + <svg class="w-4 h-4 text-gray-500 shrink-0" viewBox="0 0 16 16" fill="currentColor">
56 + <path d="M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513l2.914 2.914c.329.328.513.773.513 1.237v9.586A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"/>
57 + </svg>
58 + <%= link_to entry[:name],
59 + repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),
60 + class: "text-gray-200 hover:text-brand-500 hover:underline flex-1" %>
61 + <% end %>
62 + </div>
63 + <% end %>
64 + </div>
65 +</div>
app/views/sessions/new.html.erb new
+56
@@ -0,0 +1,56 @@
1 +<% content_for :title, "Sign in" %>
2 +
3 +<div class="min-h-screen bg-surface-900 flex flex-col items-center justify-center px-4 py-16">
4 +
5 + <div class="mb-10 flex flex-col items-center gap-3">
6 + <%= link_to root_path, class: "flex items-center gap-3 text-gray-100 hover:text-brand-500 transition-colors" do %>
7 + <img src="/icon.png" alt="siGit" class="h-9 w-auto">
8 + <span class="text-xl font-semibold tracking-tight">siGit</span>
9 + <% end %>
10 + <p class="text-sm text-gray-500">Sign in to continue</p>
11 + </div>
12 +
13 + <div class="w-full max-w-sm">
14 + <div class="border border-surface-500 rounded bg-surface-700 px-8 py-8">
15 +
16 + <% if flash[:alert].present? %>
17 + <div class="mb-5 flex items-start gap-2.5 rounded border border-red-800/40 bg-red-900/20 px-3.5 py-3 text-sm text-red-400" role="alert">
18 + <svg class="w-4 h-4 mt-0.5 shrink-0" viewBox="0 0 16 16" fill="currentColor">
19 + <path d="M8 1a7 7 0 1 1 0 14A7 7 0 0 1 8 1zm0 3.75a.75.75 0 0 0-.75.75v3.5a.75.75 0 0 0 1.5 0v-3.5A.75.75 0 0 0 8 4.75zm0 7.5a.875.875 0 1 0 0-1.75.875.875 0 0 0 0 1.75z"/>
20 + </svg>
21 + <span><%= flash[:alert] %></span>
22 + </div>
23 + <% end %>
24 +
25 + <%= form_tag auth_create_path, method: :post, class: "space-y-5" do %>
26 +
27 + <div>
28 + <label for="email" class="form-label">Email</label>
29 + <input type="email" id="email" name="email"
30 + class="form-input" autocomplete="email"
31 + value="<%= params[:email].to_s %>"
32 + placeholder="you@example.com"
33 + autofocus required>
34 + </div>
35 +
36 + <div>
37 + <label for="password" class="form-label">Password</label>
38 + <input type="password" id="password" name="password"
39 + class="form-input" autocomplete="current-password"
40 + required>
41 + </div>
42 +
43 + <button type="submit" class="btn-primary w-full justify-center py-2.5 mt-2">
44 + Sign in
45 + </button>
46 +
47 + <% end %>
48 + </div>
49 +
50 + <p class="mt-6 text-center text-xs text-gray-500">
51 + No account?
52 + <%= link_to "Create one", signup_path, class: "text-gray-400 hover:text-gray-200 underline underline-offset-2" %>
53 + </p>
54 + </div>
55 +
56 +</div>
app/views/shared/_dev_panel.html.erb new
+15
@@ -0,0 +1,15 @@
1 +<div data-controller="dev-panel"
2 + class="fixed bottom-4 right-4 z-[9999] flex flex-col items-end gap-2">
3 +
4 + <%# The dropdown — Stimulus renders content into this target %>
5 + <div data-dev-panel-target="panel" class="hidden"></div>
6 +
7 + <%# Toggle button — terminal icon %>
8 + <button data-action="click->dev-panel#toggle"
9 + aria-label="Toggle dev panel"
10 + class="flex h-8 w-8 items-center justify-center rounded-full border border-surface-500 bg-surface-700 text-gray-400 shadow-lg transition-colors hover:border-brand-500 hover:text-brand-500">
11 + <svg class="h-4 w-4" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true">
12 + <path fill-rule="evenodd" d="M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5A1.75 1.75 0 0 0 16 13.25V2.75A1.75 1.75 0 0 0 14.25 1ZM2.5 4.75a.75.75 0 0 1 .75-.75h10.5a.75.75 0 0 1 0 1.5H3.25a.75.75 0 0 1-.75-.75Zm1.28 2.97a.75.75 0 1 0-1.06 1.06l1.72 1.72-1.72 1.72a.75.75 0 1 0 1.06 1.06l2.25-2.25a.75.75 0 0 0 0-1.06L3.78 7.72ZM7.25 10a.75.75 0 0 0 0 1.5h3.5a.75.75 0 0 0 0-1.5h-3.5Z" clip-rule="evenodd"/>
13 + </svg>
14 + </button>
15 +</div>
app/views/shared/_navbar.html.erb new
+63
@@ -0,0 +1,63 @@
1 +<header class="border-b border-surface-600 bg-surface-800 sticky top-0 z-50">
2 + <nav class="max-w-6xl mx-auto px-4 sm:px-6 h-14 flex items-center justify-between gap-6">
3 +
4 + <div class="flex items-center gap-6">
5 + <%= link_to root_path, class: "flex items-center gap-2 text-gray-100 hover:text-brand-500 transition-colors" do %>
6 + <img src="/icon.png" alt="siGit" class="h-6 w-auto">
7 + <span class="font-semibold text-base tracking-tight">siGit</span>
8 + <% end %>
9 +
10 + <% if signed_in? %>
11 + <div class="hidden sm:flex items-center gap-1">
12 + <%= link_to "Explore", "#", class: "nav-link px-2 py-1 rounded hover:bg-surface-600" %>
13 + </div>
14 + <% end %>
15 + </div>
16 +
17 + <div class="flex items-center gap-3">
18 + <% if signed_in? %>
19 + <%= link_to new_repository_path, class: "btn-secondary text-xs py-1.5 px-3 hidden sm:inline-flex" do %>
20 + <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">
21 + <path d="M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75A.75.75 0 0 1 7.75 2Z"/>
22 + </svg>
23 + New
24 + <% end %>
25 +
26 + <div class="relative group">
27 + <button class="flex items-center gap-2 hover:opacity-80 transition-opacity">
28 + <img src="<%= current_user.avatar_url_or_default %>"
29 + alt="<%= current_user.display_name_or_username %>"
30 + class="w-7 h-7 rounded-full border border-surface-500">
31 + <span class="text-sm font-medium text-gray-300 hidden sm:block"><%= current_user.username %></span>
32 + <svg class="w-3.5 h-3.5 text-gray-500" fill="none" viewBox="0 0 16 16"
33 + stroke="currentColor" stroke-width="2">
34 + <path stroke-linecap="round" stroke-linejoin="round" d="M4 6l4 4 4-4"/>
35 + </svg>
36 + </button>
37 +
38 + <div class="absolute right-0 top-full mt-1 w-48 bg-surface-700 border border-surface-500
39 + rounded shadow-lg py-1 opacity-0 invisible
40 + group-hover:opacity-100 group-hover:visible
41 + transition-all duration-150 z-50">
42 + <div class="px-3 py-2 border-b border-surface-600">
43 + <p class="text-xs font-medium text-gray-100"><%= current_user.display_name_or_username %></p>
44 + <p class="text-xs text-gray-400"><%= current_user.email %></p>
45 + </div>
46 + <%= link_to user_profile_path(current_user.username),
47 + class: "block px-3 py-1.5 text-sm text-gray-300 hover:bg-surface-600" do %>Your repositories<% end %>
48 + <%= link_to settings_path,
49 + class: "block px-3 py-1.5 text-sm text-gray-300 hover:bg-surface-600" do %>Settings<% end %>
50 + <div class="border-t border-surface-600 mt-1">
51 + <%= button_to signout_path, method: :delete,
52 + class: "block w-full text-left px-3 py-1.5 text-sm text-red-400 hover:bg-red-900/30 transition-colors" do %>
53 + Sign out
54 + <% end %>
55 + </div>
56 + </div>
57 + </div>
58 + <% else %>
59 + <%= link_to "Sign in", signin_path, class: "btn-primary text-xs py-1.5 px-4" %>
60 + <% end %>
61 + </div>
62 + </nav>
63 +</header>
app/views/users/settings.html.erb new
+34
@@ -0,0 +1,34 @@
1 +<% content_for :title, "Settings" %>
2 +
3 +<div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">
4 + <h1 class="text-xl font-semibold text-gray-100 mb-8">Settings</h1>
5 +
6 + <div class="card">
7 + <div class="px-6 py-4 border-b border-surface-600">
8 + <h2 class="text-sm font-semibold text-gray-100">Profile</h2>
9 + </div>
10 + <div class="px-6 py-6">
11 + <%= form_with model: @user, url: settings_path, method: :patch do |f| %>
12 + <div class="space-y-5">
13 + <div>
14 + <label class="form-label">Username</label>
15 + <div class="form-input bg-surface-700 text-gray-400 cursor-not-allowed"><%= @user.username %></div>
16 + <p class="text-xs text-gray-500 mt-1">Username cannot be changed.</p>
17 + </div>
18 + <div>
19 + <%= f.label :display_name, "Display name", class: "form-label" %>
20 + <%= f.text_field :display_name, class: "form-input", placeholder: @user.username %>
21 + </div>
22 + <div>
23 + <label class="form-label">Email</label>
24 + <div class="form-input bg-surface-700 text-gray-400 cursor-not-allowed"><%= @user.email %></div>
25 + <p class="text-xs text-gray-500 mt-1">Managed with your account settings.</p>
26 + </div>
27 + <div class="pt-2">
28 + <%= f.submit "Save changes", class: "btn-primary cursor-pointer" %>
29 + </div>
30 + </div>
31 + <% end %>
32 + </div>
33 + </div>
34 +</div>
app/views/users/show.html.erb new
+66
@@ -0,0 +1,66 @@
1 +<% content_for :title, @profile_user.display_name_or_username %>
2 +
3 +<div class="max-w-6xl mx-auto px-4 sm:px-6 py-10">
4 + <div class="grid grid-cols-1 lg:grid-cols-4 gap-10">
5 +
6 + <aside class="lg:col-span-1">
7 + <img src="<%= @profile_user.avatar_url_or_default %>"
8 + alt="<%= @profile_user.display_name_or_username %>"
9 + class="w-full max-w-[200px] rounded-full border border-surface-600 mb-4">
10 + <h1 class="text-xl font-semibold text-gray-100"><%= @profile_user.display_name_or_username %></h1>
11 + <p class="text-gray-400 text-sm"><%= @profile_user.username %></p>
12 + <% if @profile_user.email.present? %>
13 + <div class="flex items-center gap-2 mt-3 text-sm text-gray-400">
14 + <svg class="w-4 h-4 shrink-0" viewBox="0 0 16 16" fill="currentColor">
15 + <path d="M1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25v-8.5C0 2.784.784 2 1.75 2ZM1.5 12.251c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V5.809L8.38 9.397a.75.75 0 0 1-.76 0L1.5 5.809v6.442Zm13-8.181v-.32a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25v.32L8 7.88Z"/>
16 + </svg>
17 + <%= @profile_user.email %>
18 + </div>
19 + <% end %>
20 + </aside>
21 +
22 + <main class="lg:col-span-3">
23 + <div class="flex items-center justify-between mb-4">
24 + <h2 class="text-base font-semibold text-gray-100">
25 + Repositories
26 + <span class="badge-gray ml-1 align-middle"><%= @repositories.count %></span>
27 + </h2>
28 + <% if signed_in? && current_user == @profile_user %>
29 + <%= link_to new_repository_path, class: "btn-secondary text-xs" do %>New<% end %>
30 + <% end %>
31 + </div>
32 +
33 + <% if @repositories.any? %>
34 + <div class="space-y-3">
35 + <% @repositories.each do |repo| %>
36 + <div class="card px-5 py-4 hover:border-surface-400 transition-colors">
37 + <div class="flex items-start justify-between gap-4">
38 + <div class="min-w-0 flex-1">
39 + <div class="flex items-center gap-2 mb-1">
40 + <%= link_to repo.name,
41 + repository_path(@profile_user.username, repo.name),
42 + class: "font-semibold text-brand-500 hover:underline" %>
43 + <% if repo.is_private %>
44 + <span class="badge-gray">Private</span>
45 + <% end %>
46 + </div>
47 + <% if repo.description.present? %>
48 + <p class="text-sm text-gray-400"><%= repo.description %></p>
49 + <% end %>
50 + </div>
51 + <div class="text-xs text-gray-500 shrink-0">
52 + <%= time_ago_in_words(repo.updated_at) %> ago
53 + </div>
54 + </div>
55 + </div>
56 + <% end %>
57 + </div>
58 + <% else %>
59 + <div class="card px-6 py-12 text-center">
60 + <p class="text-sm text-gray-500">No public repositories.</p>
61 + </div>
62 + <% end %>
63 + </main>
64 +
65 + </div>
66 +</div>
bin/brakeman new
+7
@@ -0,0 +1,7 @@
1 +#!/usr/bin/env ruby
2 +require "rubygems"
3 +require "bundler/setup"
4 +
5 +ARGV.unshift("--ensure-latest")
6 +
7 +load Gem.bin_path("brakeman", "brakeman")
bin/bundler-audit new
+6
@@ -0,0 +1,6 @@
1 +#!/usr/bin/env ruby
2 +require_relative "../config/boot"
3 +require "bundler/audit/cli"
4 +
5 +ARGV.concat %w[ --config config/bundler-audit.yml ] if ARGV.empty? || ARGV.include?("check")
6 +Bundler::Audit::CLI.start
bin/ci new
+6
@@ -0,0 +1,6 @@
1 +#!/usr/bin/env ruby
2 +require_relative "../config/boot"
3 +require "active_support/continuous_integration"
4 +
5 +CI = ActiveSupport::ContinuousIntegration
6 +require_relative "../config/ci.rb"
bin/dev new
+2
@@ -0,0 +1,2 @@
1 +#!/usr/bin/env ruby
2 +exec "./bin/rails", "server", *ARGV
bin/docker-entrypoint new
+8
@@ -0,0 +1,8 @@
1 +#!/bin/bash -e
2 +
3 +# If running the rails server then create or migrate existing database
4 +if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
5 + ./bin/rails db:prepare
6 +fi
7 +
8 +exec "${@}"
bin/rails new
+4
@@ -0,0 +1,4 @@
1 +#!/usr/bin/env ruby
2 +APP_PATH = File.expand_path("../config/application", __dir__)
3 +require_relative "../config/boot"
4 +require "rails/commands"
bin/rake new
+4
@@ -0,0 +1,4 @@
1 +#!/usr/bin/env ruby
2 +require_relative "../config/boot"
3 +require "rake"
4 +Rake.application.run
bin/rubocop new
+8
@@ -0,0 +1,8 @@
1 +#!/usr/bin/env ruby
2 +require "rubygems"
3 +require "bundler/setup"
4 +
5 +# Explicit RuboCop config increases performance slightly while avoiding config confusion.
6 +ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7 +
8 +load Gem.bin_path("rubocop", "rubocop")
bin/setup new
+35
@@ -0,0 +1,35 @@
1 +#!/usr/bin/env ruby
2 +require "fileutils"
3 +
4 +APP_ROOT = File.expand_path("..", __dir__)
5 +
6 +def system!(*args)
7 + system(*args, exception: true)
8 +end
9 +
10 +FileUtils.chdir APP_ROOT do
11 + # This script is a way to set up or update your development environment automatically.
12 + # This script is idempotent, so that you can run it at any time and get an expectable outcome.
13 + # Add necessary setup steps to this file.
14 +
15 + puts "== Installing dependencies =="
16 + system("bundle check") || system!("bundle install")
17 +
18 + # puts "\n== Copying sample files =="
19 + # unless File.exist?("config/database.yml")
20 + # FileUtils.cp "config/database.yml.sample", "config/database.yml"
21 + # end
22 +
23 + puts "\n== Preparing database =="
24 + system! "bin/rails db:prepare"
25 + system! "bin/rails db:reset" if ARGV.include?("--reset")
26 +
27 + puts "\n== Removing old logs and tempfiles =="
28 + system! "bin/rails log:clear tmp:clear"
29 +
30 + unless ARGV.include?("--skip-server")
31 + puts "\n== Starting development server =="
32 + STDOUT.flush # flush the output before exec(2) so that it displays
33 + exec "bin/dev"
34 + end
35 +end
bin/thrust new
+5
@@ -0,0 +1,5 @@
1 +#!/usr/bin/env ruby
2 +require "rubygems"
3 +require "bundler/setup"
4 +
5 +load Gem.bin_path("thruster", "thrust")
config.ru new
+6
@@ -0,0 +1,6 @@
1 +# This file is used by Rack-based servers to start the application.
2 +
3 +require_relative "config/environment"
4 +
5 +run Rails.application
6 +Rails.application.load_server
config/application.rb new
+42
@@ -0,0 +1,42 @@
1 +require_relative "boot"
2 +
3 +require "rails"
4 +# Pick the frameworks you want:
5 +require "active_model/railtie"
6 +require "active_job/railtie"
7 +require "active_record/railtie"
8 +require "active_storage/engine"
9 +require "action_controller/railtie"
10 +require "action_mailer/railtie"
11 +require "action_mailbox/engine"
12 +require "action_text/engine"
13 +require "action_view/railtie"
14 +require "action_cable/engine"
15 +# require "rails/test_unit/railtie"
16 +
17 +# Require the gems listed in Gemfile, including any gems
18 +# you've limited to :test, :development, or :production.
19 +Bundler.require(*Rails.groups)
20 +
21 +module Sigitsi
22 + class Application < Rails::Application
23 + # Initialize configuration defaults for originally generated Rails version.
24 + config.load_defaults 8.1
25 +
26 + # Please, add to the `ignore` list any other `lib` subdirectories that do
27 + # not contain `.rb` files, or that should not be reloaded or eager loaded.
28 + # Common ones are `templates`, `generators`, or `middleware`, for example.
29 + config.autoload_lib(ignore: %w[assets tasks])
30 +
31 + # Configuration for the application, engines, and railties goes here.
32 + #
33 + # These settings can be overridden in specific environments using the files
34 + # in config/environments, which are processed later.
35 + #
36 + # config.time_zone = "Central Time (US & Canada)"
37 + # config.eager_load_paths << Rails.root.join("extras")
38 +
39 + # Don't generate system test files.
40 + config.generators.system_tests = nil
41 + end
42 +end
config/boot.rb new
+4
@@ -0,0 +1,4 @@
1 +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2 +
3 +require "bundler/setup" # Set up gems listed in the Gemfile.
4 +require "bootsnap/setup" # Speed up boot time by caching expensive operations.
config/bundler-audit.yml new
+5
@@ -0,0 +1,5 @@
1 +# Audit all gems listed in the Gemfile for known security problems by running bin/bundler-audit.
2 +# CVEs that are not relevant to the application can be enumerated on the ignore list below.
3 +
4 +ignore:
5 + - CVE-THAT-DOES-NOT-APPLY
config/cable.yml new
+10
@@ -0,0 +1,10 @@
1 +development:
2 + adapter: async
3 +
4 +test:
5 + adapter: test
6 +
7 +production:
8 + adapter: redis
9 + url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 + channel_prefix: sigitsi_production
config/ci.rb new
+20
@@ -0,0 +1,20 @@
1 +# Run using bin/ci
2 +
3 +CI.run do
4 + step "Setup", "bin/setup --skip-server"
5 +
6 + step "Style: Ruby", "bin/rubocop"
7 +
8 + step "Security: Gem audit", "bin/bundler-audit"
9 + step "Security: Importmap vulnerability audit", "bin/importmap audit"
10 + step "Security: Brakeman code analysis", "bin/brakeman --quiet --no-pager --exit-on-warn --exit-on-error"
11 +
12 +
13 + # Optional: set a green GitHub commit status to unblock PR merge.
14 + # Requires the `gh` CLI and `gh extension install basecamp/gh-signoff`.
15 + # if success?
16 + # step "Signoff: All systems go. Ready for merge and deploy.", "gh signoff"
17 + # else
18 + # failure "Signoff: CI failed. Do not merge or deploy.", "Fix the issues and try again."
19 + # end
20 +end
config/credentials.yml.enc new
+1
@@ -0,0 +1 @@
1 +4FBLgT4lqYn6Xq573rcAdqYW8uoCip65xOaJcs9uI4+4GjgUy6mVxbbs9drNMkeR/hT1bmWxcc2yGahuZ4HCnCTHongcYSeRN+tq3ZKK6uBRtJ5n4VoF8bb79Y11XzpWYJRzI4+qI9XIwNBiCgB0LrLjJE1+1OPrphA26JBYPGq1CuepuIC1uhF6tRBTj3+mxjMLb9TZK/xnQPttlhPCryt4IC6Rl1223Yj7Hp3J4OKOOYisuK7PfpO/1HhCCnHVffeWfjOA+bunX0CMycaPQPNNgzEDQNy+3sr6pCRDU4PmIlQv2ED4ZNoldIyrdqvvXj7cyWmj8qe5nhoRRfskaLm3Pm6abN29DFxw9AnU/z4EXUCrcnd+dhfLPd2rW5X3qWGgHwRMounOc+HWHFR4snJR9gNAGbNrBZt9kfRPinB+pJDNVpvsKX+RUDsZ3HamouD4t951pc6MdzzSsAOYLXyeoNxkgK9pHAvfSHbGxnPwNR4X03wjhK/8--2sl/oC/jkTHhawD8--aK/HddPgwwngDeBQyxNY3g==
\ No newline at end of file
config/database.yml new
+104
@@ -0,0 +1,104 @@
1 +# PostgreSQL. Versions 9.5 and up are supported.
2 +#
3 +# Install the pg driver:
4 +# gem install pg
5 +# On macOS with Homebrew:
6 +# gem install pg -- --with-pg-config=/opt/homebrew/bin/pg_config
7 +# On Windows:
8 +# gem install pg
9 +# Choose the win32 build.
10 +# Install PostgreSQL and put its /bin directory on your path.
11 +#
12 +# Configure Using Gemfile
13 +# gem "pg"
14 +#
15 +default: &default
16 + adapter: postgresql
17 + encoding: unicode
18 + # For details on connection pooling, see Rails configuration guide
19 + # https://guides.rubyonrails.org/configuring.html#database-pooling
20 + max_connections: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
21 +
22 +
23 +development:
24 + <<: *default
25 + database: sigitsi_development
26 +
27 + # The specified database role being used to connect to PostgreSQL.
28 + # To create additional roles in PostgreSQL see `$ createuser --help`.
29 + # When left blank, PostgreSQL will use the default role. This is
30 + # the same name as the operating system user running Rails.
31 + #username: sigitsi
32 +
33 + # The password associated with the PostgreSQL role (username).
34 + #password:
35 +
36 + # Connect on a TCP socket. Omitted by default since the client uses a
37 + # domain socket that doesn't need configuration. Windows does not have
38 + # domain sockets, so uncomment these lines.
39 + #host: localhost
40 +
41 + # The TCP port the server listens on. Defaults to 5432.
42 + # If your server runs on a different port number, change accordingly.
43 + #port: 5432
44 +
45 + # Schema search path. The server defaults to $user,public
46 + #schema_search_path: myapp,sharedapp,public
47 +
48 + # Minimum log levels, in increasing order:
49 + # debug5, debug4, debug3, debug2, debug1,
50 + # log, notice, warning, error, fatal, and panic
51 + # Defaults to warning.
52 + #min_messages: notice
53 +
54 +# Warning: The database defined as "test" will be erased and
55 +# re-generated from your development database when you run "rake".
56 +# Do not set this db to the same as development or production.
57 +test:
58 + <<: *default
59 + database: sigitsi_test
60 +
61 +# As with config/credentials.yml, you never want to store sensitive information,
62 +# like your database password, in your source code. If your source code is
63 +# ever seen by anyone, they now have access to your database.
64 +#
65 +# Instead, provide the password or a full connection URL as an environment
66 +# variable when you boot the app. For example:
67 +#
68 +# DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
69 +#
70 +# If the connection URL is provided in the special DATABASE_URL environment
71 +# variable, Rails will automatically merge its configuration values on top of
72 +# the values provided in this file. Alternatively, you can specify a connection
73 +# URL environment variable explicitly:
74 +#
75 +# production:
76 +# url: <%= ENV["MY_APP_DATABASE_URL"] %>
77 +#
78 +# Connection URLs for non-primary databases can also be configured using
79 +# environment variables. The variable name is formed by concatenating the
80 +# connection name with `_DATABASE_URL`. For example:
81 +#
82 +# CACHE_DATABASE_URL="postgres://cacheuser:cachepass@localhost/cachedatabase"
83 +#
84 +# Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
85 +# for a full overview on how database connection configuration can be specified.
86 +#
87 +production:
88 + primary: &primary_production
89 + <<: *default
90 + database: sigitsi_production
91 + username: sigitsi
92 + password: <%= ENV["SIGITSI_DATABASE_PASSWORD"] %>
93 + cache:
94 + <<: *primary_production
95 + database: sigitsi_production_cache
96 + migrations_paths: db/cache_migrate
97 + queue:
98 + <<: *primary_production
99 + database: sigitsi_production_queue
100 + migrations_paths: db/queue_migrate
101 + cable:
102 + <<: *primary_production
103 + database: sigitsi_production_cable
104 + migrations_paths: db/cable_migrate
config/environment.rb new
+5
@@ -0,0 +1,5 @@
1 +# Load the Rails application.
2 +require_relative "application"
3 +
4 +# Initialize the Rails application.
5 +Rails.application.initialize!
config/environments/development.rb new
+78
@@ -0,0 +1,78 @@
1 +require "active_support/core_ext/integer/time"
2 +
3 +Rails.application.configure do
4 + # Settings specified here will take precedence over those in config/application.rb.
5 +
6 + # Make code changes take effect immediately without server restart.
7 + config.enable_reloading = true
8 +
9 + # Do not eager load code on boot.
10 + config.eager_load = false
11 +
12 + # Show full error reports.
13 + config.consider_all_requests_local = true
14 +
15 + # Enable server timing.
16 + config.server_timing = true
17 +
18 + # Enable/disable Action Controller caching. By default Action Controller caching is disabled.
19 + # Run rails dev:cache to toggle Action Controller caching.
20 + if Rails.root.join("tmp/caching-dev.txt").exist?
21 + config.action_controller.perform_caching = true
22 + config.action_controller.enable_fragment_cache_logging = true
23 + config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
24 + else
25 + config.action_controller.perform_caching = false
26 + end
27 +
28 + # Change to :null_store to avoid any caching.
29 + config.cache_store = :memory_store
30 +
31 + # Store uploaded files on the local file system (see config/storage.yml for options).
32 + config.active_storage.service = :local
33 +
34 + # Don't care if the mailer can't send.
35 + config.action_mailer.raise_delivery_errors = false
36 +
37 + # Make template changes take effect immediately.
38 + config.action_mailer.perform_caching = false
39 +
40 + # Set localhost to be used by links generated in mailer templates.
41 + config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
42 +
43 + # Print deprecation notices to the Rails logger.
44 + config.active_support.deprecation = :log
45 +
46 + # Raise an error on page load if there are pending migrations.
47 + config.active_record.migration_error = :page_load
48 +
49 + # Highlight code that triggered database queries in logs.
50 + config.active_record.verbose_query_logs = true
51 +
52 + # Append comments with runtime information tags to SQL queries in logs.
53 + config.active_record.query_log_tags_enabled = true
54 +
55 + # Highlight code that enqueued background job in logs.
56 + config.active_job.verbose_enqueue_logs = true
57 +
58 + # Highlight code that triggered redirect in logs.
59 + config.action_dispatch.verbose_redirect_logs = true
60 +
61 + # Suppress logger output for asset requests.
62 + config.assets.quiet = true
63 +
64 + # Raises error for missing translations.
65 + # config.i18n.raise_on_missing_translations = true
66 +
67 + # Annotate rendered view with file names.
68 + config.action_view.annotate_rendered_view_with_filenames = true
69 +
70 + # Uncomment if you wish to allow Action Cable access from any origin.
71 + # config.action_cable.disable_request_forgery_protection = true
72 +
73 + # Raise error when a before_action's only/except options reference missing actions.
74 + config.action_controller.raise_on_missing_callback_actions = true
75 +
76 + # Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
77 + # config.generators.apply_rubocop_autocorrect_after_generate!
78 +end
config/environments/production.rb new
+89
@@ -0,0 +1,89 @@
1 +require "active_support/core_ext/integer/time"
2 +
3 +Rails.application.configure do
4 + # Settings specified here will take precedence over those in config/application.rb.
5 +
6 + # Code is not reloaded between requests.
7 + config.enable_reloading = false
8 +
9 + # Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
10 + config.eager_load = true
11 +
12 + # Full error reports are disabled.
13 + config.consider_all_requests_local = false
14 +
15 + # Turn on fragment caching in view templates.
16 + config.action_controller.perform_caching = true
17 +
18 + # Cache assets for far-future expiry since they are all digest stamped.
19 + config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
20 +
21 + # Enable serving of images, stylesheets, and JavaScripts from an asset server.
22 + # config.asset_host = "http://assets.example.com"
23 +
24 + # Store uploaded files on the local file system (see config/storage.yml for options).
25 + config.active_storage.service = :local
26 +
27 + # Assume all access to the app is happening through a SSL-terminating reverse proxy.
28 + # config.assume_ssl = true
29 +
30 + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31 + # config.force_ssl = true
32 +
33 + # Skip http-to-https redirect for the default health check endpoint.
34 + # config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
35 +
36 + # Log to STDOUT with the current request id as a default log tag.
37 + config.log_tags = [ :request_id ]
38 + config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
39 +
40 + # Change to "debug" to log everything (including potentially personally-identifiable information!).
41 + config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
42 +
43 + # Prevent health checks from clogging up the logs.
44 + config.silence_healthcheck_path = "/up"
45 +
46 + # Don't log any deprecations.
47 + config.active_support.report_deprecations = false
48 +
49 + # Replace the default in-process memory cache store with a durable alternative.
50 + # config.cache_store = :mem_cache_store
51 +
52 + # Replace the default in-process and non-durable queuing backend for Active Job.
53 + # config.active_job.queue_adapter = :resque
54 +
55 + # Ignore bad email addresses and do not raise email delivery errors.
56 + # Set this to true and configure the email server for immediate delivery to raise delivery errors.
57 + # config.action_mailer.raise_delivery_errors = false
58 +
59 + # Set host to be used by links generated in mailer templates.
60 + config.action_mailer.default_url_options = { host: "example.com" }
61 +
62 + # Specify outgoing SMTP server. Remember to add smtp/* credentials via bin/rails credentials:edit.
63 + # config.action_mailer.smtp_settings = {
64 + # user_name: Rails.application.credentials.dig(:smtp, :user_name),
65 + # password: Rails.application.credentials.dig(:smtp, :password),
66 + # address: "smtp.example.com",
67 + # port: 587,
68 + # authentication: :plain
69 + # }
70 +
71 + # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72 + # the I18n.default_locale when a translation cannot be found).
73 + config.i18n.fallbacks = true
74 +
75 + # Do not dump schema after migrations.
76 + config.active_record.dump_schema_after_migration = false
77 +
78 + # Only use :id for inspections in production.
79 + config.active_record.attributes_for_inspect = [ :id ]
80 +
81 + # Enable DNS rebinding protection and other `Host` header attacks.
82 + # config.hosts = [
83 + # "example.com", # Allow requests from example.com
84 + # /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
85 + # ]
86 + #
87 + # Skip DNS rebinding protection for the default health check endpoint.
88 + # config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
89 +end
config/environments/test.rb new
+53
@@ -0,0 +1,53 @@
1 +# The test environment is used exclusively to run your application's
2 +# test suite. You never need to work with it otherwise. Remember that
3 +# your test database is "scratch space" for the test suite and is wiped
4 +# and recreated between test runs. Don't rely on the data there!
5 +
6 +Rails.application.configure do
7 + # Settings specified here will take precedence over those in config/application.rb.
8 +
9 + # While tests run files are not watched, reloading is not necessary.
10 + config.enable_reloading = false
11 +
12 + # Eager loading loads your entire application. When running a single test locally,
13 + # this is usually not necessary, and can slow down your test suite. However, it's
14 + # recommended that you enable it in continuous integration systems to ensure eager
15 + # loading is working properly before deploying your code.
16 + config.eager_load = ENV["CI"].present?
17 +
18 + # Configure public file server for tests with cache-control for performance.
19 + config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
20 +
21 + # Show full error reports.
22 + config.consider_all_requests_local = true
23 + config.cache_store = :null_store
24 +
25 + # Render exception templates for rescuable exceptions and raise for other exceptions.
26 + config.action_dispatch.show_exceptions = :rescuable
27 +
28 + # Disable request forgery protection in test environment.
29 + config.action_controller.allow_forgery_protection = false
30 +
31 + # Store uploaded files on the local file system in a temporary directory.
32 + config.active_storage.service = :test
33 +
34 + # Tell Action Mailer not to deliver emails to the real world.
35 + # The :test delivery method accumulates sent emails in the
36 + # ActionMailer::Base.deliveries array.
37 + config.action_mailer.delivery_method = :test
38 +
39 + # Set host to be used by links generated in mailer templates.
40 + config.action_mailer.default_url_options = { host: "example.com" }
41 +
42 + # Print deprecation notices to the stderr.
43 + config.active_support.deprecation = :stderr
44 +
45 + # Raises error for missing translations.
46 + # config.i18n.raise_on_missing_translations = true
47 +
48 + # Annotate rendered view with file names.
49 + # config.action_view.annotate_rendered_view_with_filenames = true
50 +
51 + # Raise error when a before_action's only/except options reference missing actions.
52 + config.action_controller.raise_on_missing_callback_actions = true
53 +end
config/importmap.rb new
+9
@@ -0,0 +1,9 @@
1 +# Pin npm packages by running ./bin/importmap
2 +
3 +pin "application", preload: true
4 +
5 +pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
6 +pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
7 +pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
8 +
9 +pin_all_from "app/javascript/controllers", under: "controllers"
config/initializers/assets.rb new
+7
@@ -0,0 +1,7 @@
1 +# Be sure to restart your server when you modify this file.
2 +
3 +# Version of your assets, change this if you want to expire all your assets.
4 +Rails.application.config.assets.version = "1.0"
5 +
6 +# Add additional assets to the asset load path.
7 +# Rails.application.config.assets.paths << Emoji.images_path
config/initializers/content_security_policy.rb new
+29
@@ -0,0 +1,29 @@
1 +# Be sure to restart your server when you modify this file.
2 +
3 +# Define an application-wide content security policy.
4 +# See the Securing Rails Applications Guide for more information:
5 +# https://guides.rubyonrails.org/security.html#content-security-policy-header
6 +
7 +# Rails.application.configure do
8 +# config.content_security_policy do |policy|
9 +# policy.default_src :self, :https
10 +# policy.font_src :self, :https, :data
11 +# policy.img_src :self, :https, :data
12 +# policy.object_src :none
13 +# policy.script_src :self, :https
14 +# policy.style_src :self, :https
15 +# # Specify URI for violation reports
16 +# # policy.report_uri "/csp-violation-report-endpoint"
17 +# end
18 +#
19 +# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
20 +# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21 +# config.content_security_policy_nonce_directives = %w(script-src style-src)
22 +#
23 +# # Automatically add `nonce` to `javascript_tag`, `javascript_include_tag`, and `stylesheet_link_tag`
24 +# # if the corresponding directives are specified in `content_security_policy_nonce_directives`.
25 +# # config.content_security_policy_nonce_auto = true
26 +#
27 +# # Report violations without enforcing the policy.
28 +# # config.content_security_policy_report_only = true
29 +# end
config/initializers/filter_parameter_logging.rb new
+8
@@ -0,0 +1,8 @@
1 +# Be sure to restart your server when you modify this file.
2 +
3 +# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4 +# Use this to limit dissemination of sensitive information.
5 +# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6 +Rails.application.config.filter_parameters += [
7 + :passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
8 +]
config/initializers/inflections.rb new
+16
@@ -0,0 +1,16 @@
1 +# Be sure to restart your server when you modify this file.
2 +
3 +# Add new inflection rules using the following format. Inflections
4 +# are locale specific, and you may define rules for as many different
5 +# locales as you wish. All of these examples are active by default:
6 +# ActiveSupport::Inflector.inflections(:en) do |inflect|
7 +# inflect.plural /^(ox)$/i, "\\1en"
8 +# inflect.singular /^(ox)en/i, "\\1"
9 +# inflect.irregular "person", "people"
10 +# inflect.uncountable %w( fish sheep )
11 +# end
12 +
13 +# These inflection rules are supported but not enabled by default:
14 +# ActiveSupport::Inflector.inflections(:en) do |inflect|
15 +# inflect.acronym "RESTful"
16 +# end
config/locales/en.yml new
+31
@@ -0,0 +1,31 @@
1 +# Files in the config/locales directory are used for internationalization and
2 +# are automatically loaded by Rails. If you want to use locales other than
3 +# English, add the necessary files in this directory.
4 +#
5 +# To use the locales, use `I18n.t`:
6 +#
7 +# I18n.t "hello"
8 +#
9 +# In views, this is aliased to just `t`:
10 +#
11 +# <%= t("hello") %>
12 +#
13 +# To use a different locale, set it with `I18n.locale`:
14 +#
15 +# I18n.locale = :es
16 +#
17 +# This would use the information in config/locales/es.yml.
18 +#
19 +# To learn more about the API, please read the Rails Internationalization guide
20 +# at https://guides.rubyonrails.org/i18n.html.
21 +#
22 +# Be aware that YAML interprets the following case-insensitive strings as
23 +# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
24 +# must be quoted to be interpreted as strings. For example:
25 +#
26 +# en:
27 +# "yes": yup
28 +# enabled: "ON"
29 +
30 +en:
31 + hello: "Hello world"
config/puma.rb new
+42
@@ -0,0 +1,42 @@
1 +# This configuration file will be evaluated by Puma. The top-level methods that
2 +# are invoked here are part of Puma's configuration DSL. For more information
3 +# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
4 +#
5 +# Puma starts a configurable number of processes (workers) and each process
6 +# serves each request in a thread from an internal thread pool.
7 +#
8 +# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
9 +# should only set this value when you want to run 2 or more workers. The
10 +# default is already 1. You can set it to `auto` to automatically start a worker
11 +# for each available processor.
12 +#
13 +# The ideal number of threads per worker depends both on how much time the
14 +# application spends waiting for IO operations and on how much you wish to
15 +# prioritize throughput over latency.
16 +#
17 +# As a rule of thumb, increasing the number of threads will increase how much
18 +# traffic a given process can handle (throughput), but due to CRuby's
19 +# Global VM Lock (GVL) it has diminishing returns and will degrade the
20 +# response time (latency) of the application.
21 +#
22 +# The default is set to 3 threads as it's deemed a decent compromise between
23 +# throughput and latency for the average Rails application.
24 +#
25 +# Any libraries that use a connection pool or another resource pool should
26 +# be configured to provide at least as many connections as the number of
27 +# threads. This includes Active Record's `pool` parameter in `database.yml`.
28 +threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
29 +threads threads_count, threads_count
30 +
31 +# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
32 +port ENV.fetch("PORT", 3000)
33 +
34 +# Allow puma to be restarted by `bin/rails restart` command.
35 +plugin :tmp_restart
36 +
37 +# Run the Solid Queue supervisor inside of Puma for single-server deployments.
38 +plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
39 +
40 +# Specify the PID file. Defaults to tmp/pids/server.pid in development.
41 +# In other environments, only set the PID file if requested.
42 +pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
config/routes.rb new
+56
@@ -0,0 +1,56 @@
1 +Rails.application.routes.draw do
2 + root "pages#home"
3 +
4 + # Dev panel — only mounted in development
5 + if Rails.env.development?
6 + namespace :dev do
7 + get "environment", to: "panel#show"
8 + put "environment", to: "panel#update"
9 + end
10 + end
11 +
12 + # Auth — email/password form
13 + get "/auth", to: "sessions#new", as: :signin
14 + post "/auth", to: "sessions#create", as: :auth_create
15 + delete "/auth/signout", to: "sessions#destroy", as: :signout
16 +
17 + # Signup
18 + get "/auth/signup", to: "registrations#new", as: :signup
19 + post "/auth/signup", to: "registrations#create", as: :signup_create
20 +
21 + # Repository creation
22 + get "/new", to: "repositories#new", as: :new_repository
23 + post "/new", to: "repositories#create"
24 +
25 + # Settings
26 + get "/settings", to: "users#settings", as: :settings
27 + patch "/settings", to: "users#update_settings"
28 +
29 + # User profile (must come before repository routes)
30 + get "/@:username", to: "users#show", as: :at_user_profile,
31 + constraints: { username: /[a-z0-9][a-z0-9\-]{0,38}/ }
32 + get "/:username", to: "users#show", as: :user_profile,
33 + constraints: { username: /[a-z0-9][a-z0-9\-]{0,38}/ }
34 +
35 + # Repository routes (in order of specificity)
36 + get "/@:username/:repository/commits/:branch", to: "commits#index", as: :at_repository_commits,
37 + constraints: { branch: /[^\/]+/, repository: /[^\/.][^\/]*/ }
38 + get "/@:username/:repository/commit/:sha", to: "commits#show", as: :at_repository_commit
39 + get "/@:username/:repository/blob/:branch/*path", to: "blobs#show", as: :at_repository_blob
40 + get "/@:username/:repository/raw/:branch/*path", to: "blobs#raw", as: :at_repository_blob_raw
41 + get "/@:username/:repository/tree/:branch/*path", to: "repositories#tree", as: :at_repository_tree
42 + get "/@:username/:repository/tree/:branch", to: "repositories#tree", as: :at_repository_branch
43 + get "/@:username/:repository", to: "repositories#show", as: :at_repository
44 +
45 + get "/:username/:repository/commits/:branch", to: "commits#index", as: :repository_commits,
46 + constraints: { branch: /[^\/]+/, repository: /[^\/.][^\/]*/ }
47 + get "/:username/:repository/commit/:sha", to: "commits#show", as: :repository_commit
48 + get "/:username/:repository/blob/:branch/*path", to: "blobs#show", as: :repository_blob
49 + get "/:username/:repository/raw/:branch/*path", to: "blobs#raw", as: :repository_blob_raw
50 + get "/:username/:repository/tree/:branch/*path", to: "repositories#tree", as: :repository_tree
51 + get "/:username/:repository/tree/:branch", to: "repositories#tree", as: :repository_branch
52 + get "/:username/:repository", to: "repositories#show", as: :repository
53 +
54 + # Health check
55 + get "up" => "rails/health#show", as: :rails_health_check
56 +end
config/storage.yml new
+27
@@ -0,0 +1,27 @@
1 +test:
2 + service: Disk
3 + root: <%= Rails.root.join("tmp/storage") %>
4 +
5 +local:
6 + service: Disk
7 + root: <%= Rails.root.join("storage") %>
8 +
9 +# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 +# amazon:
11 +# service: S3
12 +# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 +# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 +# region: us-east-1
15 +# bucket: your_own_bucket-<%= Rails.env %>
16 +
17 +# Remember not to checkin your GCS keyfile to a repository
18 +# google:
19 +# service: GCS
20 +# project: your_project
21 +# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 +# bucket: your_own_bucket-<%= Rails.env %>
23 +
24 +# mirror:
25 +# service: Mirror
26 +# primary: local
27 +# mirrors: [ amazon, google, microsoft ]
config/tailwind.config.js new
+57
@@ -0,0 +1,57 @@
1 +const defaultTheme = require('tailwindcss/defaultTheme')
2 +
3 +module.exports = {
4 + content: [
5 + './public/*.html',
6 + './app/helpers/**/*.rb',
7 + './app/javascript/**/*.js',
8 + './app/views/**/*.{erb,haml,html,slim}'
9 + ],
10 + theme: {
11 + extend: {
12 + fontFamily: {
13 + sans: [
14 + 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system',
15 + 'BlinkMacSystemFont', 'Segoe UI', 'Roboto',
16 + ...defaultTheme.fontFamily.sans
17 + ],
18 + mono: [
19 + 'JetBrains Mono', 'ui-monospace', 'SFMono-Regular',
20 + 'Menlo', 'Monaco', 'Consolas',
21 + ...defaultTheme.fontFamily.mono
22 + ],
23 + },
24 + colors: {
25 + brand: {
26 + 50: '#FFF5F0',
27 + 100: '#FFE8DB',
28 + 200: '#FFD0B5',
29 + 300: '#FFB088',
30 + 400: '#FF8F5A',
31 + 500: '#FE6D36',
32 + 600: '#E55A24',
33 + 700: '#C04A1A',
34 + 800: '#993B15',
35 + 900: '#732D10',
36 + },
37 + surface: {
38 + 50: '#f5f6f7',
39 + 100: '#e0e2e5',
40 + 200: '#c1c5cb',
41 + 300: '#9ca3ae',
42 + 400: '#6b7280',
43 + 500: '#383d44',
44 + 600: '#2d3238',
45 + 700: '#1e2126',
46 + 800: '#1a1d21',
47 + 900: '#15171a',
48 + 950: '#0f1012',
49 + },
50 + },
51 + maxWidth: {
52 + '8xl': '88rem',
53 + },
54 + },
55 + },
56 + plugins: [],
57 +}
db/migrate/20250101000001_create_users.rb new
+18
@@ -0,0 +1,18 @@
1 +class CreateUsers < ActiveRecord::Migration[8.1]
2 + def change
3 + create_table :users do |t|
4 + t.integer :smbcloud_id, null: false
5 + t.string :email, null: false
6 + t.string :username, null: false
7 + t.string :display_name
8 + t.string :avatar_url
9 + t.string :access_token
10 +
11 + t.timestamps
12 + end
13 +
14 + add_index :users, :smbcloud_id, unique: true
15 + add_index :users, :username, unique: true
16 + add_index :users, :email, unique: true
17 + end
18 +end
db/migrate/20250101000002_create_repositories.rb new
+16
@@ -0,0 +1,16 @@
1 +class CreateRepositories < ActiveRecord::Migration[8.1]
2 + def change
3 + create_table :repositories do |t|
4 + t.references :user, null: false, foreign_key: true
5 + t.string :name, null: false
6 + t.text :description
7 + t.string :default_branch, null: false, default: "main"
8 + t.boolean :is_private, null: false, default: false
9 + t.string :disk_path, null: false
10 +
11 + t.timestamps
12 + end
13 +
14 + add_index :repositories, [ :user_id, :name ], unique: true
15 + end
16 +end
db/migrate/20250101000003_create_ssh_keys.rb new
+12
@@ -0,0 +1,12 @@
1 +class CreateSshKeys < ActiveRecord::Migration[8.1]
2 + def change
3 + create_table :ssh_keys do |t|
4 + t.references :user, null: false, foreign_key: true
5 + t.string :title, null: false
6 + t.text :key_text, null: false
7 + t.string :fingerprint, null: false
8 +
9 + t.timestamps
10 + end
11 + end
12 +end
db/schema.rb new
+56
@@ -0,0 +1,56 @@
1 +# This file is auto-generated from the current state of the database. Instead
2 +# of editing this file, please use the migrations feature of Active Record to
3 +# incrementally modify your database, and then regenerate this schema definition.
4 +#
5 +# This file is the source Rails uses to define your schema when running `bin/rails
6 +# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7 +# be faster and is potentially less error prone than running all of your
8 +# migrations from scratch. Old migrations may fail to apply correctly if those
9 +# migrations use external dependencies or application code.
10 +#
11 +# It's strongly recommended that you check this file into your version control system.
12 +
13 +ActiveRecord::Schema[8.1].define(version: 2025_01_01_000003) do
14 + # These are extensions that must be enabled in order to support this database
15 + enable_extension "pg_catalog.plpgsql"
16 +
17 + create_table "repositories", force: :cascade do |t|
18 + t.datetime "created_at", null: false
19 + t.string "default_branch", default: "main", null: false
20 + t.text "description"
21 + t.string "disk_path", null: false
22 + t.boolean "is_private", default: false, null: false
23 + t.string "name", null: false
24 + t.datetime "updated_at", null: false
25 + t.bigint "user_id", null: false
26 + t.index ["user_id", "name"], name: "index_repositories_on_user_id_and_name", unique: true
27 + t.index ["user_id"], name: "index_repositories_on_user_id"
28 + end
29 +
30 + create_table "ssh_keys", force: :cascade do |t|
31 + t.datetime "created_at", null: false
32 + t.string "fingerprint", null: false
33 + t.text "key_text", null: false
34 + t.string "title", null: false
35 + t.datetime "updated_at", null: false
36 + t.bigint "user_id", null: false
37 + t.index ["user_id"], name: "index_ssh_keys_on_user_id"
38 + end
39 +
40 + create_table "users", force: :cascade do |t|
41 + t.string "access_token"
42 + t.string "avatar_url"
43 + t.datetime "created_at", null: false
44 + t.string "display_name"
45 + t.string "email", null: false
46 + t.integer "smbcloud_id", null: false
47 + t.datetime "updated_at", null: false
48 + t.string "username", null: false
49 + t.index ["email"], name: "index_users_on_email", unique: true
50 + t.index ["smbcloud_id"], name: "index_users_on_smbcloud_id", unique: true
51 + t.index ["username"], name: "index_users_on_username", unique: true
52 + end
53 +
54 + add_foreign_key "repositories", "users"
55 + add_foreign_key "ssh_keys", "users"
56 +end
db/seeds.rb new
+9
@@ -0,0 +1,9 @@
1 +# This file should ensure the existence of records required to run the application in every environment (production,
2 +# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
3 +# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
4 +#
5 +# Example:
6 +#
7 +# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
8 +# MovieGenre.find_or_create_by!(name: genre_name)
9 +# end
lib/tasks/.keep
log/.keep
public/400.html new
+135
@@ -0,0 +1,135 @@
1 +<!doctype html>
2 +
3 +<html lang="en">
4 +
5 + <head>
6 +
7 + <title>The server cannot process the request due to a client error (400 Bad Request)</title>
8 +
9 + <meta charset="utf-8">
10 + <meta name="viewport" content="initial-scale=1, width=device-width">
11 + <meta name="robots" content="noindex, nofollow">
12 +
13 + <style>
14 +
15 + *, *::before, *::after {
16 + box-sizing: border-box;
17 + }
18 +
19 + * {
20 + margin: 0;
21 + }
22 +
23 + html {
24 + font-size: 16px;
25 + }
26 +
27 + body {
28 + background: #FFF;
29 + color: #261B23;
30 + display: grid;
31 + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32 + font-size: clamp(1rem, 2.5vw, 2rem);
33 + -webkit-font-smoothing: antialiased;
34 + font-style: normal;
35 + font-weight: 400;
36 + letter-spacing: -0.0025em;
37 + line-height: 1.4;
38 + min-height: 100dvh;
39 + place-items: center;
40 + text-rendering: optimizeLegibility;
41 + -webkit-text-size-adjust: 100%;
42 + }
43 +
44 + #error-description {
45 + fill: #d30001;
46 + }
47 +
48 + #error-id {
49 + fill: #f0eff0;
50 + }
51 +
52 + @media (prefers-color-scheme: dark) {
53 + body {
54 + background: #101010;
55 + color: #e0e0e0;
56 + }
57 +
58 + #error-description {
59 + fill: #FF6161;
60 + }
61 +
62 + #error-id {
63 + fill: #2c2c2c;
64 + }
65 + }
66 +
67 + a {
68 + color: inherit;
69 + font-weight: 700;
70 + text-decoration: underline;
71 + text-underline-offset: 0.0925em;
72 + }
73 +
74 + b, strong {
75 + font-weight: 700;
76 + }
77 +
78 + i, em {
79 + font-style: italic;
80 + }
81 +
82 + main {
83 + display: grid;
84 + gap: 1em;
85 + padding: 2em;
86 + place-items: center;
87 + text-align: center;
88 + }
89 +
90 + main header {
91 + width: min(100%, 12em);
92 + }
93 +
94 + main header svg {
95 + height: auto;
96 + max-width: 100%;
97 + width: 100%;
98 + }
99 +
100 + main article {
101 + width: min(100%, 30em);
102 + }
103 +
104 + main article p {
105 + font-size: 75%;
106 + }
107 +
108 + main article br {
109 + display: none;
110 +
111 + @media(min-width: 48em) {
112 + display: inline;
113 + }
114 + }
115 +
116 + </style>
117 +
118 + </head>
119 +
120 + <body>
121 +
122 + <!-- This file lives in public/400.html -->
123 +
124 + <main>
125 + <header>
126 + <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" id="error-id"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" id="error-description"/></svg>
127 + </header>
128 + <article>
129 + <p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If you're the application owner check the logs for more information.</p>
130 + </article>
131 + </main>
132 +
133 + </body>
134 +
135 +</html>
public/404.html new
+135
@@ -0,0 +1,135 @@
1 +<!doctype html>
2 +
3 +<html lang="en">
4 +
5 + <head>
6 +
7 + <title>The page you were looking for doesn't exist (404 Not found)</title>
8 +
9 + <meta charset="utf-8">
10 + <meta name="viewport" content="initial-scale=1, width=device-width">
11 + <meta name="robots" content="noindex, nofollow">
12 +
13 + <style>
14 +
15 + *, *::before, *::after {
16 + box-sizing: border-box;
17 + }
18 +
19 + * {
20 + margin: 0;
21 + }
22 +
23 + html {
24 + font-size: 16px;
25 + }
26 +
27 + body {
28 + background: #FFF;
29 + color: #261B23;
30 + display: grid;
31 + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32 + font-size: clamp(1rem, 2.5vw, 2rem);
33 + -webkit-font-smoothing: antialiased;
34 + font-style: normal;
35 + font-weight: 400;
36 + letter-spacing: -0.0025em;
37 + line-height: 1.4;
38 + min-height: 100dvh;
39 + place-items: center;
40 + text-rendering: optimizeLegibility;
41 + -webkit-text-size-adjust: 100%;
42 + }
43 +
44 + #error-description {
45 + fill: #d30001;
46 + }
47 +
48 + #error-id {
49 + fill: #f0eff0;
50 + }
51 +
52 + @media (prefers-color-scheme: dark) {
53 + body {
54 + background: #101010;
55 + color: #e0e0e0;
56 + }
57 +
58 + #error-description {
59 + fill: #FF6161;
60 + }
61 +
62 + #error-id {
63 + fill: #2c2c2c;
64 + }
65 + }
66 +
67 + a {
68 + color: inherit;
69 + font-weight: 700;
70 + text-decoration: underline;
71 + text-underline-offset: 0.0925em;
72 + }
73 +
74 + b, strong {
75 + font-weight: 700;
76 + }
77 +
78 + i, em {
79 + font-style: italic;
80 + }
81 +
82 + main {
83 + display: grid;
84 + gap: 1em;
85 + padding: 2em;
86 + place-items: center;
87 + text-align: center;
88 + }
89 +
90 + main header {
91 + width: min(100%, 12em);
92 + }
93 +
94 + main header svg {
95 + height: auto;
96 + max-width: 100%;
97 + width: 100%;
98 + }
99 +
100 + main article {
101 + width: min(100%, 30em);
102 + }
103 +
104 + main article p {
105 + font-size: 75%;
106 + }
107 +
108 + main article br {
109 + display: none;
110 +
111 + @media(min-width: 48em) {
112 + display: inline;
113 + }
114 + }
115 +
116 + </style>
117 +
118 + </head>
119 +
120 + <body>
121 +
122 + <!-- This file lives in public/404.html -->
123 +
124 + <main>
125 + <header>
126 + <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm165.328-35.41581-45.689 100.02991h26.224v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.184v-31.901l50.285-103.27391z" id="error-id"/><path d="m157.758 68.9967v34.0033h-7.199l-14.233-19.8814v19.8814h-8.584v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm13.184 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm37.027 8.5839h-8.806v-34.0033h23.924v7.6978h-15.118v6.7564h13.9v7.5316h-13.9zm41.876-12.4605c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm35.337-12.4605v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.997 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm4.076 24.921v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.156.9969-3.6 2.7136v15.0634zm44.113 0v-1.994c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.8151-11.132-13.0145s3.932-13.0143 11.132-13.0143c2.547 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.665-1.3291-2.16-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.717 0 3.156-.9415 3.821-2.326z" id="error-description"/></svg>
127 + </header>
128 + <article>
129 + <p><strong>The page you were looking for doesn't exist.</strong> You may have mistyped the address or the page may have moved. If you're the application owner check the logs for more information.</p>
130 + </article>
131 + </main>
132 +
133 + </body>
134 +
135 +</html>
public/406-unsupported-browser.html new
+135
@@ -0,0 +1,135 @@
1 +<!doctype html>
2 +
3 +<html lang="en">
4 +
5 + <head>
6 +
7 + <title>Your browser is not supported (406 Not Acceptable)</title>
8 +
9 + <meta charset="utf-8">
10 + <meta name="viewport" content="initial-scale=1, width=device-width">
11 + <meta name="robots" content="noindex, nofollow">
12 +
13 + <style>
14 +
15 + *, *::before, *::after {
16 + box-sizing: border-box;
17 + }
18 +
19 + * {
20 + margin: 0;
21 + }
22 +
23 + html {
24 + font-size: 16px;
25 + }
26 +
27 + body {
28 + background: #FFF;
29 + color: #261B23;
30 + display: grid;
31 + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32 + font-size: clamp(1rem, 2.5vw, 2rem);
33 + -webkit-font-smoothing: antialiased;
34 + font-style: normal;
35 + font-weight: 400;
36 + letter-spacing: -0.0025em;
37 + line-height: 1.4;
38 + min-height: 100dvh;
39 + place-items: center;
40 + text-rendering: optimizeLegibility;
41 + -webkit-text-size-adjust: 100%;
42 + }
43 +
44 + #error-description {
45 + fill: #d30001;
46 + }
47 +
48 + #error-id {
49 + fill: #f0eff0;
50 + }
51 +
52 + @media (prefers-color-scheme: dark) {
53 + body {
54 + background: #101010;
55 + color: #e0e0e0;
56 + }
57 +
58 + #error-description {
59 + fill: #FF6161;
60 + }
61 +
62 + #error-id {
63 + fill: #2c2c2c;
64 + }
65 + }
66 +
67 + a {
68 + color: inherit;
69 + font-weight: 700;
70 + text-decoration: underline;
71 + text-underline-offset: 0.0925em;
72 + }
73 +
74 + b, strong {
75 + font-weight: 700;
76 + }
77 +
78 + i, em {
79 + font-style: italic;
80 + }
81 +
82 + main {
83 + display: grid;
84 + gap: 1em;
85 + padding: 2em;
86 + place-items: center;
87 + text-align: center;
88 + }
89 +
90 + main header {
91 + width: min(100%, 12em);
92 + }
93 +
94 + main header svg {
95 + height: auto;
96 + max-width: 100%;
97 + width: 100%;
98 + }
99 +
100 + main article {
101 + width: min(100%, 30em);
102 + }
103 +
104 + main article p {
105 + font-size: 75%;
106 + }
107 +
108 + main article br {
109 + display: none;
110 +
111 + @media(min-width: 48em) {
112 + display: inline;
113 + }
114 + }
115 +
116 + </style>
117 +
118 + </head>
119 +
120 + <body>
121 +
122 + <!-- This file lives in public/406-unsupported-browser.html -->
123 +
124 + <main>
125 + <header>
126 + <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm202.906 9.7326h-41.093c-2.433-7.2994-7.84-12.4361-17.302-12.4361-16.221 0-25.413 17.5728-25.954 34.8752v1.3517c5.137-7.0291 16.221-12.4361 30.82-12.4361 33.524 0 54.881 24.0612 54.881 53.7998 0 33.253-23.791 58.396-61.64 58.396-21.628 0-39.741-10.003-50.825-27.576-9.733-14.599-13.788-32.442-13.788-54.3406 0-51.9072 24.331-89.485807 66.236-89.485807 32.712 0 53.258 18.654107 58.665 47.851907zm-82.727 66.2355c0 13.247 9.463 22.439 22.71 22.439 12.977 0 22.439-9.192 22.439-22.439 0-13.517-9.462-22.7091-22.439-22.7091-13.247 0-22.71 9.1921-22.71 22.7091z" id="error-id"/><path d="m100.761 68.9967v34.0033h-7.1991l-14.2326-19.8814v19.8814h-8.5839v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm13.185 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.02-25.4194h9.083l12.958 34.0033h-9.027l-2.436-6.5902h-12.35l-2.381 6.5902h-8.806zm4.431 10.5222-3.489 9.5807h6.978zm17.44 11.0206c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm25.676 0c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm42.013 3.7658h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm23.4 16.7244v10.799h-8.694v-33.726h8.694v1.9937c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8703 11.131 13.0143 0 7.0886-3.932 13.0145-11.131 13.0145-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.16 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.717 0-3.157.9969-3.822 2.326zm21.892 7.1994v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.458 8.5839h-8.363v-1.274c-.83.831-3.322 1.717-5.981 1.717-4.928 0-9.082-2.769-9.082-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.045-2.9905-1.606 0-2.548.7199-2.936 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.553-1.0522-2.049-1.7167-3.655-1.7167-1.716 0-3.433.7199-3.433 2.3813 0 1.7168 1.717 2.4367 3.433 2.4367 1.606 0 3.102-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.694v-35.997h8.694v13.0697c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8149 11.131 13.0143s-3.932 13.0145-11.131 13.0145c-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.662 0-3.157.9969-3.822 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997z" id="error-description"/></svg>
127 + </header>
128 + <article>
129 + <p><strong>Your browser is not supported.</strong><br> Please upgrade your browser to continue.</p>
130 + </article>
131 + </main>
132 +
133 + </body>
134 +
135 +</html>
public/422.html new
+135
@@ -0,0 +1,135 @@
1 +<!doctype html>
2 +
3 +<html lang="en">
4 +
5 + <head>
6 +
7 + <title>The change you wanted was rejected (422 Unprocessable Entity)</title>
8 +
9 + <meta charset="utf-8">
10 + <meta name="viewport" content="initial-scale=1, width=device-width">
11 + <meta name="robots" content="noindex, nofollow">
12 +
13 + <style>
14 +
15 + *, *::before, *::after {
16 + box-sizing: border-box;
17 + }
18 +
19 + * {
20 + margin: 0;
21 + }
22 +
23 + html {
24 + font-size: 16px;
25 + }
26 +
27 + body {
28 + background: #FFF;
29 + color: #261B23;
30 + display: grid;
31 + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32 + font-size: clamp(1rem, 2.5vw, 2rem);
33 + -webkit-font-smoothing: antialiased;
34 + font-style: normal;
35 + font-weight: 400;
36 + letter-spacing: -0.0025em;
37 + line-height: 1.4;
38 + min-height: 100dvh;
39 + place-items: center;
40 + text-rendering: optimizeLegibility;
41 + -webkit-text-size-adjust: 100%;
42 + }
43 +
44 + #error-description {
45 + fill: #d30001;
46 + }
47 +
48 + #error-id {
49 + fill: #f0eff0;
50 + }
51 +
52 + @media (prefers-color-scheme: dark) {
53 + body {
54 + background: #101010;
55 + color: #e0e0e0;
56 + }
57 +
58 + #error-description {
59 + fill: #FF6161;
60 + }
61 +
62 + #error-id {
63 + fill: #2c2c2c;
64 + }
65 + }
66 +
67 + a {
68 + color: inherit;
69 + font-weight: 700;
70 + text-decoration: underline;
71 + text-underline-offset: 0.0925em;
72 + }
73 +
74 + b, strong {
75 + font-weight: 700;
76 + }
77 +
78 + i, em {
79 + font-style: italic;
80 + }
81 +
82 + main {
83 + display: grid;
84 + gap: 1em;
85 + padding: 2em;
86 + place-items: center;
87 + text-align: center;
88 + }
89 +
90 + main header {
91 + width: min(100%, 12em);
92 + }
93 +
94 + main header svg {
95 + height: auto;
96 + max-width: 100%;
97 + width: 100%;
98 + }
99 +
100 + main article {
101 + width: min(100%, 30em);
102 + }
103 +
104 + main article p {
105 + font-size: 75%;
106 + }
107 +
108 + main article br {
109 + display: none;
110 +
111 + @media(min-width: 48em) {
112 + display: inline;
113 + }
114 + }
115 +
116 + </style>
117 +
118 + </head>
119 +
120 + <body>
121 +
122 + <!-- This file lives in public/422.html -->
123 +
124 + <main>
125 + <header>
126 + <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm130.453 51.63681c0-8.9215-6.218-15.4099-15.681-15.4099-10.273 0-15.95 7.5698-16.491 16.4913h-44.608c3.244-30.8199 25.683-55.421707 61.099-55.421707 36.498 0 59.477 20.816907 59.477 51.636807 0 21.3577-14.869 36.7676-31.901 52.7186l-27.305 27.035h59.747v37.308h-120.306v-27.846l57.044-56.7736c11.084-11.8954 18.925-20.0059 18.925-29.7385zm140.455 0c0-8.9215-6.218-15.4099-15.68-15.4099-10.274 0-15.951 7.5698-16.492 16.4913h-44.608c3.245-30.8199 25.684-55.421707 61.1-55.421707 36.497 0 59.477 20.816907 59.477 51.636807 0 21.3577-14.87 36.7676-31.902 52.7186l-27.305 27.035h59.747v37.308h-120.305v-27.846l57.043-56.7736c11.085-11.8954 18.925-20.0059 18.925-29.7385z" id="error-id"/><path d="m19.3936 103.554c-8.9715 0-14.84183-5.0952-14.84183-14.4544v-20.1029h8.86083v19.3276c0 4.8181 2.2706 7.3102 5.981 7.3102 3.6551 0 5.9257-2.4921 5.9257-7.3102v-19.3276h8.8608v20.1583c0 9.3038-5.8149 14.399-14.7865 14.399zm18.734-.554v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm36.8584-1.994v10.799h-8.6946v-33.726h8.6946v1.9937c1.163-1.3291 3.5997-2.5475 6.1472-2.5475 7.1994 0 11.1314 5.8703 11.1314 13.0143 0 7.0886-3.932 13.0145-11.1314 13.0145-2.5475 0-4.9842-1.219-6.1472-2.548zm0-13.7893v6.5902c.6646 1.3845 2.1599 2.326 3.8213 2.326 2.9905 0 4.7626-2.3814 4.7626-5.5934s-1.7721-5.6488-4.7626-5.6488c-1.7168 0-3.1567.9969-3.8213 2.326zm36.789-9.2485v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.6949v-24.921h8.6949v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm10.352 0c0-7.6978 5.095-13.0143 12.571-13.0143 6.701 0 10.855 3.9874 11.574 9.8023h-8.417c-.222-1.4953-1.385-2.6029-3.157-2.6029-2.437 0-3.987 2.2706-3.987 5.8149s1.55 5.7595 3.987 5.7595c1.772 0 2.935-1.0522 3.157-2.5475h8.417c-.719 5.7596-4.873 9.8025-11.574 9.8025-7.476 0-12.571-5.3167-12.571-13.0145zm42.013 3.7658h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.544-3.5997zm13.428 11.0206h8.473c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.938-1.5506l-4.874-.9969c-4.153-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.763-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.74-8.2518zm24.269 0h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.763-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm47.918 7.6978h-8.363v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.695v-35.997h8.695v13.0697c1.163-1.3291 3.6-2.5475 6.147-2.5475 7.2 0 11.132 5.8149 11.132 13.0143s-3.932 13.0145-11.132 13.0145c-2.547 0-4.984-1.219-6.147-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.821 2.326 2.991 0 4.763-2.3814 4.763-5.5934s-1.772-5.6488-4.763-5.6488c-1.661 0-3.156.9969-3.821 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm25.461-15.2849h24.311v7.6424h-15.561v5.3165h14.232v7.4763h-14.232v5.8703h15.561v7.6978h-24.311zm27.942 34.0033v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm29.991-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm26.161-16.3371v24.921h-8.694v-24.921zm.61-6.7564c0 2.8244-2.271 4.652-4.929 4.652s-4.929-1.8276-4.929-4.652c0-2.8797 2.271-4.7073 4.929-4.7073s4.929 1.8276 4.929 4.7073zm5.382 23.0935v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm29.22 17.3889h-8.584l3.655-9.414-9.303-24.312h9.026l4.763 14.1773 4.652-14.1773h8.639z" id="error-description"/></svg>
127 + </header>
128 + <article>
129 + <p><strong>The change you wanted was rejected.</strong> Maybe you tried to change something you didn't have access to. If you're the application owner check the logs for more information.</p>
130 + </article>
131 + </main>
132 +
133 + </body>
134 +
135 +</html>
public/500.html new
+135
@@ -0,0 +1,135 @@
1 +<!doctype html>
2 +
3 +<html lang="en">
4 +
5 + <head>
6 +
7 + <title>We're sorry, but something went wrong (500 Internal Server Error)</title>
8 +
9 + <meta charset="utf-8">
10 + <meta name="viewport" content="initial-scale=1, width=device-width">
11 + <meta name="robots" content="noindex, nofollow">
12 +
13 + <style>
14 +
15 + *, *::before, *::after {
16 + box-sizing: border-box;
17 + }
18 +
19 + * {
20 + margin: 0;
21 + }
22 +
23 + html {
24 + font-size: 16px;
25 + }
26 +
27 + body {
28 + background: #FFF;
29 + color: #261B23;
30 + display: grid;
31 + font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32 + font-size: clamp(1rem, 2.5vw, 2rem);
33 + -webkit-font-smoothing: antialiased;
34 + font-style: normal;
35 + font-weight: 400;
36 + letter-spacing: -0.0025em;
37 + line-height: 1.4;
38 + min-height: 100dvh;
39 + place-items: center;
40 + text-rendering: optimizeLegibility;
41 + -webkit-text-size-adjust: 100%;
42 + }
43 +
44 + #error-description {
45 + fill: #d30001;
46 + }
47 +
48 + #error-id {
49 + fill: #f0eff0;
50 + }
51 +
52 + @media (prefers-color-scheme: dark) {
53 + body {
54 + background: #101010;
55 + color: #e0e0e0;
56 + }
57 +
58 + #error-description {
59 + fill: #FF6161;
60 + }
61 +
62 + #error-id {
63 + fill: #2c2c2c;
64 + }
65 + }
66 +
67 + a {
68 + color: inherit;
69 + font-weight: 700;
70 + text-decoration: underline;
71 + text-underline-offset: 0.0925em;
72 + }
73 +
74 + b, strong {
75 + font-weight: 700;
76 + }
77 +
78 + i, em {
79 + font-style: italic;
80 + }
81 +
82 + main {
83 + display: grid;
84 + gap: 1em;
85 + padding: 2em;
86 + place-items: center;
87 + text-align: center;
88 + }
89 +
90 + main header {
91 + width: min(100%, 12em);
92 + }
93 +
94 + main header svg {
95 + height: auto;
96 + max-width: 100%;
97 + width: 100%;
98 + }
99 +
100 + main article {
101 + width: min(100%, 30em);
102 + }
103 +
104 + main article p {
105 + font-size: 75%;
106 + }
107 +
108 + main article br {
109 + display: none;
110 +
111 + @media(min-width: 48em) {
112 + display: inline;
113 + }
114 + }
115 +
116 + </style>
117 +
118 + </head>
119 +
120 + <body>
121 +
122 + <!-- This file lives in public/500.html -->
123 +
124 + <main>
125 + <header>
126 + <svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m101.23 93.8427c-8.1103 0-15.4098 3.7849-19.7354 8.3813h-36.2269v-99.21891h103.8143v37.03791h-68.3984v24.8722c5.1366-2.7035 15.1396-5.9477 24.6014-5.9477 35.146 0 56.233 22.7094 56.233 55.4215 0 34.605-23.791 57.315-60.558 57.315-37.8492 0-61.64-22.169-63.8028-55.963h42.9857c1.0814 10.814 9.1919 19.195 21.6281 19.195 11.355 0 19.465-8.381 19.465-20.547 0-11.625-7.299-20.5463-20.006-20.5463zm138.833 77.8613c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" id="error-id"/><path d="m23.1377 68.9967v34.0033h-8.9162v-34.0033zm4.3157 34.0033v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm29.9913-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.5839v6.8671h5.2058v6.7564h-5.2058v8.307c0 1.9383.9415 2.769 2.6583 2.769.9414 0 1.9937-.2216 2.769-.5538v7.3654c-.9969.443-2.8798.775-4.8181.775-5.8703 0-9.1931-2.769-9.1931-9.0819zm32.3666-.1108h8.0301c-.8861 5.7597-5.2057 9.2487-11.6852 9.2487-7.6424 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.3165-13.0143 12.5159-13.0143 7.6424 0 11.9621 5.095 11.9621 12.5159v2.1598h-16.1156c.2769 2.9905 1.8275 4.5965 4.3196 4.5965 1.7722 0 3.1567-.7753 3.6551-2.4921zm-3.8212-10.0237c-2.0491 0-3.4336 1.2737-3.9874 3.5997h7.5317c-.1107-2.0491-1.3845-3.5997-3.5443-3.5997zm31.4299-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.599-.7753-2.382 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.381.443zm2.949 25.0318v-24.921h8.694v2.1598c1.385-1.5506 3.821-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.64v-14.2327c0-2.049-1.052-3.5443-3.267-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm50.371 0h-8.363v-1.274c-.83.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.433.7199-3.433 2.3813 0 1.7168 1.716 2.4367 3.433 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742-29.0191v35.997h-8.694v-35.997zm13.036 25.9178h9.248c.72 2.326 2.714 3.489 5.483 3.489 2.713 0 4.596-1.163 4.596-3.2674 0-1.6061-1.052-2.326-3.212-2.8244l-6.534-1.3845c-4.985-1.1076-8.751-3.7105-8.751-9.47 0-6.6456 5.538-11.0206 13.07-11.0206 8.307 0 13.014 4.5411 13.956 10.4114h-8.695c-.72-1.8829-2.27-3.3228-5.205-3.3228-2.548 0-4.265 1.1076-4.265 2.9905 0 1.4953 1.052 2.326 2.825 2.7137l6.645 1.5506c5.815 1.3845 9.027 4.5412 9.027 9.8023 0 6.9778-5.87 10.9654-13.291 10.9654-8.141 0-13.679-3.9322-14.897-10.6332zm46.509 1.3845h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm31.431-6.3134v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.382.443zm18.288 25.0318h-7.809l-9.47-24.921h8.861l4.763 14.288 4.652-14.288h8.528zm25.614-8.6947h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997zm31.43-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443zm13.703-8.9715h24.312v7.6424h-15.562v5.3165h14.232v7.4763h-14.232v5.8703h15.562v7.6978h-24.312zm44.667 8.9715v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm19.673 0v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm28.082-12.5713v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443z" id="error-description"/></svg>
127 + </header>
128 + <article>
129 + <p><strong>We're sorry, but something went wrong.</strong><br> If you're the application owner check the logs for more information.</p>
130 + </article>
131 + </main>
132 +
133 + </body>
134 +
135 +</html>
public/icon-bak.png
Binary files /dev/null and b/public/icon-bak.png differ
public/icon.png
Binary files /dev/null and b/public/icon.png differ
public/icon.svg new
+3
@@ -0,0 +1,3 @@
1 +<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
2 + <circle cx="256" cy="256" r="256" fill="red"/>
3 +</svg>
public/robots.txt new
+1
@@ -0,0 +1 @@
1 +# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
script/.keep
scripts/write_views.py new
+1001
@@ -0,0 +1,1001 @@
1 +#!/usr/bin/env python3
2 +"""Write all truncated ERB views for the siGit si Rails app."""
3 +
4 +import os
5 +
6 +# Reusable SVG path fragments
7 +GIT_PATH = (
8 + "M9 19c-5 1.5-5-2.5-7-3m14 6v-3.87a3.37 3.37 0 0 0-.94-2.61"
9 + "c3.14-.35 6.44-1.54 6.44-7A5.44 5.44 0 0 0 20 4.77 "
10 + "5.07 5.07 0 0 0 19.91 1S18.73.65 16 2.48a13.38 13.38 0 0 0-7 0"
11 + "C6.27.65 5.09 1 5.09 1A5.07 5.07 0 0 0 5 4.77"
12 + "a5.44 5.44 0 0 0-1.5 3.78c0 5.42 3.3 6.61 6.44 7"
13 + "A3.37 3.37 0 0 0 9 18.13V22"
14 +)
15 +
16 +REPO_PATH_16 = (
17 + "M2 2.5A2.5 2.5 0 0 1 4.5 0h8.75a.75.75 0 0 1 .75.75v12.5"
18 + "a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 1 0-1.5h1.75v-2h-8"
19 + "a1 1 0 0 0-.714 1.7.75.75 0 1 1-1.072 1.05A2.495 2.495 0 0 1 2 11.5"
20 + "Zm10.5-1h-8a1 1 0 0 0-1 1v6.708A2.486 2.486 0 0 1 4.5 9h8Z"
21 +)
22 +
23 +COMMIT_PATH_16 = (
24 + "M11.93 8.5a4.002 4.002 0 0 1-7.86 0H.75a.75.75 0 0 1 0-1.5h3.32"
25 + "a4.002 4.002 0 0 1 7.86 0h3.32a.75.75 0 0 1 0 1.5"
26 + "Zm-1.43-.75a2.5 2.5 0 1 0-5 0 2.5 2.5 0 0 0 5 0Z"
27 +)
28 +
29 +BRANCH_PATH_16 = (
30 + "M9.5 3.25a2.25 2.25 0 1 1 3 2.122V6A2.5 2.5 0 0 1 10 8.5H6"
31 + "a1 1 0 0 0-1 1v1.128a2.251 2.251 0 1 1-1.5 0V5.372"
32 + "a2.25 2.25 0 1 1 1.5 0v1.836A2.493 2.493 0 0 1 6 7h4"
33 + "a1 1 0 0 0 1-1v-.628A2.25 2.25 0 0 1 9.5 3.25"
34 + "Zm-6 0a.75.75 0 1 0 1.5 0 .75.75 0 0 0-1.5 0"
35 + "Zm8.25-.75a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5"
36 + "ZM4.25 12a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Z"
37 +)
38 +
39 +FOLDER_PATH_16 = (
40 + "M1.75 1A1.75 1.75 0 0 0 0 2.75v10.5C0 14.216.784 15 1.75 15h12.5"
41 + "A1.75 1.75 0 0 0 16 13.25v-8.5A1.75 1.75 0 0 0 14.25 3H7.5"
42 + "a.25.25 0 0 1-.2-.1l-.9-1.2C6.07 1.26 5.55 1 5 1Z"
43 +)
44 +
45 +FILE_PATH_16 = (
46 + "M2 1.75C2 .784 2.784 0 3.75 0h6.586c.464 0 .909.184 1.237.513"
47 + "l2.914 2.914c.329.328.513.773.513 1.237v9.586"
48 + "A1.75 1.75 0 0 1 13.25 16h-9.5A1.75 1.75 0 0 1 2 14.25"
49 + "Zm1.75-.25a.25.25 0 0 0-.25.25v12.5c0 .138.112.25.25.25h9.5"
50 + "a.25.25 0 0 0 .25-.25V6h-2.75A1.75 1.75 0 0 1 9 4.25V1.5"
51 + "Zm6.75.062V4.25c0 .138.112.25.25.25h2.688Z"
52 +)
53 +
54 +README_PATH_16 = (
55 + "M0 1.75A.75.75 0 0 1 .75 1h4.253c1.227 0 2.317.59 3 1.501"
56 + "A3.743 3.743 0 0 1 11.006 1h4.245a.75.75 0 0 1 .75.75v10.5"
57 + "a.75.75 0 0 1-.75.75h-4.507a2.25 2.25 0 0 0-1.591.659l-.622.621"
58 + "a.75.75 0 0 1-1.06 0l-.622-.621A2.25 2.25 0 0 0 5.258 13H.75"
59 + "a.75.75 0 0 1-.75-.75"
60 + "Zm7.251 10.324.004-5.073-.002-2.253A2.25 2.25 0 0 0 5.003 2.5H1.5v9"
61 + "h3.757a3.75 3.75 0 0 1 1.994.574"
62 + "ZM8.755 4.75l-.004 7.322a3.752 3.752 0 0 1 1.992-.572H14.5v-9"
63 + "h-3.495a2.25 2.25 0 0 0-2.25 2.25Z"
64 +)
65 +
66 +PLUS_PATH_16 = (
67 + "M7.75 2a.75.75 0 0 1 .75.75V7h4.25a.75.75 0 0 1 0 1.5H8.5v4.25"
68 + "a.75.75 0 0 1-1.5 0V8.5H2.75a.75.75 0 0 1 0-1.5H7V2.75"
69 + "A.75.75 0 0 1 7.75 2Z"
70 +)
71 +
72 +CHEVRON_PATH = "M4 6l4 4 4-4"
73 +
74 +EMAIL_PATH_16 = (
75 + "M1.75 2h12.5c.966 0 1.75.784 1.75 1.75v8.5"
76 + "A1.75 1.75 0 0 1 14.25 14H1.75A1.75 1.75 0 0 1 0 12.25v-8.5"
77 + "C0 2.784.784 2 1.75 2"
78 + "ZM1.5 12.251c0 .138.112.25.25.25h12.5a.25.25 0 0 0 .25-.25V5.809"
79 + "L8.38 9.397a.75.75 0 0 1-.76 0L1.5 5.809v6.442"
80 + "Zm13-8.181v-.32a.25.25 0 0 0-.25-.25H1.75a.25.25 0 0 0-.25.25v.32L8 7.88Z"
81 +)
82 +
83 +LOCK_PATH_16 = (
84 + "M4 4a4 4 0 0 1 8 0v2h.25c.966 0 1.75.784 1.75 1.75v5.5"
85 + "A1.75 1.75 0 0 1 12.25 15h-8.5A1.75 1.75 0 0 1 2 13.25v-5.5"
86 + "C2 6.784 2.784 6 3.75 6H4Zm8.25 3.5h-8.5a.25.25 0 0 0-.25.25v5.5"
87 + "c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-5.5"
88 + "a.25.25 0 0 0-.25-.25ZM10.5 6V4a2.5 2.5 0 1 0-5 0v2Z"
89 +)
90 +
91 +SHIELD_PATH_24 = (
92 + "M9 12.75 11.25 15 15 9.75"
93 + "m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749"
94 + "c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622"
95 + "0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"
96 +)
97 +
98 +FOLDER_OPEN_PATH = (
99 + "M3.75 9.776c.112-.017.227-.026.344-.026h15.812c.117 0 .232.009.344.026"
100 + "m-16.5 0a2.25 2.25 0 0 0-1.883 2.542l.857 6a2.25 2.25 0 0 0 2.227 1.932"
101 + "H19.05a2.25 2.25 0 0 0 2.227-1.932l.857-6a2.25 2.25 0 0 0-1.883-2.542"
102 + "m-16.5 0V6A2.25 2.25 0 0 1 6 3.75h3.879a1.5 1.5 0 0 1 1.06.44"
103 + "l2.122 2.12a1.5 1.5 0 0 0 1.06.44H18A2.25 2.25 0 0 1 20.25 9v.776"
104 +)
105 +
106 +files = {}
107 +
108 +# ---------------------------------------------------------------------------
109 +# layouts/application.html.erb
110 +# ---------------------------------------------------------------------------
111 +files["app/views/layouts/application.html.erb"] = (
112 + "<!DOCTYPE html>\n"
113 + '<html lang="en" class="h-full">\n'
114 + " <head>\n"
115 + ' <meta charset="utf-8">\n'
116 + ' <meta name="viewport" content="width=device-width, initial-scale=1">\n'
117 + ' <meta name="description" content="siGit \u2014 cloud repository hosting">\n'
118 + ' <title><%= content_for?(:title) ? "#{yield(:title)} \u00b7 siGit" : "siGit" %></title>\n'
119 + ' <%= stylesheet_link_tag "tailwind", "data-turbo-track": "reload" %>\n'
120 + " <%= javascript_importmap_tags %>\n"
121 + " <%= csrf_meta_tags %>\n"
122 + " </head>\n"
123 + "\n"
124 + ' <body class="h-full bg-white">\n'
125 + ' <%= render "shared/navbar" %>\n'
126 + "\n"
127 + " <% if notice.present? %>\n"
128 + ' <div class="bg-green-50 border-b border-green-200 px-4 py-3 text-sm text-green-800 text-center" role="alert">\n'
129 + " <%= notice %>\n"
130 + " </div>\n"
131 + " <% end %>\n"
132 + " <% if alert.present? %>\n"
133 + ' <div class="bg-amber-50 border-b border-amber-200 px-4 py-3 text-sm text-amber-800 text-center" role="alert">\n'
134 + " <%= alert %>\n"
135 + " </div>\n"
136 + " <% end %>\n"
137 + "\n"
138 + " <main>\n"
139 + " <%= yield %>\n"
140 + " </main>\n"
141 + "\n"
142 + ' <footer class="border-t border-gray-100 mt-16">\n'
143 + ' <div class="max-w-6xl mx-auto px-4 sm:px-6 py-8 flex items-center justify-between text-xs text-gray-400">\n'
144 + " <span>siGit si &mdash; cloud repository hosting</span>\n"
145 + ' <span>Built with <a href="https://rubyonrails.org" class="hover:text-gray-600">Rails 8</a></span>\n'
146 + " </div>\n"
147 + " </footer>\n"
148 + " </body>\n"
149 + "</html>\n"
150 +)
151 +
152 +# ---------------------------------------------------------------------------
153 +# shared/_navbar.html.erb
154 +# ---------------------------------------------------------------------------
155 +files["app/views/shared/_navbar.html.erb"] = (
156 + '<header class="border-b border-gray-200 bg-white sticky top-0 z-50">\n'
157 + ' <nav class="max-w-6xl mx-auto px-4 sm:px-6 h-14 flex items-center justify-between gap-6">\n'
158 + "\n"
159 + ' <div class="flex items-center gap-6">\n'
160 + ' <%= link_to root_path, class: "flex items-center gap-2 text-gray-900 hover:text-brand-500 transition-colors" do %>\n'
161 + ' <svg class="w-6 h-6" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n'
162 + ' stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n'
163 + f' <path d="{GIT_PATH}"/>\n'
164 + " </svg>\n"
165 + ' <span class="font-semibold text-base tracking-tight">siGit</span>\n'
166 + " <% end %>\n"
167 + "\n"
168 + " <% if signed_in? %>\n"
169 + ' <div class="hidden sm:flex items-center gap-1">\n'
170 + ' <%= link_to "Explore", "#", class: "nav-link px-2 py-1 rounded hover:bg-gray-50" %>\n'
171 + " </div>\n"
172 + " <% end %>\n"
173 + " </div>\n"
174 + "\n"
175 + ' <div class="flex items-center gap-3">\n'
176 + " <% if signed_in? %>\n"
177 + ' <%= link_to new_repository_path, class: "btn-secondary text-xs py-1.5 px-3 hidden sm:inline-flex" do %>\n'
178 + ' <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">\n'
179 + f' <path d="{PLUS_PATH_16}"/>\n'
180 + " </svg>\n"
181 + " New\n"
182 + " <% end %>\n"
183 + "\n"
184 + ' <div class="relative group">\n'
185 + ' <button class="flex items-center gap-2 hover:opacity-80 transition-opacity">\n'
186 + ' <img src="<%= current_user.avatar_url_or_default %>"\n'
187 + ' alt="<%= current_user.display_name_or_username %>"\n'
188 + ' class="w-7 h-7 rounded-full border border-gray-200">\n'
189 + ' <span class="text-sm font-medium text-gray-700 hidden sm:block"><%= current_user.username %></span>\n'
190 + ' <svg class="w-3.5 h-3.5 text-gray-400" fill="none" viewBox="0 0 16 16"\n'
191 + ' stroke="currentColor" stroke-width="2">\n'
192 + f' <path stroke-linecap="round" stroke-linejoin="round" d="{CHEVRON_PATH}"/>\n'
193 + " </svg>\n"
194 + " </button>\n"
195 + "\n"
196 + ' <div class="absolute right-0 top-full mt-1 w-48 bg-white border border-gray-200\n'
197 + " rounded shadow-lg py-1 opacity-0 invisible\n"
198 + " group-hover:opacity-100 group-hover:visible\n"
199 + ' transition-all duration-150 z-50">\n'
200 + ' <div class="px-3 py-2 border-b border-gray-100">\n'
201 + ' <p class="text-xs font-medium text-gray-900"><%= current_user.display_name_or_username %></p>\n'
202 + ' <p class="text-xs text-gray-500"><%= current_user.email %></p>\n'
203 + " </div>\n"
204 + " <%= link_to user_profile_path(current_user.username),\n"
205 + ' class: "block px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50" do %>Your repositories<% end %>\n'
206 + " <%= link_to settings_path,\n"
207 + ' class: "block px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50" do %>Settings<% end %>\n'
208 + ' <div class="border-t border-gray-100 mt-1">\n'
209 + " <%= button_to signout_path, method: :delete,\n"
210 + ' class: "block w-full text-left px-3 py-1.5 text-sm text-red-600 hover:bg-red-50 transition-colors" do %>\n'
211 + " Sign out\n"
212 + " <% end %>\n"
213 + " </div>\n"
214 + " </div>\n"
215 + " </div>\n"
216 + " <% else %>\n"
217 + ' <%= link_to "Sign in", signin_path, class: "btn-primary text-xs py-1.5 px-4" %>\n'
218 + " <% end %>\n"
219 + " </div>\n"
220 + " </nav>\n"
221 + "</header>\n"
222 +)
223 +
224 +# ---------------------------------------------------------------------------
225 +# pages/home.html.erb
226 +# ---------------------------------------------------------------------------
227 +files["app/views/pages/home.html.erb"] = (
228 + '<% content_for :title, "Welcome" %>\n'
229 + "\n"
230 + '<div class="min-h-screen">\n'
231 + ' <section class="border-b border-gray-100 bg-white">\n'
232 + ' <div class="max-w-4xl mx-auto px-4 sm:px-6 py-24 text-center">\n'
233 + ' <h1 class="text-4xl sm:text-5xl font-semibold text-gray-900 tracking-tight mb-6 leading-tight">\n'
234 + " Code, together.<br>\n"
235 + ' <span class="text-brand-500">Simply.</span>\n'
236 + " </h1>\n"
237 + ' <p class="text-lg text-gray-500 max-w-xl mx-auto mb-10 font-light leading-relaxed">\n'
238 + " siGit is a minimal cloud repository host built for clarity and speed.\n"
239 + " Host your Git repositories without noise.\n"
240 + " </p>\n"
241 + ' <%= link_to signin_path, class: "btn-primary px-8 py-3 text-base" do %>\n'
242 + ' <svg class="w-5 h-5" viewBox="0 0 24 24" fill="none" stroke="currentColor"\n'
243 + ' stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n'
244 + f' <path d="{GIT_PATH}"/>\n'
245 + " </svg>\n"
246 + " Sign in with smbCloud\n"
247 + " <% end %>\n"
248 + " </div>\n"
249 + " </section>\n"
250 + "\n"
251 + ' <section class="max-w-4xl mx-auto px-4 sm:px-6 py-20">\n'
252 + ' <div class="grid grid-cols-1 sm:grid-cols-3 gap-12">\n'
253 + "\n"
254 + " <div>\n"
255 + ' <div class="w-8 h-8 mb-4 text-brand-500">\n'
256 + ' <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n'
257 + ' <path stroke-linecap="round" stroke-linejoin="round"\n'
258 + f' d="{FOLDER_OPEN_PATH}"/>\n'
259 + " </svg>\n"
260 + " </div>\n"
261 + ' <h3 class="font-semibold text-gray-900 mb-2">Repository Hosting</h3>\n'
262 + ' <p class="text-sm text-gray-500 leading-relaxed">Create and manage Git repositories\n'
263 + " with a clean, distraction-free interface.</p>\n"
264 + " </div>\n"
265 + "\n"
266 + " <div>\n"
267 + ' <div class="w-8 h-8 mb-4 text-brand-500">\n'
268 + ' <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n'
269 + ' <path stroke-linecap="round" stroke-linejoin="round"\n'
270 + ' d="M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"/>\n'
271 + " </svg>\n"
272 + " </div>\n"
273 + ' <h3 class="font-semibold text-gray-900 mb-2">Code Browsing</h3>\n'
274 + ' <p class="text-sm text-gray-500 leading-relaxed">Browse your code with syntax\n'
275 + " highlighting, file tree navigation, and commit history.</p>\n"
276 + " </div>\n"
277 + "\n"
278 + " <div>\n"
279 + ' <div class="w-8 h-8 mb-4 text-brand-500">\n'
280 + ' <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">\n'
281 + ' <path stroke-linecap="round" stroke-linejoin="round"\n'
282 + ' d="M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026'
283 + "-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591"
284 + 'l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 0 1 21.75 8.25Z"/>\n'
285 + " </svg>\n"
286 + " </div>\n"
287 + ' <h3 class="font-semibold text-gray-900 mb-2">Secure Auth</h3>\n'
288 + ' <p class="text-sm text-gray-500 leading-relaxed">Authentication via smbCloud Auth\n'
289 + " &mdash; secure and token-based. No passwords stored by siGit.</p>\n"
290 + " </div>\n"
291 + "\n"
292 + " </div>\n"
293 + " </section>\n"
294 + "</div>\n"
295 +)
296 +
297 +# ---------------------------------------------------------------------------
298 +# pages/dashboard.html.erb
299 +# ---------------------------------------------------------------------------
300 +files["app/views/pages/dashboard.html.erb"] = (
301 + '<% content_for :title, "Dashboard" %>\n'
302 + "\n"
303 + '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-8">\n'
304 + ' <div class="grid grid-cols-1 lg:grid-cols-4 gap-8">\n'
305 + "\n"
306 + ' <aside class="lg:col-span-1">\n'
307 + ' <div class="text-center sm:text-left">\n'
308 + ' <img src="<%= current_user.avatar_url_or_default %>"\n'
309 + ' alt="<%= current_user.display_name_or_username %>"\n'
310 + ' class="w-20 h-20 rounded-full border border-gray-200 mx-auto sm:mx-0 mb-4">\n'
311 + ' <h2 class="font-semibold text-gray-900 text-base"><%= current_user.display_name_or_username %></h2>\n'
312 + ' <p class="text-sm text-gray-500"><%= current_user.username %></p>\n'
313 + " </div>\n"
314 + ' <div class="mt-6">\n'
315 + ' <%= link_to new_repository_path, class: "btn-secondary w-full justify-center" do %>\n'
316 + ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
317 + f' <path d="{PLUS_PATH_16}"/>\n'
318 + " </svg>\n"
319 + " New repository\n"
320 + " <% end %>\n"
321 + " </div>\n"
322 + " </aside>\n"
323 + "\n"
324 + ' <main class="lg:col-span-3">\n'
325 + ' <div class="flex items-center justify-between mb-4">\n'
326 + ' <h1 class="text-base font-semibold text-gray-900">Your repositories</h1>\n'
327 + " <%= link_to user_profile_path(current_user.username),\n"
328 + ' class: "text-xs text-brand-500 hover:underline" do %>View all<% end %>\n'
329 + " </div>\n"
330 + "\n"
331 + " <% if @repositories.any? %>\n"
332 + ' <div class="card divide-y divide-gray-100">\n'
333 + " <% @repositories.each do |repo| %>\n"
334 + ' <div class="px-4 py-3 hover:bg-gray-50 transition-colors">\n'
335 + ' <div class="flex items-start justify-between gap-4">\n'
336 + ' <div class="min-w-0 flex-1">\n'
337 + " <%= link_to repository_path(current_user.username, repo.name),\n"
338 + ' class: "font-medium text-brand-500 hover:underline text-sm" do %><%= repo.name %><% end %>\n'
339 + " <% if repo.description.present? %>\n"
340 + ' <p class="text-xs text-gray-500 mt-0.5 truncate"><%= repo.description %></p>\n'
341 + " <% end %>\n"
342 + " </div>\n"
343 + ' <div class="flex items-center gap-3 text-xs text-gray-400 shrink-0">\n'
344 + " <% if repo.is_private %>\n"
345 + ' <span class="badge-gray">Private</span>\n'
346 + " <% end %>\n"
347 + " <span><%= time_ago_in_words(repo.updated_at) %> ago</span>\n"
348 + " </div>\n"
349 + " </div>\n"
350 + " </div>\n"
351 + " <% end %>\n"
352 + " </div>\n"
353 + " <% else %>\n"
354 + ' <div class="card px-6 py-12 text-center">\n'
355 + ' <svg class="w-12 h-12 mx-auto text-gray-300 mb-4" viewBox="0 0 24 24"\n'
356 + ' fill="none" stroke="currentColor" stroke-width="1">\n'
357 + ' <path stroke-linecap="round" stroke-linejoin="round"\n'
358 + f' d="{FOLDER_OPEN_PATH}"/>\n'
359 + " </svg>\n"
360 + ' <p class="text-sm text-gray-500 mb-4">No repositories yet.</p>\n'
361 + ' <%= link_to new_repository_path, class: "btn-primary" do %>Create your first repository<% end %>\n'
362 + " </div>\n"
363 + " <% end %>\n"
364 + " </main>\n"
365 + "\n"
366 + " </div>\n"
367 + "</div>\n"
368 +)
369 +
370 +# ---------------------------------------------------------------------------
371 +# users/show.html.erb
372 +# ---------------------------------------------------------------------------
373 +files["app/views/users/show.html.erb"] = (
374 + "<% content_for :title, @profile_user.display_name_or_username %>\n"
375 + "\n"
376 + '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-10">\n'
377 + ' <div class="grid grid-cols-1 lg:grid-cols-4 gap-10">\n'
378 + "\n"
379 + ' <aside class="lg:col-span-1">\n'
380 + ' <img src="<%= @profile_user.avatar_url_or_default %>"\n'
381 + ' alt="<%= @profile_user.display_name_or_username %>"\n'
382 + ' class="w-full max-w-[200px] rounded-full border border-gray-200 mb-4">\n'
383 + ' <h1 class="text-xl font-semibold text-gray-900"><%= @profile_user.display_name_or_username %></h1>\n'
384 + ' <p class="text-gray-500 text-sm"><%= @profile_user.username %></p>\n'
385 + " <% if @profile_user.email.present? %>\n"
386 + ' <div class="flex items-center gap-2 mt-3 text-sm text-gray-500">\n'
387 + ' <svg class="w-4 h-4 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
388 + f' <path d="{EMAIL_PATH_16}"/>\n'
389 + " </svg>\n"
390 + " <%= @profile_user.email %>\n"
391 + " </div>\n"
392 + " <% end %>\n"
393 + " </aside>\n"
394 + "\n"
395 + ' <main class="lg:col-span-3">\n'
396 + ' <div class="flex items-center justify-between mb-4">\n'
397 + ' <h2 class="text-base font-semibold text-gray-900">\n'
398 + " Repositories\n"
399 + ' <span class="badge-gray ml-1 align-middle"><%= @repositories.count %></span>\n'
400 + " </h2>\n"
401 + " <% if signed_in? && current_user == @profile_user %>\n"
402 + ' <%= link_to new_repository_path, class: "btn-secondary text-xs" do %>New<% end %>\n'
403 + " <% end %>\n"
404 + " </div>\n"
405 + "\n"
406 + " <% if @repositories.any? %>\n"
407 + ' <div class="space-y-3">\n'
408 + " <% @repositories.each do |repo| %>\n"
409 + ' <div class="card px-5 py-4 hover:border-gray-300 transition-colors">\n'
410 + ' <div class="flex items-start justify-between gap-4">\n'
411 + ' <div class="min-w-0 flex-1">\n'
412 + ' <div class="flex items-center gap-2 mb-1">\n'
413 + " <%= link_to repo.name,\n"
414 + " repository_path(@profile_user.username, repo.name),\n"
415 + ' class: "font-semibold text-brand-500 hover:underline" %>\n'
416 + " <% if repo.is_private %>\n"
417 + ' <span class="badge-gray">Private</span>\n'
418 + " <% end %>\n"
419 + " </div>\n"
420 + " <% if repo.description.present? %>\n"
421 + ' <p class="text-sm text-gray-500"><%= repo.description %></p>\n'
422 + " <% end %>\n"
423 + " </div>\n"
424 + ' <div class="text-xs text-gray-400 shrink-0">\n'
425 + " <%= time_ago_in_words(repo.updated_at) %> ago\n"
426 + " </div>\n"
427 + " </div>\n"
428 + " </div>\n"
429 + " <% end %>\n"
430 + " </div>\n"
431 + " <% else %>\n"
432 + ' <div class="card px-6 py-12 text-center">\n'
433 + ' <p class="text-sm text-gray-400">No public repositories.</p>\n'
434 + " </div>\n"
435 + " <% end %>\n"
436 + " </main>\n"
437 + "\n"
438 + " </div>\n"
439 + "</div>\n"
440 +)
441 +
442 +# ---------------------------------------------------------------------------
443 +# repositories/show.html.erb
444 +# ---------------------------------------------------------------------------
445 +files["app/views/repositories/show.html.erb"] = (
446 + "<% content_for :title, @repository.full_name %>\n"
447 + "\n"
448 + '<div class="border-b border-gray-200 bg-white">\n'
449 + ' <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">\n'
450 + "\n"
451 + ' <div class="flex items-center gap-2 text-sm mb-4">\n'
452 + ' <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">\n'
453 + f' <path d="{REPO_PATH_16}"/>\n'
454 + " </svg>\n"
455 + " <%= link_to @owner.username, user_profile_path(@owner.username),\n"
456 + ' class: "text-brand-500 hover:underline font-medium" %>\n'
457 + ' <span class="text-gray-400">/</span>\n'
458 + " <%= link_to @repository.name, repository_path(@owner.username, @repository.name),\n"
459 + ' class: "text-brand-500 hover:underline font-semibold" %>\n'
460 + " <% if @repository.is_private %>\n"
461 + ' <span class="badge-gray ml-1">Private</span>\n'
462 + " <% end %>\n"
463 + " </div>\n"
464 + "\n"
465 + " <% if @repository.description.present? %>\n"
466 + ' <p class="text-sm text-gray-600 mb-4"><%= @repository.description %></p>\n'
467 + " <% end %>\n"
468 + "\n"
469 + ' <div class="flex items-center gap-0 -mb-px">\n'
470 + " <%= link_to repository_path(@owner.username, @repository.name),\n"
471 + ' class: "tab-item active flex items-center gap-1.5" do %>\n'
472 + ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
473 + f' <path d="{REPO_PATH_16}"/>\n'
474 + " </svg>\n"
475 + " Code\n"
476 + " <% end %>\n"
477 + " <% if @repository.initialized? %>\n"
478 + " <%= link_to repository_commits_path(@owner.username, @repository.name,\n"
479 + " @branch || @repository.default_branch),\n"
480 + ' class: "tab-item flex items-center gap-1.5" do %>\n'
481 + ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
482 + f' <path d="{COMMIT_PATH_16}"/>\n'
483 + " </svg>\n"
484 + " Commits\n"
485 + " <% if @commit_count&.> 0 %>\n"
486 + ' <span class="badge-gray text-xs"><%= number_with_delimiter(@commit_count) %></span>\n'
487 + " <% end %>\n"
488 + " <% end %>\n"
489 + " <% end %>\n"
490 + " </div>\n"
491 + " </div>\n"
492 + "</div>\n"
493 + "\n"
494 + '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">\n'
495 + " <% if @empty %>\n"
496 + ' <div class="card p-8 text-center max-w-2xl mx-auto">\n'
497 + ' <svg class="w-16 h-16 mx-auto text-gray-200 mb-5" viewBox="0 0 24 24"\n'
498 + ' fill="none" stroke="currentColor" stroke-width="1"\n'
499 + ' stroke-linecap="round" stroke-linejoin="round">\n'
500 + f' <path d="{GIT_PATH}"/>\n'
501 + " </svg>\n"
502 + ' <h2 class="text-lg font-semibold text-gray-900 mb-2">This repository is empty</h2>\n'
503 + ' <p class="text-sm text-gray-500 mb-6">Get started by pushing your first commit.</p>\n'
504 + ' <div class="code-container text-left p-4 max-w-lg mx-auto text-xs font-mono space-y-0.5">\n'
505 + ' <p class="text-gray-400 mb-1"># Clone and push</p>\n'
506 + ' <p class="text-gray-700">git clone git@sigitsi.com:<%= @owner.username %>/<%= @repository.name %></p>\n'
507 + ' <p class="text-gray-700">cd <%= @repository.name %></p>\n'
508 + ' <p class="text-gray-700">echo "# <%= @repository.name %>" &gt; README.md</p>\n'
509 + ' <p class="text-gray-700">git add . &amp;&amp; git commit -m "Initial commit"</p>\n'
510 + ' <p class="text-gray-700">git push origin main</p>\n'
511 + " </div>\n"
512 + " </div>\n"
513 + " <% else %>\n"
514 + "\n"
515 + ' <div class="card rounded-b-none border-b-0 px-4 py-2.5\n'
516 + ' flex items-center justify-between gap-4 bg-gray-50">\n'
517 + ' <div class="flex items-center gap-3">\n'
518 + ' <span class="btn-secondary py-1 px-3 text-xs font-mono flex items-center gap-1.5 cursor-default">\n'
519 + ' <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">\n'
520 + f' <path d="{BRANCH_PATH_16}"/>\n'
521 + " </svg>\n"
522 + " <%= @branch %>\n"
523 + " </span>\n"
524 + " <% if @recent_commits.first %>\n"
525 + " <% commit = @recent_commits.first %>\n"
526 + ' <span class="text-xs text-gray-500">\n'
527 + " <%= link_to commit[:short_sha],\n"
528 + " repository_commit_path(@owner.username, @repository.name, commit[:sha]),\n"
529 + ' class: "font-mono text-brand-500 hover:underline" %>\n'
530 + " &middot; <%= commit[:subject] %>\n"
531 + ' &middot; <span class="text-gray-400"><%= time_ago_in_words(commit[:authored_date]) %> ago</span>\n'
532 + " </span>\n"
533 + " <% end %>\n"
534 + " </div>\n"
535 + ' <div class="flex items-center gap-3 text-xs text-gray-500">\n'
536 + " <%= link_to repository_commits_path(@owner.username, @repository.name, @branch),\n"
537 + ' class: "flex items-center gap-1 hover:text-gray-700" do %>\n'
538 + ' <svg class="w-3.5 h-3.5" viewBox="0 0 16 16" fill="currentColor">\n'
539 + f' <path d="{COMMIT_PATH_16}"/>\n'
540 + " </svg>\n"
541 + " <%= number_with_delimiter(@commit_count) %> commits\n"
542 + " <% end %>\n"
543 + " </div>\n"
544 + " </div>\n"
545 + "\n"
546 + ' <div class="card rounded-t-none">\n'
547 + " <% @tree.each do |entry| %>\n"
548 + ' <div class="file-row">\n'
549 + ' <% if entry[:type] == "tree" %>\n'
550 + ' <svg class="w-4 h-4 text-brand-300 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
551 + f' <path d="{FOLDER_PATH_16}"/>\n'
552 + " </svg>\n"
553 + " <%= link_to entry[:name],\n"
554 + " repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
555 + ' class: "text-brand-500 hover:underline font-medium flex-1" %>\n'
556 + " <% else %>\n"
557 + ' <svg class="w-4 h-4 text-gray-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
558 + f' <path d="{FILE_PATH_16}"/>\n'
559 + " </svg>\n"
560 + " <%= link_to entry[:name],\n"
561 + " repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
562 + ' class: "text-gray-800 hover:text-brand-500 hover:underline flex-1" %>\n'
563 + " <% end %>\n"
564 + " </div>\n"
565 + " <% end %>\n"
566 + " </div>\n"
567 + "\n"
568 + " <% if @readme_html %>\n"
569 + ' <div class="card mt-6">\n'
570 + ' <div class="px-4 py-3 border-b border-gray-100 flex items-center gap-2 bg-gray-50">\n'
571 + ' <svg class="w-4 h-4 text-gray-400" viewBox="0 0 16 16" fill="currentColor">\n'
572 + f' <path d="{README_PATH_16}"/>\n'
573 + " </svg>\n"
574 + ' <span class="text-xs font-medium text-gray-600"><%= @readme_filename %></span>\n'
575 + " </div>\n"
576 + ' <div class="px-6 py-6 prose-readme">\n'
577 + " <%= @readme_html %>\n"
578 + " </div>\n"
579 + " </div>\n"
580 + " <% end %>\n"
581 + "\n"
582 + " <% end %>\n"
583 + "</div>\n"
584 +)
585 +
586 +# ---------------------------------------------------------------------------
587 +# repositories/new.html.erb
588 +# ---------------------------------------------------------------------------
589 +files["app/views/repositories/new.html.erb"] = (
590 + '<% content_for :title, "New repository" %>\n'
591 + "\n"
592 + '<div class="max-w-2xl mx-auto px-4 sm:px-6 py-12">\n'
593 + ' <h1 class="text-xl font-semibold text-gray-900 mb-2">Create a new repository</h1>\n'
594 + ' <p class="text-sm text-gray-500 mb-8">A repository contains all project files, including revision history.</p>\n'
595 + "\n"
596 + ' <%= form_with model: @repository, url: "/new", method: :post, class: "space-y-6" do |f| %>\n'
597 + " <% if @repository.errors.any? %>\n"
598 + ' <div class="border border-red-200 bg-red-50 rounded px-4 py-3">\n'
599 + ' <p class="text-sm font-medium text-red-800 mb-1">Please fix the following errors:</p>\n'
600 + ' <ul class="list-disc pl-4 space-y-0.5">\n'
601 + " <% @repository.errors.full_messages.each do |msg| %>\n"
602 + ' <li class="text-sm text-red-700"><%= msg %></li>\n'
603 + " <% end %>\n"
604 + " </ul>\n"
605 + " </div>\n"
606 + " <% end %>\n"
607 + "\n"
608 + ' <div class="flex items-end gap-2">\n'
609 + ' <div class="flex-1 min-w-0">\n'
610 + ' <label class="form-label">Owner</label>\n'
611 + ' <div class="flex items-center gap-2 form-input bg-gray-50 text-gray-600 cursor-not-allowed">\n'
612 + ' <img src="<%= current_user.avatar_url_or_default %>" class="w-4 h-4 rounded-full">\n'
613 + " <span><%= current_user.username %></span>\n"
614 + " </div>\n"
615 + " </div>\n"
616 + ' <div class="flex items-center pb-2.5 text-gray-400 font-light text-lg">/</div>\n'
617 + ' <div class="flex-1 min-w-0">\n'
618 + ' <%= f.label :name, "Repository name", class: "form-label" %>\n'
619 + ' <%= f.text_field :name, class: "form-input", placeholder: "my-project", autofocus: true,\n'
620 + ' pattern: "[a-zA-Z0-9._-]+",\n'
621 + ' title: "Letters, numbers, hyphens, underscores, and dots only" %>\n'
622 + " </div>\n"
623 + " </div>\n"
624 + "\n"
625 + " <div>\n"
626 + ' <%= f.label :description, "Description", class: "form-label" %>\n'
627 + ' <span class="text-xs text-gray-400 ml-1">(optional)</span>\n'
628 + ' <%= f.text_area :description, class: "form-input", rows: 2,\n'
629 + ' placeholder: "Short description of your project" %>\n'
630 + " </div>\n"
631 + "\n"
632 + ' <div class="border border-gray-200 rounded divide-y divide-gray-100">\n'
633 + ' <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-gray-50">\n'
634 + ' <%= f.radio_button :is_private, false, class: "mt-0.5" %>\n'
635 + " <div>\n"
636 + ' <div class="flex items-center gap-2">\n'
637 + ' <svg class="w-4 h-4 text-gray-600" viewBox="0 0 16 16" fill="currentColor">\n'
638 + f' <path d="{REPO_PATH_16}"/>\n'
639 + " </svg>\n"
640 + ' <span class="text-sm font-medium text-gray-900">Public</span>\n'
641 + " </div>\n"
642 + ' <p class="text-xs text-gray-500 mt-0.5">Anyone can see this repository.</p>\n'
643 + " </div>\n"
644 + " </label>\n"
645 + ' <label class="flex items-start gap-3 px-4 py-3 cursor-pointer hover:bg-gray-50">\n'
646 + ' <%= f.radio_button :is_private, true, class: "mt-0.5" %>\n'
647 + " <div>\n"
648 + ' <div class="flex items-center gap-2">\n'
649 + ' <svg class="w-4 h-4 text-gray-600" viewBox="0 0 16 16" fill="currentColor">\n'
650 + f' <path d="{LOCK_PATH_16}"/>\n'
651 + " </svg>\n"
652 + ' <span class="text-sm font-medium text-gray-900">Private</span>\n'
653 + " </div>\n"
654 + ' <p class="text-xs text-gray-500 mt-0.5">Only you can see this repository.</p>\n'
655 + " </div>\n"
656 + " </label>\n"
657 + " </div>\n"
658 + "\n"
659 + " <div>\n"
660 + ' <%= f.label :default_branch, "Default branch", class: "form-label" %>\n'
661 + ' <%= f.text_field :default_branch, class: "form-input max-w-xs", value: "main" %>\n'
662 + " </div>\n"
663 + "\n"
664 + ' <div class="pt-2 border-t border-gray-100 flex items-center gap-3">\n'
665 + ' <%= f.submit "Create repository", class: "btn-primary cursor-pointer" %>\n'
666 + ' <%= link_to "Cancel", root_path, class: "btn-ghost" %>\n'
667 + " </div>\n"
668 + " <% end %>\n"
669 + "</div>\n"
670 +)
671 +
672 +# ---------------------------------------------------------------------------
673 +# repositories/tree.html.erb
674 +# ---------------------------------------------------------------------------
675 +files["app/views/repositories/tree.html.erb"] = (
676 + '<% content_for :title, "#{@current_path} \u00b7 #{@repository.full_name}" %>\n'
677 + "\n"
678 + '<div class="border-b border-gray-200 bg-white">\n'
679 + ' <div class="max-w-6xl mx-auto px-4 sm:px-6 pt-6 pb-0">\n'
680 + "\n"
681 + ' <div class="flex items-center gap-2 text-sm mb-3">\n'
682 + " <%= link_to @owner.username, user_profile_path(@owner.username),\n"
683 + ' class: "text-brand-500 hover:underline font-medium" %>\n'
684 + ' <span class="text-gray-400">/</span>\n'
685 + " <%= link_to @repository.name, repository_path(@owner.username, @repository.name),\n"
686 + ' class: "text-brand-500 hover:underline font-semibold" %>\n'
687 + " </div>\n"
688 + "\n"
689 + ' <nav class="flex items-center gap-1.5 text-sm mb-4 flex-wrap">\n'
690 + " <%= link_to @repository.name, repository_path(@owner.username, @repository.name),\n"
691 + ' class: "breadcrumb-item font-medium" %>\n'
692 + ' <span class="text-gray-400">/</span>\n'
693 + " <% @path_parts.each_with_index do |part, i| %>\n"
694 + ' <% partial_path = @path_parts[0..i].join("/") %>\n'
695 + " <% if i < @path_parts.length - 1 %>\n"
696 + " <%= link_to part,\n"
697 + " repository_tree_path(@owner.username, @repository.name, @branch, partial_path),\n"
698 + ' class: "breadcrumb-item" %>\n'
699 + ' <span class="text-gray-400">/</span>\n'
700 + " <% else %>\n"
701 + ' <span class="font-medium text-gray-900"><%= part %></span>\n'
702 + " <% end %>\n"
703 + " <% end %>\n"
704 + " </nav>\n"
705 + "\n"
706 + ' <div class="flex items-center gap-0 -mb-px">\n'
707 + " <%= link_to repository_path(@owner.username, @repository.name),\n"
708 + ' class: "tab-item flex items-center gap-1.5" do %>\n'
709 + ' <svg class="w-4 h-4" viewBox="0 0 16 16" fill="currentColor">\n'
710 + f' <path d="{REPO_PATH_16}"/>\n'
711 + " </svg>\n"
712 + " Code\n"
713 + " <% end %>\n"
714 + " </div>\n"
715 + " </div>\n"
716 + "</div>\n"
717 + "\n"
718 + '<div class="max-w-6xl mx-auto px-4 sm:px-6 py-6">\n'
719 + ' <div class="card">\n'
720 + " <% @tree.each do |entry| %>\n"
721 + ' <div class="file-row">\n'
722 + ' <% if entry[:type] == "tree" %>\n'
723 + ' <svg class="w-4 h-4 text-brand-300 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
724 + f' <path d="{FOLDER_PATH_16}"/>\n'
725 + " </svg>\n"
726 + " <%= link_to entry[:name],\n"
727 + " repository_tree_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
728 + ' class: "text-brand-500 hover:underline font-medium flex-1" %>\n'
729 + " <% else %>\n"
730 + ' <svg class="w-4 h-4 text-gray-400 shrink-0" viewBox="0 0 16 16" fill="currentColor">\n'
731 + f' <path d="{FILE_PATH_16}"/>\n'
732 + " </svg>\n"
733 + " <%= link_to entry[:name],\n"
734 + " repository_blob_path(@owner.username, @repository.name, @branch, entry[:path]),\n"
735 + ' class: "text-gray-800 hover:text-brand-500 hover:underline flex-1" %>\n'
736 + " <% end %>\n"
737 + " </div>\n"
738 + " <% end %>\n"
739 + " </div>\n"
740 + "</div>\n"
741 +)
742 +
743 +# ---------------------------------------------------------------------------
744 +# config/tailwind.config.js
745 +# ---------------------------------------------------------------------------
746 +files["config/tailwind.config.js"] = (
747 + "const defaultTheme = require('tailwindcss/defaultTheme')\n"
748 + "\n"
749 + "module.exports = {\n"
750 + " content: [\n"
751 + " './public/*.html',\n"
752 + " './app/helpers/**/*.rb',\n"
753 + " './app/javascript/**/*.js',\n"
754 + " './app/views/**/*.{erb,haml,html,slim}'\n"
755 + " ],\n"
756 + " theme: {\n"
757 + " extend: {\n"
758 + " fontFamily: {\n"
759 + " sans: [\n"
760 + " 'Inter', 'ui-sans-serif', 'system-ui', '-apple-system',\n"
761 + " 'BlinkMacSystemFont', 'Segoe UI', 'Roboto',\n"
762 + " ...defaultTheme.fontFamily.sans\n"
763 + " ],\n"
764 + " mono: [\n"
765 + " 'JetBrains Mono', 'ui-monospace', 'SFMono-Regular',\n"
766 + " 'Menlo', 'Monaco', 'Consolas',\n"
767 + " ...defaultTheme.fontFamily.mono\n"
768 + " ],\n"
769 + " },\n"
770 + " colors: {\n"
771 + " brand: {\n"
772 + " 50: '#EEF4FF',\n"
773 + " 100: '#D6E6FF',\n"
774 + " 200: '#B3CEFF',\n"
775 + " 300: '#80ADFF',\n"
776 + " 400: '#4D8CFF',\n"
777 + " 500: '#0057B8',\n"
778 + " 600: '#004A9E',\n"
779 + " 700: '#003D84',\n"
780 + " 800: '#002F6A',\n"
781 + " 900: '#002050',\n"
782 + " },\n"
783 + " },\n"
784 + " maxWidth: {\n"
785 + " '8xl': '88rem',\n"
786 + " },\n"
787 + " },\n"
788 + " },\n"
789 + " plugins: [],\n"
790 + "}\n"
791 +)
792 +
793 +# ---------------------------------------------------------------------------
794 +# app/assets/stylesheets/application.tailwind.css
795 +# ---------------------------------------------------------------------------
796 +files["app/assets/stylesheets/application.tailwind.css"] = (
797 + "@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');\n"
798 + "@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&display=swap');\n"
799 + "\n"
800 + "@tailwind base;\n"
801 + "@tailwind components;\n"
802 + "@tailwind utilities;\n"
803 + "\n"
804 + "@layer base {\n"
805 + " html { @apply antialiased; }\n"
806 + " body { @apply bg-white text-gray-900 font-sans text-sm leading-relaxed; }\n"
807 + " a { @apply text-brand-500; }\n"
808 + " code { @apply font-mono text-xs; }\n"
809 + "}\n"
810 + "\n"
811 + "@layer components {\n"
812 + " /* ---- Navigation ---- */\n"
813 + " .nav-link {\n"
814 + " @apply text-gray-600 hover:text-gray-900 text-sm font-medium transition-colors duration-150;\n"
815 + " }\n"
816 + "\n"
817 + " /* ---- Buttons ---- */\n"
818 + " .btn-primary {\n"
819 + " @apply inline-flex items-center gap-2 px-4 py-2 bg-brand-500 text-white text-sm\n"
820 + " font-medium rounded hover:bg-brand-600 transition-colors duration-150 cursor-pointer;\n"
821 + " }\n"
822 + " .btn-secondary {\n"
823 + " @apply inline-flex items-center gap-2 px-4 py-2 bg-white text-gray-700 text-sm\n"
824 + " font-medium rounded border border-gray-300 hover:bg-gray-50\n"
825 + " transition-colors duration-150 cursor-pointer;\n"
826 + " }\n"
827 + " .btn-danger {\n"
828 + " @apply inline-flex items-center gap-2 px-4 py-2 bg-red-600 text-white text-sm\n"
829 + " font-medium rounded hover:bg-red-700 transition-colors duration-150 cursor-pointer;\n"
830 + " }\n"
831 + " .btn-ghost {\n"
832 + " @apply inline-flex items-center gap-2 px-3 py-1.5 text-gray-600 text-sm\n"
833 + " font-medium rounded hover:bg-gray-100 transition-colors duration-150 cursor-pointer;\n"
834 + " }\n"
835 + "\n"
836 + " /* ---- Forms ---- */\n"
837 + " .form-input {\n"
838 + " @apply w-full px-3 py-2 border border-gray-300 rounded text-sm text-gray-900\n"
839 + " placeholder-gray-400 focus:outline-none focus:ring-2 focus:ring-brand-500\n"
840 + " focus:border-transparent transition-all duration-150;\n"
841 + " }\n"
842 + " .form-label {\n"
843 + " @apply block text-sm font-medium text-gray-700 mb-1;\n"
844 + " }\n"
845 + "\n"
846 + " /* ---- Cards ---- */\n"
847 + " .card {\n"
848 + " @apply bg-white border border-gray-200 rounded-sm;\n"
849 + " }\n"
850 + "\n"
851 + " /* ---- Code ---- */\n"
852 + " .code-container {\n"
853 + " @apply bg-gray-50 border border-gray-200 rounded-sm font-mono text-xs overflow-x-auto;\n"
854 + " }\n"
855 + "\n"
856 + " /* ---- File tree rows ---- */\n"
857 + " .file-row {\n"
858 + " @apply flex items-center gap-3 px-4 py-2.5 border-b border-gray-100\n"
859 + " hover:bg-gray-50 transition-colors duration-100 text-sm;\n"
860 + " }\n"
861 + " .file-row:last-child { @apply border-b-0; }\n"
862 + "\n"
863 + " /* ---- Breadcrumb ---- */\n"
864 + " .breadcrumb-item {\n"
865 + " @apply text-brand-500 hover:underline text-sm;\n"
866 + " }\n"
867 + "\n"
868 + " /* ---- Commit rows ---- */\n"
869 + " .commit-row {\n"
870 + " @apply flex items-start justify-between px-4 py-3 border-b border-gray-100\n"
871 + " hover:bg-gray-50 transition-colors duration-100;\n"
872 + " }\n"
873 + " .commit-row:last-child { @apply border-b-0; }\n"
874 + "\n"
875 + " /* ---- Badges ---- */\n"
876 + " .badge {\n"
877 + " @apply inline-flex items-center px-2 py-0.5 rounded text-xs font-medium;\n"
878 + " }\n"
879 + " .badge-gray { @apply badge bg-gray-100 text-gray-600; }\n"
880 + " .badge-blue { @apply badge bg-brand-50 text-brand-600; }\n"
881 + "\n"
882 + " /* ---- Tabs ---- */\n"
883 + " .tab-item {\n"
884 + " @apply px-4 py-2.5 text-sm font-medium text-gray-500 border-b-2 border-transparent\n"
885 + " hover:text-gray-700 hover:border-gray-300 transition-all duration-150;\n"
886 + " }\n"
887 + " .tab-item.active {\n"
888 + " @apply text-gray-900 border-brand-500;\n"
889 + " }\n"
890 + "\n"
891 + " /* ---- README prose ---- */\n"
892 + " .prose-readme h1 { @apply text-2xl font-semibold mb-4 mt-6 pb-2 border-b border-gray-200; }\n"
893 + " .prose-readme h2 { @apply text-xl font-semibold mb-3 mt-5 pb-2 border-b border-gray-100; }\n"
894 + " .prose-readme h3 { @apply text-lg font-medium mb-2 mt-4; }\n"
895 + " .prose-readme p { @apply mb-4 leading-7; }\n"
896 + " .prose-readme ul { @apply list-disc pl-6 mb-4 space-y-1; }\n"
897 + " .prose-readme ol { @apply list-decimal pl-6 mb-4 space-y-1; }\n"
898 + " .prose-readme li { @apply leading-7; }\n"
899 + " .prose-readme a { @apply text-brand-500 hover:underline; }\n"
900 + " .prose-readme code { @apply bg-gray-100 px-1.5 py-0.5 rounded text-xs font-mono text-gray-800; }\n"
901 + " .prose-readme pre { @apply bg-gray-50 border border-gray-200 rounded-sm p-4 overflow-x-auto mb-4; }\n"
902 + " .prose-readme pre code { @apply bg-transparent p-0; }\n"
903 + " .prose-readme table { @apply w-full mb-4 border-collapse border border-gray-200; }\n"
904 + " .prose-readme th { @apply bg-gray-50 border border-gray-200 px-3 py-2 text-left font-medium text-sm; }\n"
905 + " .prose-readme td { @apply border border-gray-200 px-3 py-2 text-sm; }\n"
906 + " .prose-readme blockquote { @apply border-l-4 border-gray-300 pl-4 italic text-gray-600 my-4; }\n"
907 + " .prose-readme hr { @apply border-gray-200 my-6; }\n"
908 + " .prose-readme img { @apply max-w-full; }\n"
909 + "\n"
910 + " /* ---- Diff ---- */\n"
911 + " .diff-add { @apply bg-green-50 text-green-800; }\n"
912 + " .diff-remove { @apply bg-red-50 text-red-800; }\n"
913 + " .diff-header { @apply bg-blue-50 text-blue-700; }\n"
914 + "}\n"
915 + "\n"
916 + "/* ---- Rouge syntax highlighting ---- */\n"
917 + ".highlight .c { color: #998; font-style: italic }\n"
918 + ".highlight .err { color: #a61717; background-color: #e3d2d2 }\n"
919 + ".highlight .k { color: #000; font-weight: bold }\n"
920 + ".highlight .o { font-weight: bold }\n"
921 + ".highlight .cm { color: #998; font-style: italic }\n"
922 + ".highlight .cp { color: #999; font-weight: bold }\n"
923 + ".highlight .c1 { color: #998; font-style: italic }\n"
924 + ".highlight .cs { color: #999; font-weight: bold; font-style: italic }\n"
925 + ".highlight .gd { color: #000; background-color: #fdd }\n"
926 + ".highlight .ge { font-style: italic }\n"
927 + ".highlight .gr { color: #a00 }\n"
928 + ".highlight .gh { color: #999 }\n"
929 + ".highlight .gi { color: #000; background-color: #dfd }\n"
930 + ".highlight .go { color: #888 }\n"
931 + ".highlight .gp { color: #555 }\n"
932 + ".highlight .gs { font-weight: bold }\n"
933 + ".highlight .gu { color: #aaa }\n"
934 + ".highlight .gt { color: #a00 }\n"
935 + ".highlight .kc { color: #000; font-weight: bold }\n"
936 + ".highlight .kd { color: #000; font-weight: bold }\n"
937 + ".highlight .kp { color: #000; font-weight: bold }\n"
938 + ".highlight .kr { color: #000; font-weight: bold }\n"
939 + ".highlight .kt { color: #458; font-weight: bold }\n"
940 + ".highlight .m { color: #099 }\n"
941 + ".highlight .s { color: #d14 }\n"
942 + ".highlight .na { color: #008080 }\n"
943 + ".highlight .nb { color: #0086B3 }\n"
944 + ".highlight .nc { color: #458; font-weight: bold }\n"
945 + ".highlight .no { color: #008080 }\n"
946 + ".highlight .ni { color: #800080 }\n"
947 + ".highlight .ne { color: #900; font-weight: bold }\n"
948 + ".highlight .nf { color: #900; font-weight: bold }\n"
949 + ".highlight .nn { color: #555 }\n"
950 + ".highlight .nt { color: #000080 }\n"
951 + ".highlight .nv { color: #008080 }\n"
952 + ".highlight .ow { font-weight: bold }\n"
953 + ".highlight .w { color: #bbb }\n"
954 + ".highlight .mf { color: #099 }\n"
955 + ".highlight .mh { color: #099 }\n"
956 + ".highlight .mi { color: #099 }\n"
957 + ".highlight .mo { color: #099 }\n"
958 + ".highlight .sb { color: #d14 }\n"
959 + ".highlight .sc { color: #d14 }\n"
960 + ".highlight .sd { color: #d14 }\n"
961 + ".highlight .s2 { color: #d14 }\n"
962 + ".highlight .se { color: #d14 }\n"
963 + ".highlight .sh { color: #d14 }\n"
964 + ".highlight .si { color: #d14 }\n"
965 + ".highlight .sx { color: #d14 }\n"
966 + ".highlight .sr { color: #009926 }\n"
967 + ".highlight .s1 { color: #d14 }\n"
968 + ".highlight .ss { color: #990073 }\n"
969 + ".highlight .bp { color: #999 }\n"
970 + ".highlight .vc { color: #008080 }\n"
971 + ".highlight .vg { color: #008080 }\n"
972 + ".highlight .vi { color: #008080 }\n"
973 + ".highlight .il { color: #099 }\n"
974 +)
975 +
976 +# ---------------------------------------------------------------------------
977 +# config/importmap.rb
978 +# ---------------------------------------------------------------------------
979 +files["config/importmap.rb"] = (
980 + "# Pin npm packages by running ./bin/importmap\n"
981 + "\n"
982 + 'pin "application", preload: true\n'
983 + "\n"
984 + 'pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true\n'
985 + 'pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true\n'
986 + 'pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true\n'
987 + "\n"
988 + 'pin_all_from "app/javascript/controllers", under: "controllers"\n'
989 +)
990 +
991 +# ---------------------------------------------------------------------------
992 +# Write all files
993 +# ---------------------------------------------------------------------------
994 +for path, content in files.items():
995 + os.makedirs(os.path.dirname(path), exist_ok=True)
996 + with open(path, "w", encoding="utf-8") as fh:
997 + fh.write(content)
998 + lines = content.count("\n")
999 + print(f" wrote {path} ({lines} lines)")
1000 +
1001 +print("\nDone.")
storage/.keep
tmp/.keep
vendor/.keep