fix(docker): change github star api
This commit is contained in:
+16
-15
@@ -21,22 +21,23 @@ WORKDIR /app
|
||||
|
||||
RUN npm install -g pnpm
|
||||
|
||||
ARG DATABASE_URL=""
|
||||
ARG AUTH_SECRET=""
|
||||
ARG NEXT_PUBLIC_APP_URL=http://localhost:3000
|
||||
ARG GOOGLE_CLIENT_ID=""
|
||||
ARG GOOGLE_CLIENT_SECRET=""
|
||||
ARG GITHUB_ID=""
|
||||
ARG GITHUB_SECRET=""
|
||||
ARG LinuxDo_CLIENT_ID=""
|
||||
ARG LinuxDo_CLIENT_SECRET=""
|
||||
ARG RESEND_API_KEY="res"
|
||||
ARG NEXT_PUBLIC_EMAIL_R2_DOMAIN=""
|
||||
ARG NEXT_PUBLIC_OPEN_SIGNUP="1"
|
||||
ARG NEXT_PUBLIC_GOOGLE_ID=""
|
||||
ARG SCREENSHOTONE_BASE_URL=""
|
||||
ARG GITHUB_TOKEN="ghp_"
|
||||
# ARG DATABASE_URL=""
|
||||
# ARG AUTH_SECRET=""
|
||||
# ARG NEXT_PUBLIC_APP_URL=http://localhost:3000
|
||||
# ARG GOOGLE_CLIENT_ID=""
|
||||
# ARG GOOGLE_CLIENT_SECRET=""
|
||||
# ARG GITHUB_ID=""
|
||||
# ARG GITHUB_SECRET=""
|
||||
# ARG LinuxDo_CLIENT_ID=""
|
||||
# ARG LinuxDo_CLIENT_SECRET=""
|
||||
# ARG RESEND_API_KEY="res"
|
||||
# ARG NEXT_PUBLIC_EMAIL_R2_DOMAIN=""
|
||||
# ARG NEXT_PUBLIC_OPEN_SIGNUP="1"
|
||||
# ARG NEXT_PUBLIC_GOOGLE_ID=""
|
||||
# ARG SCREENSHOTONE_BASE_URL=""
|
||||
# ARG GITHUB_TOKEN="ghp_"
|
||||
|
||||
COPY .env.example .env
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
## Quick Start
|
||||
|
||||
See usage docs about [guide](https://wr.do/docs/quick-start) for quick start.
|
||||
|
||||
## Self-hosted Tutorial
|
||||
|
||||
See step by step installation tutorial at [Quick Start for Developer](https://wr.do/docs/developer/quick-start).
|
||||
|
||||
### Requirements
|
||||
@@ -44,6 +40,22 @@ See more docs about [developer](https://wr.do/docs/developer/installation).
|
||||
|
||||
See docs about [email worker](https://wr.do/docs/developer/cloudflare-email-worker).
|
||||
|
||||
## Self-hosted
|
||||
|
||||
### Deploy with Vercel
|
||||
|
||||
[](https://vercel.com/new/clone?repository-url=https://github.com/oiov/wr.do.git&project-name=wrdo&env=DATABASE_URL&env=AUTH_SECRET&env=RESEND_API_KEY&env=NEXT_PUBLIC_EMAIL_R2_DOMAIN&env=NEXT_PUBLIC_OPEN_SIGNUP&env=GITHUB_TOKEN)
|
||||
|
||||
Remember to fill in the necessary environment variables.
|
||||
|
||||
### Deploy with Docker Compose
|
||||
|
||||
Fill in the environment variables in the `docker-compose.yml`, then:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Local development
|
||||
|
||||
```bash
|
||||
@@ -88,18 +100,6 @@ docker build -t wrdo .
|
||||
docker run -p 3000:3000 wrdo
|
||||
```
|
||||
|
||||
#### Docker Compose
|
||||
|
||||
```bash
|
||||
git clone https://github.com/oiov/wr.do
|
||||
cd wr.do
|
||||
```
|
||||
|
||||
Fill in the environment variables in the `env` file, then:
|
||||
|
||||
```bash
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
## Legitimacy review
|
||||
|
||||
|
||||
@@ -10,27 +10,19 @@ interface GitHubResponse {
|
||||
}
|
||||
|
||||
async function getGitHubStars(owner: string, repo: string) {
|
||||
const githubToken = process.env.GITHUB_TOKEN;
|
||||
|
||||
if (!githubToken) {
|
||||
throw new Error("GitHub token is not configured");
|
||||
}
|
||||
|
||||
const res = await fetch(`https://api.github.com/repos/${owner}/${repo}`, {
|
||||
headers: {
|
||||
Accept: "application/vnd.github.v3+json",
|
||||
Authorization: `token ${githubToken}`,
|
||||
"User-Agent": "NextJS-App",
|
||||
const res = await fetch(
|
||||
`https://wr.do/api/github?owner=${owner}&repo=${repo}`,
|
||||
{
|
||||
next: { revalidate: 3600 },
|
||||
},
|
||||
next: { revalidate: 3600 },
|
||||
});
|
||||
);
|
||||
|
||||
if (!res.ok) {
|
||||
throw new Error("Failed to fetch GitHub stars");
|
||||
}
|
||||
|
||||
const data: GitHubResponse = await res.json();
|
||||
return data.stargazers_count;
|
||||
const data = await res.json();
|
||||
return data.stars;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user