CineNest · Telegram → Drive

Pick your folder.
Nothing wider.

Setup required first — the Picker is not ready yet. No CineNest OAuth client or API key exists, so the Picker cannot open until you complete Step 1 (about 5 minutes). After that, this page is your Picker link: it uses drive.file only, so CineNest can touch just the folder you select here, not your whole Drive. A folder ID on its own is not permission; picking it here is what grants it.

Your existing folder

Keep this folder. Do not create a new one.

📁 CineNest Movies
1q1bc4sFj4prS1wMWW5CQrW1sxdFQUtde

Private · Already used by the CineNest app. You will re-select this exact folder in Step 2 so the same OAuth app gets drive.file access to it.

Scope: drive.file only Not account-wide drive

What changed in the uploader

  • Removed: rclone with default drive scope + root_folder_id. That token could see all of Drive.
  • Now: Google Drive API files.create with your OAuth token and parents: [pickedFolderId].
  • Why Picker matters: With drive.file, Google only lets the app see files it created — or files/folders you explicitly open with Picker. Picking CineNest Movies is the grant.
  • If it fails: the exact Google error is shown below. The flow pauses — it never falls back to account-wide access.
1

Create a CineNest Google Cloud project (one-time)

No OAuth client or API key exists yet for CineNest — that is why there was no Picker link to send until now. Use a new CineNest project, separate from TWOUZA Cloud, so the grant stays isolated.

  1. In Google Cloud Console, signed in as adwin.shju@gmail.com, create a new project named CineNest.
  2. In that project, enable both APIs: Google Drive API and Google Picker API (APIs & Services → Library).
  3. Configure the OAuth consent screen (External, Testing is fine), add your Gmail as a test user, and allow only the scope https://www.googleapis.com/auth/drive.file. Do not add drive or drive.readonly.
  4. Go to APIs & Services → Credentials → Create Credentials → OAuth client ID → Web application. Name it CineNest Picker. Under Authorised JavaScript origins, add the origin of this page (the URL in your browser address bar, without any path). If Google later rejects sign-in with origin_mismatch, this is the field to fix.
  5. Create an API key on the same Credentials page (needed by Picker).
  6. Paste both values in Step 2. They stay in this tab’s memory only — this page does not save them, send them anywhere, or store them in local storage.

Do not reuse the TWOUZA Studio OAuth setup for this — CineNest gets its own project, client, and key, so revoking one never affects the other.

2

Connect Google & select CineNest Movies

Sign-in requests drive.file only. Then Picker opens — choose CineNest Movies and confirm. That selection is saved in this tab as the upload target.

Pre-filled with the CineNest Web client — the same client the backend uses. The Picker and the backend must use this same client, or the backend will not see the folder you pick. Do not swap in the Desktop client here.

Expected pick: CineNest Movies · 1q1bc4sFj4prS1wMWW5CQrW1sxdFQUtde. If you pick a different folder, the test upload will go there instead — the page warns you.

2b

Connect the backend (server-side, for automatic uploads)

The Picker test in Step 3 proves the folder grant. This step gives the server its own refresh token, so it can upload later with your browser closed — without ever seeing your password or a full-Drive token.

Exact HTTPS callback URL: https://cinenest-picker.pages.dev/oauth/callback
Scope: https://www.googleapis.com/auth/drive.file only · Offline access: yes (access_type=offline, prompt=consent)
Client secret: stored as a Cloudflare Pages secret (GOOGLE_CLIENT_SECRET) — never in this page, never in code, never in chat.
Refresh token: stored in Cloudflare KV (CINENEST_TOKENS, key refresh_token), encrypted at rest, readable only by the callback Worker. It is never shown in the browser, never logged, and never returned by /oauth/status (that endpoint only says saved: true/false).

The test button runs entirely on the server: it refreshes the saved token in Cloudflare KV and uploads a small cinenest-backend-refresh-test.txt to CineNest Movies, then verifies it with files.get. No token value is ever returned to the browser. If the test file already exists, it is returned instead of uploading a duplicate.

The callback validates a random, single-use state — stored both in an HttpOnly cookie and on the server, so a lost Safari cookie alone no longer rejects a real sign-in. A wrong, missing, or already-used state is still rejected with 403 and no code is exchanged. Do not refresh the callback page, and do not open the sign-in in a different tab or app — complete it in this same Safari tab, within 10 minutes. If you do see “Invalid state”, tap the “Try again” link on that page for a fresh sign-in; refreshing the rejected page will be rejected again. Before any refresh token is saved or replaced, the callback also verifies the signed-in account is adwin.shju@gmail.com and that the existing CineNest Movies folder is writable (canAddChildren). If the folder check returns 404, the token is held pending for 10 minutes only — it is not saved — and you are sent to Step 2 with ?backend_pick=1: pick CineNest Movies again with this same Web client (Picker App ID 308868400448), then the server re-checks write access via /oauth/pick-verify and only then saves the refresh token.

3

Verify one small upload

Pick any small file you own (a few MB is ideal — e.g. a short .txt, image, or tiny clip named with 1080p if you want to mirror the bot rule). The page uploads it directly to the folder you just picked, using the same token.

Open CineNest Movies in Drive ↗

Success means: Drive returns a file ID, and the file appears when you open CineNest Movies above. Delete the test file from Drive afterwards if you don’t want to keep it. Failure means: copy the exact error shown — do not approve wider access to “fix” it.

4

Server check — still pending

TWOUZA-TEMP-01 · 129.225.106.227 · 1 OCPU / 1 GB RAM · 46.6 GB boot volume · Ubuntu 24.04 · Last confirmed Running 30 Nov.

Once SSH is set to Ask in Muse Settings → Permissions → Direct network protocols, the read-only check to run is:

free -h swapon --show df -h / uptime

Nothing will be installed, restarted, or deployed from that check. Results get reported first; CineNest (in its own ~/cinenest-importer, separate services and state) is only deployed after you approve the numbers.

  • ✓ZIP reviewed — importer, services & README checked. 1080p is matched on filename/caption text, duplicates skipped by Telegram file ID only, no backfill of old posts.
  • ✓Drive approach decided — Option 2: your OAuth + drive.file + Picker. Account-wide rclone flow rejected.
  • ○Picker selection — waiting on OAuth Client ID + API Key (Step 1), then your pick in Step 2.
  • ○Small upload verified — waiting on Step 3.
  • ○SSH numbers reported — waiting on SSH permission set to Ask.
  • ○Channel test — after deployment approval only: post one small 1080p video you own in CineNest Uploads and confirm the bot reply + file in Drive.
How the updated server uploader will work (for when deployment resumes)

The server keeps the same Telegram logic (Local Bot API, 1080p filter, file-ID de-dupe, confirmation in your private bot chat). Only the Drive leg changes:

POST https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart Authorization: Bearer <your drive.file token> Metadata: { "name": "<filename>", "parents": ["<pickedFolderId>"] }

The refresh token on the server must come from this same Picker-granted flow — not from an rclone drive-scope authorisation. If Google returns 404 fileNotFound or 403 insufficientFilePermissions for the picked folder, deployment pauses with that exact error shown to you.