diff --git a/README.md b/README.md index ab65d37..f1fb5e1 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,13 @@ git clone https://github.com/hackclub/stickers cp .env.example .env npm install npm run dev + +# In a separate terminal, for the backend: cd backend +cp .env.example .env +# Edit .env and set SESSION_SECRET to a 64+ char string (run: openssl rand -hex 64) +bundle config set --local path 'vendor/bundle' +bundle install bundle exec rackup config.ru -p 9292 diff --git a/backend/.env.example b/backend/.env.example index d0b72fe..e727694 100644 --- a/backend/.env.example +++ b/backend/.env.example @@ -1,10 +1,17 @@ -AIRTABLE_PAT=dummy -AIRTABLE_BASE_ID=dummy -SESSION_SECRET=dummy -OIDC_ISSUER=dummy -OIDC_CLIENT_ID=dummy -OIDC_CLIENT_SECRET=dummy -OIDC_REDIRECT_URI=dummy -HACKATIME_CLIENT_ID=dummy -HACKATIME_CLIENT_SECRET=dummy -HACKATIME_REDIRECT_URI=dummy \ No newline at end of file +# Airtable +AIRTABLE_PAT=your_airtable_personal_access_token +AIRTABLE_BASE_ID=your_airtable_base_id + +# Session (generate with: openssl rand -hex 64) +SESSION_SECRET=dummy_session_secret + +# OIDC Auth +OIDC_ISSUER=https://auth.hackclub.com +OIDC_CLIENT_ID=your_oidc_client_id +OIDC_CLIENT_SECRET=your_oidc_client_secret +OIDC_REDIRECT_URI=http://localhost:9292/auth/oidc/callback + +# URLs +FRONTEND_URL=http://localhost:5173 +AUTH_SUCCESS_REDIRECT=http://localhost:5173/stickers +AUTH_LOGOUT_REDIRECT=http://localhost:5173 diff --git a/backend/api/shop.rb b/backend/api/shop.rb index dec7542..e23597e 100644 --- a/backend/api/shop.rb +++ b/backend/api/shop.rb @@ -11,9 +11,10 @@ class Shop < Grape::API route_param :id, type: String do get do - record = shopRecord.find(params[:id]) + record = ShopRecord.find(params[:id]) error!('not found', 404) unless record record.as_json + end end end end diff --git a/backend/models/application_record.rb b/backend/models/application_record.rb index c8efe69..5b1f454 100644 --- a/backend/models/application_record.rb +++ b/backend/models/application_record.rb @@ -1,3 +1,3 @@ class ApplicationRecord < AirctiveRecord::Base - self.base_key = ENV['AIRTABLE_BASE'] + self.base_key = ENV['AIRTABLE_BASE_ID'] end diff --git a/backend/models/sticker_record.rb b/backend/models/sticker_record.rb index 547d5c6..80fe415 100644 --- a/backend/models/sticker_record.rb +++ b/backend/models/sticker_record.rb @@ -1,4 +1,4 @@ -frozen_string_literal: true +# frozen_string_literal: true class StickerRecord < AirctiveRecord::Base self.base_key = ENV['AIRTABLE_BASE_ID'] diff --git a/package-lock.json b/package-lock.json index 25c90b2..dc90714 100644 --- a/package-lock.json +++ b/package-lock.json @@ -995,6 +995,7 @@ "integrity": "sha512-vByReCTTdlNM80vva8alAQC80HcOiHLkd8XAxIiKghKSHcqeNfyhp3VsYAV8VSiPKu4Jc8wWCfsZNAIvd1uCqA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@standard-schema/spec": "^1.0.0", "@sveltejs/acorn-typescript": "^1.0.5", @@ -1034,6 +1035,7 @@ "integrity": "sha512-YZs/OSKOQAQCnJvM/P+F1URotNnYNeU3P2s4oIpzm1uFaqUEqRxUB0g5ejMjEb5Gjb9/PiBI5Ktrq4rUUF8UVQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@sveltejs/vite-plugin-svelte-inspector": "^5.0.0", "debug": "^4.4.1", @@ -1094,6 +1096,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -1581,6 +1584,7 @@ "integrity": "sha512-w8GmOxZfBmKknvdXU1sdM9NHcoQejwF/4mNgj2JuEEdRaHwwF12K7e9eXn1nLZ07ad+du76mkVsyeb2rKGllsA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/estree": "1.0.8" }, @@ -1681,6 +1685,7 @@ "integrity": "sha512-2074U+vObO5Zs8/qhxtBwdi6ZXNIhEBTzNmUFjiZexLxTdt9vq96D/0pnQELl6YcpLMD7pZ2dhXKByfGS8SAdg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jridgewell/remapping": "^2.3.4", "@jridgewell/sourcemap-codec": "^1.5.0", @@ -1788,6 +1793,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -1802,6 +1808,7 @@ "integrity": "sha512-tI2l/nFHC5rLh7+5+o7QjKjSR04ivXDF4jcgV0f/bTQ+OJiITy5S6gaynVsEM+7RqzufMnVbIon6Sr5x1SDYaQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 5243976..bf75503 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -44,11 +44,42 @@ {/snippet} + window.location.href = '/archive'} + borderRadius="0.5rem" + > + {#snippet topContent()} +
+ View Stickers + no sign in needed +
+ {/snippet} + {#snippet backContent()} +
+ {/snippet} + {#snippet bottomContent()} +
+ Loading... +
+ {/snippet} +
+ - +
+ 🚧 Site still Under Construction! +
+
+ +