Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
b11117e
added packages, fixed 403 error with curl
vb2007 Nov 17, 2025
e695ab4
cleaned up codebase after succesful curl approach
vb2007 Nov 17, 2025
370d30a
brought back direct stream links for (too) large files, added failsafe
vb2007 Nov 18, 2025
774e3c5
Merge pull request #167 from vb2007/dev-darwin-hotfix
vb2007 Nov 18, 2025
1e9862c
added curl download & build job to deploy workflow
vb2007 Nov 18, 2025
72ab5b8
changed branch for testing
vb2007 Nov 18, 2025
87f7dbf
created session randomizer for downloads (tls certs, browser sessions,
vb2007 Nov 18, 2025
fede69a
added docs for darwin helper files
vb2007 Nov 18, 2025
73c0945
fixed curl parameters, added debug file
vb2007 Nov 18, 2025
7ae7c99
written back deploy workflow trigger
vb2007 Nov 18, 2025
169cf00
tried adaptive fingerprint bypass
vb2007 Nov 18, 2025
621cf75
Merge pull request #168 from vb2007/dev-darwin-curl-fix
vb2007 Nov 18, 2025
115b6ac
removed download, transcode, tls spoof, etc. logic from darwin, used
vb2007 Nov 18, 2025
b0ba7fe
updated darwinCache table schema, added migration script
vb2007 Nov 18, 2025
29e0efa
updated distribution logic, used new table column names in helpers
vb2007 Nov 18, 2025
d5220e8
rolled back deploy workflow (removed curl)
vb2007 Nov 18, 2025
e65ee12
updated packages
vb2007 Nov 18, 2025
4c47519
commented out non-fatal "spammy" logs in darwin helpers
vb2007 Nov 18, 2025
ec23ce3
updated version in package.json
vb2007 Nov 18, 2025
0ba10b8
Merge pull request #169 from vb2007/dev-darwin-rewrite
vb2007 Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
# with:
# node-version: "24.8.0"

- name: Intalling Node.js dependencies
- name: Installing Node.js dependencies
working-directory: /home/vb2007/prod/discordbot
env:
PATH: /home/vb2007/.nvm/versions/node/v24.8.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Expand Down
95 changes: 49 additions & 46 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "discordbot",
"version": "4.1.1",
"version": "4.2.0",
"description": "A simple discord bot of mine developed with discord.js (Node.js).",
"type": "module",
"main": "index.js",
Expand Down
25 changes: 15 additions & 10 deletions src/helpers/darwin/darwinCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,28 @@ const extractVideoId = (url) => {
};

/**
* Add a URL to Darwin's cache
* @param {string} url - The video URL to cache
* Add a video to Darwin's cache
* @param {string} directVideoUrl - The direct video URL
* @param {string} forumPostUrl - The forum post URL
* @param {string} videoTitle - The video title
* @returns {Promise<boolean>} - Whether the operation was successful
*/
export const addToCache = async (url) => {
export const addToCache = async (directVideoUrl, forumPostUrl, videoTitle) => {
try {
const exists = await isInCache(url);
const exists = await isInCache(directVideoUrl);
if (exists) {
console.log(`URL already in cache: ${url}`);
console.log(`URL already in cache: ${directVideoUrl}`);
return true;
}

const videoId = extractVideoId(url);
console.log(`Adding "${url}" (ID: ${videoId}) to Darwin's cache`);
const videoId = extractVideoId(directVideoUrl);
// console.log(`Adding "${videoTitle}" (ID: ${videoId}) to Darwin's cache`);

try {
await query("INSERT INTO darwinCache (videoUrl, videoId) VALUES (?, ?)", [url, videoId]);
await query(
"INSERT INTO darwinCache (directVideoUrl, forumPostUrl, videoId, videoTitle) VALUES (?, ?, ?, ?)",
[directVideoUrl, forumPostUrl, videoId, videoTitle]
);
return true;
} catch (sqlError) {
//handle duplicate key error (MySQL error code 1062) (edge case, if source reuses the same id)
Expand All @@ -49,7 +54,7 @@ export const addToCache = async (url) => {
if (idExists.length > 0) {
console.log(`Another URL already uses videoId ${videoId}, treating as cached`);
} else {
console.log(`URL ${url} is a duplicate entry`);
console.log(`URL ${directVideoUrl} is a duplicate entry`);
}

return true;
Expand All @@ -74,7 +79,7 @@ export const isInCache = async (url) => {
console.log(`Checking "${url}" (ID: ${videoId}) in Darwin's cache`);

const result = await query(
"SELECT videoUrl FROM darwinCache WHERE videoUrl = ? OR videoId = ?",
"SELECT directVideoUrl FROM darwinCache WHERE directVideoUrl = ? OR videoId = ?",
[url, videoId]
);
return result.length > 0;
Expand Down
Loading
Loading