[PR #177] [MERGED] add cookie support #2497

Closed
opened 2026-04-11 06:51:39 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/imputnet/cobalt/pull/177
Author: @dumbmoron
Created: 8/16/2023
Status: Merged
Merged: 8/20/2023
Merged by: @wukko

Base: currentHead: cookie


📝 Commits (3)

  • a221651 add cookie support
  • fd0357e move cookies to processing
  • c72d9b0 change cookie path capitalization for consistency with other env stuff

📊 Changes

8 files changed (+118 additions, -11 deletions)

View changed files

📝 .gitignore (+3 -0)
📝 docker-compose.example.yml (+3 -1)
📝 package.json (+1 -0)
src/modules/processing/cookie/cookie.js (+37 -0)
src/modules/processing/cookie/cookies_example.json (+5 -0)
src/modules/processing/cookie/manager.js (+58 -0)
📝 src/modules/processing/services/instagram.js (+11 -2)
📝 src/test/tests.json (+0 -8)

📄 Description

usage:

  • create cookies.json file somewhere, preferrably outside cobalt directory
  • in docker, you can bind mount it (volumes in composefile)
    • if you don't want cobalt to update the cookies, set it to :ro (cobalt will print a warning about this, ignore it)
  • set COOKIE_PATH to the absolute path of this file
  • enjoy?

usage in services: probably the simplest api ever

  • import { getCookie, updateCookie } from '../../cookie/manager.js';
  • const cookie = getCookie('<service_name>');
    • add this to headers - const r = await fetch(..., { ... headers: { ..., cookie } ... })
  • after fetch is done, save potential cookie updates: updateCookie(cookie, r.headers)
  • see instagram.js in diff for example usage

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/imputnet/cobalt/pull/177 **Author:** [@dumbmoron](https://github.com/dumbmoron) **Created:** 8/16/2023 **Status:** ✅ Merged **Merged:** 8/20/2023 **Merged by:** [@wukko](https://github.com/wukko) **Base:** `current` ← **Head:** `cookie` --- ### 📝 Commits (3) - [`a221651`](https://github.com/imputnet/cobalt/commit/a2216510b772c4145d1142a0372b0072a9b2291e) add cookie support - [`fd0357e`](https://github.com/imputnet/cobalt/commit/fd0357e52da4033d440057fc5eebcf895589adea) move cookies to processing - [`c72d9b0`](https://github.com/imputnet/cobalt/commit/c72d9b0ed15d2951c6aada4836a462fd2aca96c4) change cookie path capitalization for consistency with other env stuff ### 📊 Changes **8 files changed** (+118 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+3 -0) 📝 `docker-compose.example.yml` (+3 -1) 📝 `package.json` (+1 -0) ➕ `src/modules/processing/cookie/cookie.js` (+37 -0) ➕ `src/modules/processing/cookie/cookies_example.json` (+5 -0) ➕ `src/modules/processing/cookie/manager.js` (+58 -0) 📝 `src/modules/processing/services/instagram.js` (+11 -2) 📝 `src/test/tests.json` (+0 -8) </details> ### 📄 Description usage: - create cookies.json file somewhere, preferrably outside cobalt directory - in docker, you can bind mount it (`volumes` in composefile) - if you don't want cobalt to update the cookies, set it to `:ro` (cobalt will print a warning about this, ignore it) - set COOKIE_PATH to the absolute path of this file - enjoy? usage in services: probably the simplest api ever - `import { getCookie, updateCookie } from '../../cookie/manager.js';` - `const cookie = getCookie('<service_name>');` - add this to headers - `const r = await fetch(..., { ... headers: { ..., cookie } ... })` - after fetch is done, save potential cookie updates: updateCookie(cookie, r.headers) - see instagram.js in diff for example usage --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-11 06:51:39 -05:00
Sign in to join this conversation.