somratpro commited on
Commit
2869840
Β·
1 Parent(s): 264b68d

chore: update X OAuth instructions, increase default SYNC_INTERVAL, and adjust app navigation paths

Browse files
Files changed (4) hide show
  1. .env.example +2 -2
  2. README.md +1 -1
  3. health-server.js +8 -9
  4. 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 300 (5 min).
21
- SYNC_INTERVAL=300
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` | `300` | Backup interval in seconds (5 min) |
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/api/auth/connect/${provider}/callback`;
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: 'In <strong>User authentication settings</strong>, enable <strong>OAuth 1.0a</strong>. Set type to <strong>Web App</strong>.' },
140
- { title: "Add callback URL", body: 'Under Callback URI / Redirect URL, paste the callback URL below.' },
141
- { title: "Set permissions", body: 'Set app permissions to <strong>Read and Write</strong> (or Read, Write and Direct Messages).' },
142
- { title: "Copy credentials", body: 'From Keys and Tokens tab, copy <strong>API Key</strong> and <strong>API Key Secret</strong>.' },
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 &amp; Tokens tab.<br><br>If you don\'t have it saved: go to <strong>Keys &amp; 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 &amp; 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:-300}"
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 | sed 's/^/[postiz] /' ) &
 
 
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)..."