-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
356 lines (336 loc) · 19.1 KB
/
index.html
File metadata and controls
356 lines (336 loc) · 19.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>Smoke Free — Quit Smoking Tracker with Friends</title>
<link rel="icon" type="image/svg+xml" href="favicon.svg">
<link rel="manifest" href="manifest.json">
<meta name="theme-color" content="#080808">
<meta name="description" content="Track your resistance to cigarettes in real time. Compete with friends on a live leaderboard. Free quit smoking app — no ads, no paywalls.">
<meta name="keywords" content="quit smoking app, smoke free timer, cigarette tracker, smoking cessation, stop smoking, resist smoking, quit smoking with friends, smoking streak, nicotine free">
<link rel="canonical" href="https://www.smokefreetimer.com/">
<meta property="og:type" content="website">
<meta property="og:url" content="https://www.smokefreetimer.com/">
<meta property="og:title" content="Smoke Free — Quit Smoking Tracker with Friends">
<meta property="og:description" content="Track your resistance to cigarettes in real time. Compete with friends on a live leaderboard. Free quit smoking app — no ads, no paywalls.">
<meta property="og:image" content="https://www.smokefreetimer.com/feature-graphic.png">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Smoke Free — Quit Smoking Tracker with Friends">
<meta name="twitter:description" content="Track your resistance to cigarettes in real time. Compete with friends on a live leaderboard. Free — no ads, no paywalls.">
<meta name="twitter:image" content="https://www.smokefreetimer.com/feature-graphic.png">
<script type="application/ld+json">
{
"@context": "https://schema.org",
"@type": "WebApplication",
"name": "Smoke Free",
"url": "https://www.smokefreetimer.com/",
"description": "Track your resistance to cigarettes in real time. Compete with friends on a live leaderboard.",
"applicationCategory": "HealthApplication",
"operatingSystem": "Web, Android",
"offers": { "@type": "Offer", "price": "0", "priceCurrency": "USD" },
"screenshot": "https://www.smokefreetimer.com/screenshot-mobile.jpeg"
}
</script>
<link href="https://fonts.googleapis.com/css2?family=Bebas+Neue&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2.38.4"></script>
<style>
:root {
--bg:#080808; --surface:#101010; --border:#1c1c1c; --border2:#282828;
--accent:#c8f560; --accent-dim:#7a9938; --text:#f0f0f0;
--muted2:#999; --danger:#ff4455; --success:#60f5a0;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
background:var(--bg); color:var(--text); font-family:'DM Mono',monospace;
min-height:100vh; display:flex; flex-direction:column; align-items:center; justify-content:center; padding:24px;
}
body::after {
content:''; position:fixed; top:0; right:0; bottom:0; left:0; pointer-events:none; z-index:9998;
background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}
.box { width:100%; max-width:420px; }
.logo {
font-family:'Bebas Neue',sans-serif; font-size:64px; letter-spacing:10px;
color:var(--accent); text-align:center; line-height:1; margin-bottom:4px;
animation:fadeDown 0.5s ease both;
}
.tagline {
text-align:center; font-size:10px; letter-spacing:4px; text-transform:uppercase;
color:var(--muted2); margin-bottom:40px; animation:fadeDown 0.5s ease 0.1s both;
}
.card {
background:var(--surface); border:1px solid var(--border); border-radius:4px;
padding:32px; position:relative; animation:fadeUp 0.5s ease 0.15s both;
}
.card::before {
content:''; position:absolute; top:0; left:0; right:0; height:2px;
background:linear-gradient(90deg,transparent,var(--accent),transparent);
}
.card-title { font-family:'Bebas Neue',sans-serif; font-size:26px; letter-spacing:4px; color:var(--accent); margin-bottom:24px; }
.field { display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.field label { font-size:10px; letter-spacing:2px; text-transform:uppercase; color:var(--muted2); }
.field input {
background:#0a0a0a; border:1px solid var(--border2); border-radius:2px;
padding:12px 14px; color:var(--text); font-family:'DM Mono',monospace;
font-size:16px; outline:none; transition:border-color 0.2s; width:100%;
-webkit-appearance:none; appearance:none;
}
.field input:focus { border-color:var(--accent-dim); }
.field input::placeholder { color:var(--muted2); opacity:0.5; }
.btn {
width:100%; padding:14px; background:var(--accent); color:#080808; border:none;
font-family:'Bebas Neue',sans-serif; font-size:20px; letter-spacing:3px;
cursor:pointer; border-radius:2px; transition:opacity 0.2s, transform 0.1s; margin-top:8px;
}
.btn:hover { opacity:0.88; } .btn:active { transform:scale(0.99); } .btn:disabled { opacity:0.4; cursor:not-allowed; }
.msg { font-size:11px; margin-top:12px; min-height:18px; letter-spacing:0.5px; line-height:1.6; }
.msg.error { color:var(--danger); } .msg.success { color:var(--success); }
.links { display:flex; justify-content:center; gap:16px; margin-top:16px; font-size:11px; color:var(--muted2); flex-wrap:wrap; }
.links a { color:var(--accent-dim); cursor:pointer; text-decoration:underline; transition:color 0.2s; }
.links a:hover { color:var(--accent); }
.hint { font-size:11px; color:var(--muted2); line-height:1.9; margin-bottom:20px; }
@keyframes fadeUp { from{opacity:0;transform:translateY(14px)} to{opacity:1;transform:translateY(0)} }
@keyframes fadeDown { from{opacity:0;transform:translateY(-14px)} to{opacity:1;transform:translateY(0)} }
.site-footer {
margin-top:32px; width:100%; text-align:center; font-size:10px; letter-spacing:2px;
color:var(--muted2); display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap;
}
.site-footer a { color:var(--muted2); text-decoration:none; transition:color 0.2s; }
.site-footer a:hover { color:var(--accent); }
.play-banner {
display:flex; align-items:center; gap:10px; background:#0d1a00;
border:1px solid var(--accent-dim); border-radius:3px;
padding:10px 18px; font-size:11px; letter-spacing:2px; text-transform:uppercase;
color:var(--accent); width:100%; max-width:360px; margin:0 auto 24px; justify-content:center;
animation:fadeUp 0.5s ease 0.2s both;
}
.play-banner svg { flex-shrink:0; color:unset; }
.play-banner a { color:var(--accent); text-decoration:none; font-weight:500; }
.play-banner a:hover { text-decoration:underline; }
.tester-cta { display:none; text-align:center; margin-top:-16px; margin-bottom:16px; }
.tester-cta a { font-size:10px; letter-spacing:2px; text-transform:uppercase; color:var(--muted2); text-decoration:none; border-bottom:1px solid var(--border2); padding-bottom:1px; transition:color 0.2s; }
.tester-cta a:hover { color:var(--accent); }
</style>
</head>
<body>
<div class="box">
<div class="logo">SMOKE FREE</div>
<div class="tagline">Track your resistance</div>
<!-- Sign In -->
<div class="card" id="cardLogin">
<div class="card-title">Sign In</div>
<div class="field"><label>Email</label><input type="email" id="loginEmail" placeholder="you@email.com" onkeydown="if(event.key==='Enter')doLogin()" /></div>
<div class="field"><label>Password</label><input type="password" id="loginPassword" placeholder="••••••••" onkeydown="if(event.key==='Enter')doLogin()" /></div>
<button class="btn" id="loginBtn" onclick="doLogin()">Sign In</button>
<div class="msg" id="loginMsg"></div>
<div class="links">
<a onclick="show('cardSignup')">Create account</a>
<span>·</span>
<a onclick="show('cardForgot')">Forgot password?</a>
</div>
</div>
<!-- Sign Up -->
<div class="card" id="cardSignup" style="display:none">
<div class="card-title">Create Account</div>
<div class="field"><label>Username</label><input type="text" id="signupUsername" placeholder="your_username" /></div>
<div class="field"><label>Email</label><input type="email" id="signupEmail" placeholder="you@email.com" /></div>
<div class="field"><label>Password</label><input type="password" id="signupPassword" placeholder="min 6 characters" onkeydown="if(event.key==='Enter')doSignup()" /></div>
<button class="btn" id="signupBtn" onclick="doSignup()">Create Account</button>
<div class="msg" id="signupMsg"></div>
<div class="links"><a onclick="show('cardLogin')">← Back to sign in</a></div>
</div>
<!-- Forgot Password -->
<div class="card" id="cardForgot" style="display:none">
<div class="card-title">Reset Password</div>
<div class="hint">Enter your email and we'll send you a reset link.</div>
<div class="field"><label>Email</label><input type="email" id="forgotEmail" placeholder="you@email.com" onkeydown="if(event.key==='Enter')doForgot()" /></div>
<button class="btn" id="forgotBtn" onclick="doForgot()">Send Reset Link</button>
<div class="msg" id="forgotMsg"></div>
<div class="links"><a onclick="show('cardLogin')">← Back to sign in</a></div>
</div>
<!-- Update Password -->
<div class="card" id="cardUpdatePw" style="display:none">
<div class="card-title">New Password</div>
<div class="hint">Enter and confirm your new password.</div>
<div class="field"><label>New Password</label><input type="password" id="newPw" placeholder="min 6 characters" /></div>
<div class="field"><label>Confirm Password</label><input type="password" id="confirmPw" placeholder="repeat password" onkeydown="if(event.key==='Enter')doUpdatePassword()" /></div>
<button class="btn" id="updatePwBtn" onclick="doUpdatePassword()">Update Password</button>
<div class="msg" id="updatePwMsg"></div>
</div>
</div>
<div class="play-banner" id="playBanner">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24"><path fill="#4285F4" d="M.5 1.05C.19 1.4 0 1.94 0 2.64v18.72c0 .7.19 1.24.5 1.59l.08.08 10.49-10.49v-.25L.58.97z"/><path fill="#34A853" d="M3.18.24l10.75 9.77-2.9 2.9L.23.41A2 2 0 0 1 3.18.24z"/><path fill="#FBBC04" d="M16.52 14.53l-3.49-3.49V10.8l3.49-3.49 3.95 2.28c1.13.64 1.13 1.69 0 2.34z"/><path fill="#EA4335" d="M3.18 23.76a2 2 0 0 0 2.05-.17l11.6-6.7-2.9-2.9z"/></svg>
<span id="playBannerText">Coming soon to Google Play</span>
</div>
<div class="tester-cta" id="testerCta">
<a href="mailto:support@smokefreetimer.com?subject=Tester%20Request&body=Hi%2C%20I%27d%20like%20to%20become%20a%20tester%20for%20Smoke%20Free%20on%20Android." target="_blank">Become a tester →</a>
</div>
<footer class="site-footer">
<span>© 2026 Smoke Free</span>
<span>·</span>
<a href="about.html">About</a>
<span>·</span>
<span>MIT License</span>
</footer>
<script>
const SB_URL = 'https://vtlivesjwzinffceeriv.supabase.co';
const SB_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZ0bGl2ZXNqd3ppbmZmY2Vlcml2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzI4NDE3NTYsImV4cCI6MjA4ODQxNzc1Nn0.5tYWbarj_zeS2TCTbxFinBhDCHHq3hcUfM1azKOGdpA';
const { createClient } = supabase;
const sb = createClient(SB_URL, SB_KEY, {
auth: { persistSession:true, detectSessionInUrl:true, autoRefreshToken:true, lock:async(_,__,fn)=>fn() }
});
function show(id) {
['cardLogin','cardSignup','cardForgot','cardUpdatePw'].forEach(c =>
document.getElementById(c).style.display = c===id ? 'block' : 'none'
);
['loginMsg','signupMsg','forgotMsg','updatePwMsg'].forEach(m => {
const el=document.getElementById(m); if(el){el.textContent='';el.className='msg';}
});
}
function setMsg(id, text, type) {
const el=document.getElementById(id);
if(el){el.textContent=text;el.className=`msg ${type||''}`;}
}
// Detect recovery token in URL before any auth events fire
let inPasswordRecovery = window.location.hash.includes('type=recovery');
if (inPasswordRecovery) show('cardUpdatePw');
// Prevent the auth listener from redirecting while doSignup() is still
// inserting the profile row. Without this flag, signUp() (with confirm email OFF)
// immediately fires SIGNED_IN, which navigates away and aborts the INSERT.
let _creatingProfile = false;
sb.auth.onAuthStateChange((event, session) => {
if (event==='PASSWORD_RECOVERY') { inPasswordRecovery=true; show('cardUpdatePw'); return; }
if (inPasswordRecovery) return;
if (_creatingProfile) return;
if ((event==='SIGNED_IN'||event==='INITIAL_SESSION') && session?.user) {
window.location.href='app.html';
}
});
async function doLogin() {
const email=document.getElementById('loginEmail').value.trim();
const pass=document.getElementById('loginPassword').value;
const btn=document.getElementById('loginBtn');
if(!email||!pass){setMsg('loginMsg','Please fill in all fields.','error');return;}
btn.disabled=true; btn.textContent='Signing in...'; setMsg('loginMsg','');
try {
const timeout=new Promise((_,r)=>setTimeout(()=>r(new Error('Request timed out. Please try again.')),10000));
const {data,error}=await Promise.race([sb.auth.signInWithPassword({email,password:pass}),timeout]);
if(error) setMsg('loginMsg',error.message,'error');
else if(!data?.user) setMsg('loginMsg','Sign in failed. Please try again.','error');
} catch(e){ setMsg('loginMsg',e.message,'error'); }
btn.disabled=false; btn.textContent='Sign In';
}
async function doSignup() {
const username=document.getElementById('signupUsername').value.trim().toLowerCase();
const email=document.getElementById('signupEmail').value.trim();
const pass=document.getElementById('signupPassword').value;
const btn=document.getElementById('signupBtn');
if(!username||!email||!pass){setMsg('signupMsg','Please fill in all fields.','error');return;}
if(!/^[a-z0-9_]+$/.test(username)){setMsg('signupMsg','Username: letters, numbers, underscores only.','error');return;}
if(pass.length<6){setMsg('signupMsg','Password must be at least 6 characters.','error');return;}
btn.disabled=true; btn.textContent='Creating account...'; setMsg('signupMsg','');
const {data:existing}=await sb.from('profiles').select('id').eq('username',username).maybeSingle();
if(existing){setMsg('signupMsg','Username already taken.','error');btn.disabled=false;btn.textContent='Create Account';return;}
// Block the auth listener from redirecting until the profile row is inserted.
_creatingProfile = true;
const {data,error}=await sb.auth.signUp({email,password:pass,options:{emailRedirectTo:'https://www.smokefreetimer.com/'}});
if(error){
_creatingProfile = false;
setMsg('signupMsg',error.message.toLowerCase().includes('already')?'An account with this email already exists. Please sign in.':error.message,'error');
btn.disabled=false;btn.textContent='Create Account';return;
}
if(data.user){
const {error:pErr}=await sb.from('profiles').insert({id:data.user.id,username});
if(pErr&&pErr.code!=='23505'){
_creatingProfile = false;
setMsg('signupMsg','Account created but profile failed. Please sign in.','error');btn.disabled=false;btn.textContent='Create Account';return;
}
}
_creatingProfile = false;
// If confirm email is OFF, Supabase immediately signs the user in (data.session exists).
// Redirect straight to the app — no need to ask them to check email.
if(data.session) {
window.location.href='app.html';
return;
}
setMsg('signupMsg','✓ Account created! Check your email to confirm, then sign in.','success');
btn.textContent='Done!';
setTimeout(()=>{show('cardLogin');document.getElementById('loginEmail').value=email;btn.disabled=false;btn.textContent='Create Account';},3000);
}
async function doForgot() {
const email=document.getElementById('forgotEmail').value.trim();
const btn=document.getElementById('forgotBtn');
if(!email){setMsg('forgotMsg','Please enter your email.','error');return;}
btn.disabled=true; btn.textContent='Sending...';
const {error}=await sb.auth.resetPasswordForEmail(email,{
redirectTo:'https://www.smokefreetimer.com/'
});
if(error) setMsg('forgotMsg',error.message,'error');
else{setMsg('forgotMsg','✓ Reset link sent! Check your email.','success');setTimeout(()=>show('cardLogin'),4000);}
btn.disabled=false; btn.textContent='Send Reset Link';
}
async function doUpdatePassword() {
const newPw=document.getElementById('newPw').value;
const confPw=document.getElementById('confirmPw').value;
const btn=document.getElementById('updatePwBtn');
if(newPw.length<6){setMsg('updatePwMsg','Password must be at least 6 characters.','error');return;}
if(newPw!==confPw){setMsg('updatePwMsg','Passwords do not match.','error');return;}
btn.disabled=true; btn.textContent='Updating...';
const {error}=await sb.auth.updateUser({password:newPw});
if(error){setMsg('updatePwMsg',error.message,'error');btn.disabled=false;btn.textContent='Update Password';}
else{
setMsg('updatePwMsg','✓ Password updated! Please sign in.','success');
await sb.auth.signOut();
setTimeout(()=>show('cardLogin'),2000);
}
}
</script>
<script>
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').catch(() => {});
}
document.fonts.ready.then(() => {
const c = document.createElement('canvas');
c.width = c.height = 64;
const ctx = c.getContext('2d');
ctx.fillStyle = '#111';
ctx.beginPath(); ctx.arc(32,32,32,0,Math.PI*2); ctx.fill();
ctx.fillStyle = '#c8f560';
ctx.font = '900 52px "Font Awesome 6 Free"';
ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
ctx.fillText('\uf54d', 32, 34);
const link = document.querySelector("link[rel~='icon']");
if (link) link.href = c.toDataURL();
});
const TESTERS = new Set([
'svenkate2@stevens.edu','shrikantachandni@gmail.com','karthikashok123@gmail.com',
'vishakha14kashyap@gmail.com','prashanthrocks05@gmail.com','neerajprabhu15@gmail.com',
'samarthvmurthy@gmail.com','harsha1803hn@gmail.com','samarthvenkateshmurthy@gmail.com',
'bhargavsanskar07@gmail.com','niharika.sarma00@gmail.com','shrikanthhiremath46@gmail.com', 'kuppasadkavya@gmail.com'
]);
function updatePlayBanner(email) {
const el = document.getElementById('playBannerText');
const cta = document.getElementById('testerCta');
const isInstalled = window.matchMedia('(display-mode: standalone)').matches;
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
const isAndroid = /Android/.test(navigator.userAgent);
const isTWA = isInstalled && isAndroid;
const isTester = el && email && TESTERS.has(email.toLowerCase());
if (isTester) {
if (isTWA) {
el.textContent = 'You are a tester for this app. Thanks for helping!';
} else if (!isIOS) {
el.innerHTML = 'You have early access! <a href="https://play.google.com/apps/testing/com.smokefreetimer.app" target="_blank" rel="noopener">Download on Google Play →</a>';
}
} else if (cta && isAndroid && !isTWA) {
cta.style.display = 'block';
}
}
sb.auth.getSession().then(({ data: { session } }) => {
updatePlayBanner(session?.user?.email || null);
});
</script>
</body>
</html>