Compare commits

..

12 Commits

6 changed files with 45 additions and 43 deletions

View File

@@ -1,12 +1,7 @@
# Admin Credentials
ADMIN_EMAIL=admin@kal.planetrenox.com ADMIN_EMAIL=admin@kal.planetrenox.com
ADMIN_PASS=super_secure_password_meow ADMIN_PASS=super_secure_password_meow
# Ntfy Alerts
NTFY_URL=https://ntfy.sh/my_secret_kalbot_topic NTFY_URL=https://ntfy.sh/my_secret_kalbot_topic
# Captcha Security (Random string)
CAPTCHA_SECRET=change_me_to_a_random_string_in_dokploy CAPTCHA_SECRET=change_me_to_a_random_string_in_dokploy
# Application Port
PORT=3004 PORT=3004
KALSHI_API_KEY_ID=your-key-id-here
KALSHI_RSA_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\nPASTE_YOUR_FULL_KEY_HERE\n-----END RSA PRIVATE KEY-----"

View File

@@ -43,3 +43,7 @@ jobs:
push: true push: true
tags: ${{ steps.meta.outputs.tags }} tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }} labels: ${{ steps.meta.outputs.labels }}
- name: Trigger Dokploy Deployment
run: curl -s "${{ secrets.DOKPLOY_WEBHOOK_URL }}"

View File

@@ -1,26 +1,25 @@
FROM node:18-alpine AS base # Stage 1: Fast dependencies using Bun
FROM oven/bun:alpine AS deps
# Install dependencies only when needed
FROM base AS deps
RUN apk add --no-cache libc6-compat
WORKDIR /app WORKDIR /app
COPY package.json package-lock.json* ./ COPY package.json package-lock.json* ./
RUN npm install RUN bun install
# Rebuild the source code only when needed # Stage 2: Fast builds using Bun
FROM base AS builder FROM oven/bun:alpine AS builder
WORKDIR /app WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules COPY --from=deps /app/node_modules ./node_modules
COPY . . COPY . .
RUN npm run build RUN bun run build
# Production image, copy all the files and run next # Stage 3: Stable production runtime using Node.js
FROM base AS runner FROM node:22-alpine AS runner
WORKDIR /app WORKDIR /app
ENV NODE_ENV=production ENV NODE_ENV=production
ENV PORT=3004 ENV PORT=3004
# Next.js standalone requires libc6-compat on alpine
RUN apk add --no-cache libc6-compat
RUN addgroup --system --gid 1001 nodejs RUN addgroup --system --gid 1001 nodejs
RUN adduser --system --uid 1001 nextjs RUN adduser --system --uid 1001 nextjs
@@ -32,4 +31,5 @@ USER nextjs
EXPOSE 3004 EXPOSE 3004
# Run the Next.js server stably with Node
CMD ["node", "server.js"] CMD ["node", "server.js"]

View File

@@ -1,12 +1,14 @@
'use client'; 'use client';
import { useState, useRef } from 'react'; import { useState, useRef } from 'react';
// TODO: We should use this Kalshi green accent (#28CC95) all over the code.
export default function LoginPage() { export default function LoginPage() {
const [email, setEmail] = useState(''); const[email, setEmail] = useState('');
const [password, setPassword] = useState(''); const [password, setPassword] = useState('');
const [captcha, setCaptcha] = useState(''); const[captcha, setCaptcha] = useState('');
const [error, setError] = useState(''); const [error, setError] = useState('');
const [success, setSuccess] = useState(''); const[success, setSuccess] = useState('');
const captchaImgRef = useRef(null); const captchaImgRef = useRef(null);
const refreshCaptcha = () => { const refreshCaptcha = () => {
@@ -37,47 +39,47 @@ export default function LoginPage() {
}; };
return ( return (
<div className="min-h-screen flex items-center justify-center bg-gray-900 text-white font-sans"> <div className="min-h-screen flex items-center justify-center bg-gray-50 text-gray-900 font-sans">
<div className="bg-gray-800 p-8 rounded-lg shadow-xl w-full max-w-md"> <div className="bg-white p-8 rounded-lg shadow-xl w-full max-w-md border border-gray-100">
<h1 className="text-2xl font-bold mb-6 text-center text-indigo-400">Kalbot Access</h1> <h1 className="text-2xl font-bold mb-6 text-center text-[#28CC95]">Kalbot Access</h1>
{error && <div className="bg-red-500/20 border border-red-500 text-red-300 p-3 rounded mb-4 text-sm">{error}</div>} {error && <div className="bg-red-50 border border-red-200 text-red-600 p-3 rounded mb-4 text-sm">{error}</div>}
{success && <div className="bg-green-500/20 border border-green-500 text-green-300 p-3 rounded mb-4 text-sm">{success}</div>} {success && <div className="bg-green-50 border border-green-200 text-green-600 p-3 rounded mb-4 text-sm">{success}</div>}
<form onSubmit={handleLogin} className="space-y-4"> <form onSubmit={handleLogin} className="space-y-4">
<div> <div>
<label className="block text-sm text-gray-400 mb-1">Email</label> <label className="block text-sm font-medium text-gray-700 mb-1">Email</label>
<input <input
type="email" type="email"
required required
className="w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 focus:outline-none focus:border-indigo-500" className="w-full bg-white border border-gray-300 rounded px-3 py-2 focus:outline-none focus:border-[#28CC95] focus:ring-1 focus:ring-[#28CC95] transition-shadow"
value={email} value={email}
onChange={(e) => setEmail(e.target.value)} onChange={(e) => setEmail(e.target.value)}
/> />
</div> </div>
<div> <div>
<label className="block text-sm text-gray-400 mb-1">Password</label> <label className="block text-sm font-medium text-gray-700 mb-1">Password</label>
<input <input
type="password" type="password"
required required
className="w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 focus:outline-none focus:border-indigo-500" className="w-full bg-white border border-gray-300 rounded px-3 py-2 focus:outline-none focus:border-[#28CC95] focus:ring-1 focus:ring-[#28CC95] transition-shadow"
value={password} value={password}
onChange={(e) => setPassword(e.target.value)} onChange={(e) => setPassword(e.target.value)}
/> />
</div> </div>
<div> <div>
<label className="block text-sm text-gray-400 mb-1">Captcha Verification</label> <label className="block text-sm font-medium text-gray-700 mb-1">Captcha Verification</label>
<div className="flex items-center space-x-3 mb-2"> <div className="flex items-center space-x-3 mb-2">
<img <img
ref={captchaImgRef} ref={captchaImgRef}
src="/api/captcha" src="/api/captcha"
alt="captcha" alt="captcha"
className="h-12 rounded cursor-pointer border border-gray-600" className="h-12 rounded cursor-pointer border border-gray-300"
onClick={refreshCaptcha} onClick={refreshCaptcha}
title="Click to refresh" title="Click to refresh"
/> />
<button type="button" onClick={refreshCaptcha} className="text-sm text-indigo-400 hover:text-indigo-300"> <button type="button" onClick={refreshCaptcha} className="text-sm font-medium text-[#28CC95] hover:opacity-80 transition-opacity">
Refresh Refresh
</button> </button>
</div> </div>
@@ -85,7 +87,7 @@ export default function LoginPage() {
type="text" type="text"
required required
placeholder="Enter the text above" placeholder="Enter the text above"
className="w-full bg-gray-700 border border-gray-600 rounded px-3 py-2 focus:outline-none focus:border-indigo-500" className="w-full bg-white border border-gray-300 rounded px-3 py-2 focus:outline-none focus:border-[#28CC95] focus:ring-1 focus:ring-[#28CC95] transition-shadow"
value={captcha} value={captcha}
onChange={(e) => setCaptcha(e.target.value)} onChange={(e) => setCaptcha(e.target.value)}
/> />
@@ -93,7 +95,7 @@ export default function LoginPage() {
<button <button
type="submit" type="submit"
className="w-full bg-indigo-600 hover:bg-indigo-700 text-white font-bold py-2 px-4 rounded transition-colors mt-6" className="w-full bg-[#28CC95] hover:brightness-95 text-white font-bold py-2 px-4 rounded transition-all mt-6 shadow-sm"
> >
Login Login
</button> </button>

View File

@@ -9,16 +9,16 @@
"lint": "next lint" "lint": "next lint"
}, },
"dependencies": { "dependencies": {
"next": "14.2.3", "next": "^15.0.0",
"react": "^18", "react": "^19.0.0",
"react-dom": "^18", "react-dom": "^19.0.0",
"trek-captcha": "^0.4.0" "trek-captcha": "^0.4.0"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "^10.4.19", "autoprefixer": "^10.4.20",
"postcss": "^8", "postcss": "^8.4.40",
"tailwindcss": "^3.4.1", "tailwindcss": "^3.4.14",
"eslint": "^8", "eslint": "^8.57.0",
"eslint-config-next": "14.2.3" "eslint-config-next": "^15.0.0"
} }
} }

1
readme
View File

@@ -3,3 +3,4 @@ JavaScript
Next.js Next.js
Dokploy Dokploy
ntfy ntfy
kxbtc15m/bitcoin-price-up-down