somratpro Claude Sonnet 4.6 commited on
Commit
72628ff
·
1 Parent(s): f4e74f4

add Google Login guide; rename YOUTUBE_* → GOOGLE_* vars

Browse files

- Add Google Login platform to setup guide (id: google)
with OAuth consent screen + callback URL steps
- YouTube guide: step 1 says "already have Google Login? skip to step 2"
— same GOOGLE_CLIENT_ID/SECRET, just enable YouTube Data API v3
- start.sh: map GOOGLE_CLIENT_ID/SECRET → YOUTUBE_CLIENT_ID/SECRET
so Postiz picks them up (it reads YOUTUBE_* internally)
- getSocialPlatforms(): add Google Login entry, update YouTube
ready-check to use GOOGLE_CLIENT_ID || YOUTUBE_CLIENT_ID
- Channel connections persist across restarts via postgres dump
in postiz-sync.py (no change needed — already covered)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (2) hide show
  1. health-server.js +71 -25
  2. start.sh +9 -0
health-server.js CHANGED
@@ -117,6 +117,14 @@ function getSocialPlatforms() {
117
  note: "API token from Hashnode settings",
118
  },
119
  // ── Needs OAuth app (env vars required) ───────────────────────────────────
 
 
 
 
 
 
 
 
120
  {
121
  id: "linkedin",
122
  name: "LinkedIn",
@@ -162,9 +170,10 @@ function getSocialPlatforms() {
162
  id: "youtube",
163
  name: "YouTube",
164
  emoji: "▶️",
165
- ready: !!e.YOUTUBE_CLIENT_ID,
166
  setupUrl: "https://console.cloud.google.com/apis/credentials",
167
- envVars: ["YOUTUBE_CLIENT_ID", "YOUTUBE_CLIENT_SECRET"],
 
168
  },
169
  {
170
  id: "tiktok",
@@ -568,53 +577,90 @@ function getOAuthPlatformDetails(publicUrl) {
568
  ],
569
  },
570
  {
571
- id: "youtube",
572
- name: "YouTube",
573
- emoji: "▶️",
574
  setupUrl: "https://console.cloud.google.com/apis/credentials",
575
- docsUrl:
576
- "https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps",
577
- callbackUrl: cb("youtube"),
578
  envVars: [
579
  {
580
- name: "YOUTUBE_CLIENT_ID",
581
  desc: "OAuth 2.0 Client ID",
582
- set: !!e.YOUTUBE_CLIENT_ID,
583
  },
584
  {
585
- name: "YOUTUBE_CLIENT_SECRET",
586
  desc: "OAuth 2.0 Client Secret",
587
- set: !!e.YOUTUBE_CLIENT_SECRET,
588
  },
589
  ],
590
  steps: [
591
  {
592
  title: "Create a Google Cloud project",
593
- body: "Go to Google Cloud Console. Create a new project (or use existing).",
594
- },
595
- {
596
- title: "Enable YouTube Data API v3",
597
- body: "In APIs & Services → Library, search for <strong>YouTube Data API v3</strong> and enable it.",
598
  },
599
  {
600
- title: "Create OAuth credentials",
601
- body: "In APIs & Services → Credentials, click <strong>Create Credentials OAuth client ID</strong>. Set type to <strong>Web application</strong>.",
602
  },
603
  {
604
- title: "Add callback URL",
605
- body: "Under Authorized redirect URIs, paste the callback URL below.",
606
  },
607
  {
608
- title: "Configure OAuth consent screen",
609
- body: "Set up consent screen with your app name. Add <strong>YouTube</strong> scopes.",
610
  },
611
  {
612
  title: "Copy credentials",
613
- body: "Download or copy the <strong>Client ID</strong> and <strong>Client Secret</strong>.",
614
  },
615
  {
616
  title: "Add to Space secrets",
617
- body: "Add both env vars below to your HF Space settings, then restart.",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
618
  },
619
  ],
620
  },
 
117
  note: "API token from Hashnode settings",
118
  },
119
  // ── Needs OAuth app (env vars required) ───────────────────────────────────
120
+ {
121
+ id: "google",
122
+ name: "Google Login",
123
+ emoji: "🔵",
124
+ ready: !!(e.GOOGLE_CLIENT_ID || e.YOUTUBE_CLIENT_ID),
125
+ setupUrl: "https://console.cloud.google.com/apis/credentials",
126
+ envVars: ["GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET"],
127
+ },
128
  {
129
  id: "linkedin",
130
  name: "LinkedIn",
 
170
  id: "youtube",
171
  name: "YouTube",
172
  emoji: "▶️",
173
+ ready: !!(e.GOOGLE_CLIENT_ID || e.YOUTUBE_CLIENT_ID),
174
  setupUrl: "https://console.cloud.google.com/apis/credentials",
175
+ envVars: ["GOOGLE_CLIENT_ID", "GOOGLE_CLIENT_SECRET"],
176
+ note: "Uses same app as Google Login",
177
  },
178
  {
179
  id: "tiktok",
 
577
  ],
578
  },
579
  {
580
+ id: "google",
581
+ name: "Google Login",
582
+ emoji: "🔵",
583
  setupUrl: "https://console.cloud.google.com/apis/credentials",
584
+ docsUrl: "https://developers.google.com/identity/protocols/oauth2",
585
+ callbackUrl: cb("google"),
 
586
  envVars: [
587
  {
588
+ name: "GOOGLE_CLIENT_ID",
589
  desc: "OAuth 2.0 Client ID",
590
+ set: !!(e.GOOGLE_CLIENT_ID || e.YOUTUBE_CLIENT_ID),
591
  },
592
  {
593
+ name: "GOOGLE_CLIENT_SECRET",
594
  desc: "OAuth 2.0 Client Secret",
595
+ set: !!(e.GOOGLE_CLIENT_SECRET || e.YOUTUBE_CLIENT_SECRET),
596
  },
597
  ],
598
  steps: [
599
  {
600
  title: "Create a Google Cloud project",
601
+ body: 'Go to <a href="https://console.cloud.google.com" target="_blank" rel="noopener">console.cloud.google.com</a>. Create a new project (or use an existing one).',
 
 
 
 
602
  },
603
  {
604
+ title: "Configure OAuth consent screen",
605
+ body: "In <strong>APIs & Services → OAuth consent screen</strong>, set User Type to <strong>External</strong>. Fill app name, support email, developer email. Add scopes: <code>email</code>, <code>profile</code>, <code>openid</code>. Add your own Google account as a test user.",
606
  },
607
  {
608
+ title: "Create OAuth 2.0 credentials",
609
+ body: "In <strong>APIs & Services → Credentials</strong>, click <strong>Create Credentials OAuth client ID</strong>. Set type to <strong>Web application</strong>. Name it <em>HuggingPost</em>.",
610
  },
611
  {
612
+ title: "Add callback URLs",
613
+ body: "Under <strong>Authorized redirect URIs</strong>, add the callback URL below. Also add the YouTube callback URL if you plan to connect YouTube — it is shown on the YouTube tab.",
614
  },
615
  {
616
  title: "Copy credentials",
617
+ body: "Copy the <strong>Client ID</strong> and <strong>Client Secret</strong> shown in the dialog.",
618
  },
619
  {
620
  title: "Add to Space secrets",
621
+ body: "Add <code>GOOGLE_CLIENT_ID</code> and <code>GOOGLE_CLIENT_SECRET</code> to HF Space Settings → Variables &amp; Secrets. Restart the Space. <br><br><strong>💡 These same credentials also power YouTube channel connections</strong> — no separate YouTube OAuth app needed.",
622
+ },
623
+ ],
624
+ },
625
+ {
626
+ id: "youtube",
627
+ name: "YouTube",
628
+ emoji: "▶️",
629
+ setupUrl: "https://console.cloud.google.com/apis/credentials",
630
+ docsUrl: "https://developers.google.com/youtube/v3/guides/auth/server-side-web-apps",
631
+ callbackUrl: cb("youtube"),
632
+ envVars: [
633
+ {
634
+ name: "GOOGLE_CLIENT_ID",
635
+ desc: "OAuth 2.0 Client ID (same as Google Login)",
636
+ set: !!(e.GOOGLE_CLIENT_ID || e.YOUTUBE_CLIENT_ID),
637
+ },
638
+ {
639
+ name: "GOOGLE_CLIENT_SECRET",
640
+ desc: "OAuth 2.0 Client Secret (same as Google Login)",
641
+ set: !!(e.GOOGLE_CLIENT_SECRET || e.YOUTUBE_CLIENT_SECRET),
642
+ },
643
+ ],
644
+ steps: [
645
+ {
646
+ title: "Already set up Google Login?",
647
+ body: "✅ <strong>Skip to Step 2.</strong> YouTube uses the same <code>GOOGLE_CLIENT_ID</code> and <code>GOOGLE_CLIENT_SECRET</code> — no new OAuth app needed. Just enable the YouTube API and add the callback URL.",
648
+ },
649
+ {
650
+ title: "Enable YouTube Data API v3",
651
+ body: "In <a href=\"https://console.cloud.google.com/apis/library\" target=\"_blank\" rel=\"noopener\">APIs & Services → Library</a>, search for <strong>YouTube Data API v3</strong> and click <strong>Enable</strong>.",
652
+ },
653
+ {
654
+ title: "Add YouTube callback URL to your OAuth client",
655
+ body: "In <strong>Credentials → your OAuth client → Edit</strong>, add the callback URL below to <strong>Authorized redirect URIs</strong>. Save.",
656
+ },
657
+ {
658
+ title: "Add YouTube scopes to consent screen",
659
+ body: "In <strong>OAuth consent screen → Edit App → Scopes</strong>, add <code>https://www.googleapis.com/auth/youtube.upload</code> and <code>https://www.googleapis.com/auth/youtube</code>.",
660
+ },
661
+ {
662
+ title: "First time setup only: add GOOGLE_* secrets",
663
+ body: "If you haven't done Google Login yet — add <code>GOOGLE_CLIENT_ID</code> and <code>GOOGLE_CLIENT_SECRET</code> to HF Space secrets and restart. If Google Login is already working, no new secrets needed.",
664
  },
665
  ],
666
  },
start.sh CHANGED
@@ -90,6 +90,15 @@ export SYNC_INTERVAL="${SYNC_INTERVAL:-3600}" # 60 minutes (override with SYNC_
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
 
 
 
 
 
 
 
 
 
 
93
  # ── Banner ───────────────────────────────────────────────────────────────────
94
  echo ""
95
  echo " ╔════════════════════════════════════╗"
 
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
 
93
+ # ── Google → YouTube env alias ───────────────────────────────────────────────
94
+ # Postiz internally uses YOUTUBE_CLIENT_ID/SECRET for both Google OAuth login
95
+ # and YouTube channel integration. Users set the friendlier GOOGLE_CLIENT_ID/
96
+ # SECRET; we map them here so Postiz picks them up automatically.
97
+ if [ -n "${GOOGLE_CLIENT_ID:-}" ]; then
98
+ export YOUTUBE_CLIENT_ID="${GOOGLE_CLIENT_ID}"
99
+ export YOUTUBE_CLIENT_SECRET="${GOOGLE_CLIENT_SECRET:-}"
100
+ fi
101
+
102
  # ── Banner ───────────────────────────────────────────────────────────────────
103
  echo ""
104
  echo " ╔════════════════════════════════════╗"