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>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 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:
current← Head:cookie📝 Commits (3)
a221651add cookie supportfd0357emove cookies to processingc72d9b0change 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:
volumesin composefile):ro(cobalt will print a warning about this, ignore it)usage in services: probably the simplest api ever
import { getCookie, updateCookie } from '../../cookie/manager.js';const cookie = getCookie('<service_name>');const r = await fetch(..., { ... headers: { ..., cookie } ... })🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.