Skip to content

Commit e8d8279

Browse files
committed
improved constants
1 parent 87dd103 commit e8d8279

File tree

6 files changed

+16
-10
lines changed

6 files changed

+16
-10
lines changed

README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,27 @@ Operates completely in browser, except for [GitHub token exchange](https://githu
2222
To run your own instance of Habbitses you'll need several things:
2323

2424
- GitHub code exchange server, you can use or fork [mine](https://github.com/roboslone/github-oauth-exchange) or write your own supporting the same [protocol](https://buf.build/roboslone-oauth/github)
25-
- your server address patched into [`ExchangeClient`](https://github.com/roboslone/habbitses/blob/main/src/lib/queries.ts#L20)
26-
- GitHub pages enabled for your repo, pushed to `main` branch are published with [GitHub workflow](https://github.com/roboslone/habbitses/blob/main/.github/workflows/deploy.yml)
25+
- your server address and GitHub application client ID patched into `src/lib/const.ts`
26+
- GitHub pages enabled for your repo, pushes to `main` branch are published with [GitHub workflow](https://github.com/roboslone/habbitses/blob/main/.github/workflows/deploy.yml)
2727

2828
If you're using my exchange server, don't forget to put it behind TLS termination proxy (e.g. `nginx`) and set up CORS to allow your domain(s).
2929

3030
## GitHub rate limits
31+
3132
All requests within Habbitses will count towards your [API rate limits](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api).
3233
At the time of writing limit is 15 000 requests per hour, so this should not be a problem.
3334

3435
## Security and privacy
35-
Code exchange server **will have access** to your access and refresh tokens.
36-
So you should only install Habbitses to a single repository containing your habit data.
36+
37+
Code exchange server **will have access** to your access and refresh tokens.
38+
39+
So you should only install Habbitses to a single repository containing your habit data.
3740

3841
App doesn't have any trackers (other than for your habits, duh) or ads and doesn't collect any data.
39-
However, it's technically possible for exchange server administrator to use your access token to read your repository contents and therefore your habit data, including broken habits (via git logs).
42+
However, it's technically possible for exchange server administrator to use your access token to read your repository contents and therefore your habit data, including broken habits (via git logs).
4043

4144
## Screenshots
45+
4246
<img width="292.5" height="633" alt="localhost_5173_habbitses_(iPhone 12 Pro) (1)" src="https://github.com/user-attachments/assets/fc1f49f3-c151-44d4-aed8-5d7630798ad9" />
4347
<img width="292.5" height="633" alt="localhost_5173_habbitses_(iPhone 12 Pro) (3)" src="https://github.com/user-attachments/assets/f4bbf187-fd0e-4bd9-bdb8-373a9d61735c" />
4448
<img width="292.5" height="633" alt="localhost_5173_habbitses_(iPhone 12 Pro)" src="https://github.com/user-attachments/assets/9d5619b3-8125-4b32-ac28-3372fb63d5aa" />

src/components/auth/auth-wall.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { LogoutButton } from "@/components/auth/logout-button"
33
import { ErrorView } from "@/components/util/error-view"
44
import { LoadingPage } from "@/components/util/loading-page"
55
import { OctokitContext } from "@/components/util/octokit-provider"
6-
import { type StoredToken, type StoredTokens, clientId, useStoredTokens } from "@/lib/auth"
6+
import { type StoredToken, type StoredTokens, useStoredTokens } from "@/lib/auth"
7+
import { clientId } from "@/lib/const"
78
import { ExchangeClient } from "@/lib/queries"
89
import type { ExchangeResponse, RefreshResponse, Token } from "@/proto/github/v1/exchange_pb"
910
import { Octokit } from "octokit"

src/components/auth/login-button.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import GitHubLogo from "@/assets/github.svg?url"
22
import { Button } from "@/components/ui/button"
3-
import { clientId } from "@/lib/auth"
3+
import { clientId } from "@/lib/const"
44
import type React from "react"
55

66
export const LoginButton: React.FC<React.ComponentProps<typeof Button>> = (props) => {

src/lib/auth.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { Octokit } from "octokit"
22
import { toast } from "sonner"
33
import useLocalStorage from "use-local-storage"
44

5-
export const clientId = "Iv23liRvkyXb7ekzNQEf"
6-
75
export interface StoredToken {
86
value: string
97
expiresAt: Date

src/lib/const.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export const clientId = "Iv23liRvkyXb7ekzNQEf"
2+
export const githubExchangeAddress = "https://robosl.one"

src/lib/queries.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { toast } from "sonner"
2222
import { decode, encode } from "uint8-to-base64"
2323

2424
import { type StoredAccount, useStoredAccount } from "./auth"
25+
import { githubExchangeAddress } from "./const"
2526
import {
2627
type RepoContent,
2728
useStoredCollection,
@@ -38,7 +39,7 @@ const textDecoder = new TextDecoder()
3839
export const ExchangeClient = createClient(
3940
ExchangeService,
4041
createGrpcWebTransport({
41-
baseUrl: "https://robosl.one",
42+
baseUrl: githubExchangeAddress,
4243
defaultTimeoutMs: 30 * 1000,
4344
fetch: (input, init) => fetch(input, { ...init, credentials: "include" }),
4445
}),

0 commit comments

Comments
 (0)