Spaces:
Running
Running
chore: update X OAuth instructions, increase default SYNC_INTERVAL, and adjust app navigation paths
Browse files- .env.example +2 -2
- README.md +1 -1
- health-server.js +8 -9
- start.sh +4 -2
.env.example
CHANGED
|
@@ -17,8 +17,8 @@ HF_TOKEN=hf_xxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
| 17 |
|
| 18 |
|
| 19 |
# ββ Backup tuning βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 20 |
-
# Backup interval in seconds. Default
|
| 21 |
-
SYNC_INTERVAL=
|
| 22 |
|
| 23 |
# Skip backup if tarball exceeds this size in bytes. Default 100 MB.
|
| 24 |
SYNC_MAX_FILE_BYTES=104857600
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
# ββ Backup tuning βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 20 |
+
# Backup interval in seconds. Default 3600 (60 min).
|
| 21 |
+
SYNC_INTERVAL=3600
|
| 22 |
|
| 23 |
# Skip backup if tarball exceeds this size in bytes. Default 100 MB.
|
| 24 |
SYNC_MAX_FILE_BYTES=104857600
|
README.md
CHANGED
|
@@ -88,7 +88,7 @@ Add your [UptimeRobot](https://uptimerobot.com) **Main API key** as a Space secr
|
|
| 88 |
|
| 89 |
| Variable | Default | Purpose |
|
| 90 |
| :--- | :--- | :--- |
|
| 91 |
-
| `SYNC_INTERVAL` | `
|
| 92 |
| `BACKUP_DATASET_NAME` | `huggingpost-backup` | Private dataset name (`<user>/<name>`) |
|
| 93 |
| `RESEND_API_KEY` | β | Required only if you want signup activation emails |
|
| 94 |
|
|
|
|
| 88 |
|
| 89 |
| Variable | Default | Purpose |
|
| 90 |
| :--- | :--- | :--- |
|
| 91 |
+
| `SYNC_INTERVAL` | `3600` | Backup interval in seconds (1 hour) |
|
| 92 |
| `BACKUP_DATASET_NAME` | `huggingpost-backup` | Private dataset name (`<user>/<name>`) |
|
| 93 |
| `RESEND_API_KEY` | β | Required only if you want signup activation emails |
|
| 94 |
|
health-server.js
CHANGED
|
@@ -101,7 +101,7 @@ function getSocialPlatforms() {
|
|
| 101 |
// Returns detailed per-platform OAuth setup guide data.
|
| 102 |
// publicUrl: "https://somratpro-huggingpost.hf.space" (no trailing slash)
|
| 103 |
function getOAuthPlatformDetails(publicUrl) {
|
| 104 |
-
const cb = (provider) => `${publicUrl}/app/
|
| 105 |
const e = process.env;
|
| 106 |
return [
|
| 107 |
{
|
|
@@ -135,12 +135,11 @@ function getOAuthPlatformDetails(publicUrl) {
|
|
| 135 |
{ name: "X_API_SECRET", desc: "API Secret (Consumer Secret)", set: !!e.X_API_SECRET },
|
| 136 |
],
|
| 137 |
steps: [
|
| 138 |
-
{ title: "Create an X Developer App", body: 'Apply for a developer account if you don\'t have one. Create a new project + app.' },
|
| 139 |
-
{ title: "Enable OAuth 1.0a", body: '
|
| 140 |
-
{ title: "Add callback URL", body: '
|
| 141 |
-
{ title: "
|
| 142 |
-
{ title: "
|
| 143 |
-
{ title: "Add to Space secrets", body: 'Add both env vars below to your HF Space settings, then restart.' },
|
| 144 |
],
|
| 145 |
},
|
| 146 |
{
|
|
@@ -754,7 +753,7 @@ code{background:rgba(255,255,255,.08);padding:1px 5px;border-radius:4px;font-siz
|
|
| 754 |
|
| 755 |
<!-- Open Postiz button -->
|
| 756 |
${initialData.postizRunning
|
| 757 |
-
? `<a href="/app/" class="open-btn" target="_blank" rel="noopener">Open Postiz β</a>`
|
| 758 |
: `<a href="#" class="open-btn booting" onclick="return false">β³ Postiz is starting up (first boot ~5 min)β¦</a>`}
|
| 759 |
|
| 760 |
<!-- Status row -->
|
|
@@ -875,7 +874,7 @@ async function refresh() {
|
|
| 875 |
if (btn && running && btn.classList.contains('booting')) {
|
| 876 |
btn.classList.remove('booting');
|
| 877 |
btn.textContent = 'Open Postiz β';
|
| 878 |
-
btn.href = '/app/';
|
| 879 |
btn.onclick = null;
|
| 880 |
}
|
| 881 |
|
|
|
|
| 101 |
// Returns detailed per-platform OAuth setup guide data.
|
| 102 |
// publicUrl: "https://somratpro-huggingpost.hf.space" (no trailing slash)
|
| 103 |
function getOAuthPlatformDetails(publicUrl) {
|
| 104 |
+
const cb = (provider) => `${publicUrl}/app/integrations/social/${provider}`;
|
| 105 |
const e = process.env;
|
| 106 |
return [
|
| 107 |
{
|
|
|
|
| 135 |
{ name: "X_API_SECRET", desc: "API Secret (Consumer Secret)", set: !!e.X_API_SECRET },
|
| 136 |
],
|
| 137 |
steps: [
|
| 138 |
+
{ title: "Create an X Developer App", body: 'Apply for a developer account at <a href="https://developer.twitter.com" target="_blank" rel="noopener" style="color:#f472b6">developer.twitter.com</a> if you don\'t have one. Create a new project + app.' },
|
| 139 |
+
{ title: "Enable OAuth 1.0a + set permissions", body: 'On your app page β <strong>User authentication settings β Set up</strong>. Enable <strong>OAuth 1.0a</strong>. Set App permissions to <strong>Read and Write</strong>. Set Type of App to <strong>Native App</strong> (β οΈ must be Native App, not Web App β Web App breaks OAuth 1.0a).' },
|
| 140 |
+
{ title: "Add callback URL", body: 'In the same setup screen, under <strong>Callback URI / Redirect URL</strong>, paste the Callback URL shown below.' },
|
| 141 |
+
{ title: "Get your Consumer Secret", body: '<strong>β οΈ The Consumer Secret (X_API_SECRET) is only shown once</strong> β right after app creation, or after you click <strong>Regenerate</strong> on the Consumer Key row in the Keys & Tokens tab.<br><br>If you don\'t have it saved: go to <strong>Keys & Tokens β OAuth 1.0 Keys β Regenerate</strong>. Copy <em>both</em> the new Consumer Key and Consumer Secret that appear in the popup.' },
|
| 142 |
+
{ title: "Add to Space secrets", body: 'Add both env vars below to your HF Space settings β Variables & Secrets, then restart the Space.' },
|
|
|
|
| 143 |
],
|
| 144 |
},
|
| 145 |
{
|
|
|
|
| 753 |
|
| 754 |
<!-- Open Postiz button -->
|
| 755 |
${initialData.postizRunning
|
| 756 |
+
? `<a href="/app/auth" class="open-btn" target="_blank" rel="noopener">Open Postiz β</a>`
|
| 757 |
: `<a href="#" class="open-btn booting" onclick="return false">β³ Postiz is starting up (first boot ~5 min)β¦</a>`}
|
| 758 |
|
| 759 |
<!-- Status row -->
|
|
|
|
| 874 |
if (btn && running && btn.classList.contains('booting')) {
|
| 875 |
btn.classList.remove('booting');
|
| 876 |
btn.textContent = 'Open Postiz β';
|
| 877 |
+
btn.href = '/app/auth';
|
| 878 |
btn.onclick = null;
|
| 879 |
}
|
| 880 |
|
start.sh
CHANGED
|
@@ -86,7 +86,7 @@ export NODE_ENV="${NODE_ENV:-production}"
|
|
| 86 |
export NOT_SECURED="${NOT_SECURED:-true}"
|
| 87 |
|
| 88 |
# Sync config
|
| 89 |
-
export SYNC_INTERVAL="${SYNC_INTERVAL:-
|
| 90 |
export SYNC_MAX_FILE_BYTES="${SYNC_MAX_FILE_BYTES:-524288000}" # 500 MB (default; covers .next + DB + uploads)
|
| 91 |
export BACKUP_DATASET_NAME="${BACKUP_DATASET_NAME:-huggingpost-backup}"
|
| 92 |
|
|
@@ -272,7 +272,9 @@ sleep 1
|
|
| 272 |
# && pnpm run --parallel pm2 && pm2 logs
|
| 273 |
echo "Starting nginx + Postiz PM2 procs..."
|
| 274 |
cd "${POSTIZ_DIR}"
|
| 275 |
-
( nginx && pnpm run pm2 2>&1 |
|
|
|
|
|
|
|
| 276 |
POSTIZ_PID=$!
|
| 277 |
|
| 278 |
echo "Waiting for nginx (port 5000)..."
|
|
|
|
| 86 |
export NOT_SECURED="${NOT_SECURED:-true}"
|
| 87 |
|
| 88 |
# Sync config
|
| 89 |
+
export SYNC_INTERVAL="${SYNC_INTERVAL:-3600}" # 60 minutes (override with SYNC_INTERVAL secret)
|
| 90 |
export SYNC_MAX_FILE_BYTES="${SYNC_MAX_FILE_BYTES:-524288000}" # 500 MB (default; covers .next + DB + uploads)
|
| 91 |
export BACKUP_DATASET_NAME="${BACKUP_DATASET_NAME:-huggingpost-backup}"
|
| 92 |
|
|
|
|
| 272 |
# && pnpm run --parallel pm2 && pm2 logs
|
| 273 |
echo "Starting nginx + Postiz PM2 procs..."
|
| 274 |
cd "${POSTIZ_DIR}"
|
| 275 |
+
( nginx && pnpm run pm2 2>&1 | grep -Ev \
|
| 276 |
+
'\[RoutesResolver\]|\[RouterExplorer\]|Mapped \{|\(Use --lines|__/\\\\|_\\/\\\\|PM2 log:|Progress: resolved|[ββββββ€βββΌ]|Runtime Edition|Production Process Manager|built-in Load Balancer|Start and Daemonize|Load Balance|Make pm2 auto-boot|To go further|pm2\.io|pm2 monitor|pm2 startup|pm2 start ' \
|
| 277 |
+
| sed 's/^/[postiz] /' ) &
|
| 278 |
POSTIZ_PID=$!
|
| 279 |
|
| 280 |
echo "Waiting for nginx (port 5000)..."
|