Skip to content
Merged
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
2 changes: 1 addition & 1 deletion apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@profullstack/r4ck",
"version": "0.1.0",
"version": "0.2.0",
"description": "r4ck.dev from the terminal and for agents: search every VPS, bare metal, GPU and PaaS offer for sale, drill down by spec, price and place, and bridge the same tools into any MCP client.",
"type": "module",
"main": "src/index.js",
Expand Down
49 changes: 48 additions & 1 deletion apps/cli/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { createInterface } from 'node:readline';
* reply verbatim, otherwise a table a person can read. `r4ck mcp` bridges
* stdio to the site's MCP endpoint so any client gets every tool.
*/
export const VERSION = '0.1.0';
export const VERSION = '0.2.0';
const DEFAULT_API = process.env.R4CK_API ?? 'https://r4ck.dev';
const CONFIG_DIR = join(process.env.XDG_CONFIG_HOME ?? join(homedir(), '.config'), 'r4ck');
const CONFIG_FILE = join(CONFIG_DIR, 'config.json');
Expand Down Expand Up @@ -54,6 +54,17 @@ export const COMMANDS = [
usage: 'saved [list|add <name> [filters]|rm <id>]',
help: 'Saved searches on the account.',
},
{
name: 'redeem',
usage: 'redeem <CR-code>',
help: 'Redeem a credit code for days of the pass on your account.',
},
{ name: 'pass', usage: 'pass', help: 'When the pass on your account runs out, and its token.' },
{
name: 'invites',
usage: 'invites [list|create [note]|revoke <id>]',
help: 'Your scarce invites (both sides get pass days) and your link.',
},
{
name: 'open',
usage: 'open <id|sentence>',
Expand Down Expand Up @@ -441,6 +452,42 @@ export async function run(
}
throw new Error('usage: r4ck saved [list|add <name> [filters]|rm <id>]');
}
case 'redeem': {
if (!rest[0]) throw new Error('usage: r4ck redeem <code>');
const r = await client.post('/api/v1/credits/redeem', { code: rest.join(' ') });
return flags.json
? json(r)
: say(`Redeemed: ${r.days} days of pass. Unmetered until ${r.pass_until}.`);
}
case 'pass': {
const r = await client.get('/api/v1/pass');
if (flags.json) return json(r);
return say(
r.until
? `pass until ${r.until}${r.token ? `\n${r.header}: ${r.token}` : ''}`
: `no pass on this account (buy one at ${client.base}/crawl or redeem a code)`,
);
}
case 'invites': {
const [sub = 'list', ...more] = rest;
if (sub === 'list') {
const r = await client.get('/api/v1/invites');
if (flags.json) return json(r);
say(`${r.quota.left} of ${r.quota.total} invites left; ${r.bonus_days} pass days each`);
if (!r.can_send) say(r.why_not);
for (const i of r.invites) say(`${i.id} ${i.status} ${i.note}`);
return say(`your link: ${r.affiliate.url}`);
}
if (sub === 'create') {
const r = await client.post('/api/v1/invites', { note: more.join(' ') });
return flags.json ? json(r) : say(r.invite.url);
}
if (sub === 'revoke') {
await client.post(`/api/v1/invites/${encodeURIComponent(more[0] ?? '')}/revoke`);
return say('withdrawn');
}
throw new Error('usage: r4ck invites [list|create [note]|revoke <id>]');
}
case 'open': {
if (/^\d+$/.test(rest[0] ?? '')) return say(`${client.base}/servers/${rest[0]}`);
return say(`${client.base}/servers?${queryFrom(flags, rest.join(' ') || undefined)}`);
Expand Down
6 changes: 4 additions & 2 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,19 @@
"type": "module",
"main": "src/main.js",
"dependencies": {
"@profullstack/footer": "latest",
"@profullstack/affiliates": "0.3.0",
"@profullstack/emailer": "^1.0.3",
"@profullstack/footer": "latest",
"@profullstack/profile": "0.1.6",
"@profullstack/r4ck": "workspace:*",
"@profullstack/redeem-credits": "0.2.0",
"@profullstack/throttle": "^0.3.4",
"@profullstack/x402-gateway": "^0.13.1",
"@r4ck/auth": "workspace:*",
"@r4ck/config": "workspace:*",
"@r4ck/core": "workspace:*",
"@r4ck/db": "workspace:*",
"@r4ck/sync": "workspace:*",
"@profullstack/r4ck": "workspace:*",
"@simplewebauthn/browser": "^14.0.0",
"hono": "^4.13.14"
}
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { gate } from './lib/gate.js';
import { Denied, loadUser, render, wantsJson } from './lib/http.js';
import { registerApi } from './routes/api.js';
import { registerAuth } from './routes/auth.js';
import { registerCredits, rememberRef } from './routes/credits.js';
import { registerMcp } from './routes/mcp.js';
import { registerPages } from './routes/pages.js';
import { registerStatic } from './routes/static.js';
Expand All @@ -23,6 +24,7 @@ app.use('*', async (c, next) => {
});
app.use('*', gate);
app.use('*', loadUser);
app.use('*', rememberRef);

app.onError(async (err, c) => {
if (err?.redirect) return c.redirect(err.redirect, 303);
Expand Down Expand Up @@ -52,5 +54,6 @@ app.notFound(async (c) => {
registerStatic(app);
registerAuth(app);
registerApi(app);
registerCredits(app);
registerMcp(app);
registerPages(app);
Loading
Loading