Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .env.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
# GitHub Personal Access Token (optional but recommended)
# Without a token, you may hit GitHub's rate limits (60 requests/hour)
# With a token, you get 5,000 requests/hour
# Generate at: https://github.com/settings/tokens
# Requires 'gist' scope to read gists
GITHUB_TOKEN=your_github_token_here

# ASF Configuration (optional)
ASF_PORT=1242
ASF_HOST=localhost
ASF_PASSWORD=hunter2
ASF_COMMAND_PREFIX=!
ASF_HTTPS=false
ASF_BOTS=asf #https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Commands#bots-argument
ASF_BOTS=asf # https://github.com/JustArchiNET/ArchiSteamFarm/wiki/Commands#bots-argument
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,31 @@ Latest games claimed: https://gist.github.com/C4illin/77a4bcb9a9a7a95e5f291badc9
3. `git clone https://github.com/C4illin/ASFclaim.git`
4. `cd ASFclaim`
5. `npm install`
6. **(Optional but recommended)** Create a GitHub Personal Access Token to avoid rate limits:
- Go to https://github.com/settings/tokens
- Click "Generate new token" → "Generate new token (classic)"
- Give it a name like "ASFclaim"
- Select the `gist` scope (required to read gists)
- Copy the generated token
- Create a `.env` file with your GitHub token:
```
GITHUB_TOKEN=your_github_token_here
```
- **Rate limits**: Without token: 60 requests/hour | With token: 5,000 requests/hour

## Run
1. Make sure ASF is running
2. `node .`
The program checks available licenses every 6 hours.
The program checks available licenses every 6 hours.

### Docker

```bash
docker run --name asfclaim -e ASF_PORT=1242 -e ASF_HOST=localhost -e ASF_HTTPS=false -e ASF_PASSWORD=hunter2 -e ASF_COMMAND_PREFIX=! -e ASF_BOTS=asf ghcr.io/c4illin/asfclaim:master
# With GitHub token (recommended):
docker run --name asfclaim -e GITHUB_TOKEN=your_github_token_here -e ASF_PORT=1242 -e ASF_HOST=localhost -e ASF_HTTPS=false -e ASF_PASSWORD=hunter2 -e ASF_COMMAND_PREFIX=! -e ASF_BOTS=asf ghcr.io/c4illin/asfclaim:master

# Without GitHub token (may hit rate limits):
docker run --name asfclaim -e ASF_PORT=1242 -e ASF_HOST=localhost -e ASF_HTTPS=false -e ASF_PASSWORD=hunter2 -e ASF_COMMAND_PREFIX=! -e ASF_BOTS=asf ghcr.io/c4illin/asfclaim:master
```
#### Docker-compose:
```yml
Expand All @@ -36,7 +51,9 @@ services:
container_name: asfclaim
restart: unless-stopped
depends_on: asf # remove this if asf is not running in docker
environment: # all are optional, defaults are listed below
environment:
- GITHUB_TOKEN=${GITHUB_TOKEN} # optional but recommended - prevents rate limiting
# all below are optional, defaults are listed
- ASF_PORT=1242
- ASF_HOST=localhost
- ASF_PASSWORD=
Expand Down Expand Up @@ -64,6 +81,6 @@ https://github.com/specu/ASFclaim.py Python rewrite without any dependencies
https://github.com/JourneyDocker/ASFclaim fork with different gist and discord notifications

Instead of forking it, please consider sending a PR so we can make the best solution together!

## Stargazers over time
[![Stargazers over time](https://starchart.cc/C4illin/ASFclaim.svg?variant=adaptive)](https://starchart.cc/C4illin/ASFclaim)
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ services:
asf-claim:
build: .
# environment:
# - GITHUB_TOKEN=${GITHUB_TOKEN} # optional: prevents rate limiting
# - ASF_PORT=1242
# - ASF_HOST=localhost
# - ASF_PASSWORD=hunter2
Expand Down
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@ import fetch from "node-fetch";
import { readFile, writeFileSync } from "node:fs";
import { Octokit } from "@octokit/rest";
import * as dotenv from "dotenv";
const octokit = new Octokit();
dotenv.config();

const githubToken = process.env.GITHUB_TOKEN;
const octokit = new Octokit(githubToken ? { auth: githubToken } : {});

if (githubToken) {
console.log("GitHub token provided - using authenticated requests (5000/hour rate limit)");
} else {
console.log("No GitHub token provided - using unauthenticated requests (60/hour rate limit)");
console.log("Consider setting GITHUB_TOKEN environment variable to avoid rate limits");
}

const asfport = process.env.ASF_PORT || "1242";
const asfhost = process.env.ASF_HOST || "localhost";
const password = process.env.ASF_PASSWORD || "";
Expand Down