Added step to patch pixelfed files

This commit is contained in:
Bofh 2021-02-09 22:55:59 +01:00
parent c5b7bd03d7
commit de5715824f
1 changed files with 38 additions and 2 deletions

View File

@ -10,7 +10,7 @@ Mirroring Instagram accounts **will copy (clone) the images and videos from Inst
Always make sure you mirror accounts whos **content is not strictly copyrighted (or branded) and keep the tagging system of the source code** that marks accounts on Pixelfed as Mirrors.
**Users** of your Pixelfed instance have to know **this accounts are not real accounts** as someone on Instagram could create a real Pixelfed account.
**Users** of your Pixelfed instance have to know **this accounts are not real accounts** as someone on Instagram could create a real Pixelfed account in the future.
## Pre-requisites
@ -18,7 +18,7 @@ Always make sure you mirror accounts whos **content is not strictly copyrighted
- You **need an Instagram account** to make this bot work.
- **A Pixelfed instance** you own. It must be hosted or managed by you (you need shell access for **php artisan commands**)
- **Python 3+ installed** on the same machine as the Pixelfed instance (this is easy, mostly all standard Debian based Linux systems have python3)
- A bit **more disk space** than before. (It depends on how many accounts you mirror and how often that accounts post on IG)
- A bit **more disk space** for Pixelfed media storage. (It depends on how many accounts you mirror and how often that accounts post on IG)
- **Patch 1 file** on Pixelfed deployed code (being on docker or not)
@ -33,3 +33,39 @@ Always make sure you mirror accounts whos **content is not strictly copyrighted
- **Stories**. (will support that soon)
# Installation
As i said on the Pre-requisites, you will need to **patch the following files on Pixelfed** running code:
This patch is **needed to disable Pixelfed API rate limiting completely** as it might pop-up when using your mirror bot.
We asume your Pixelfed installation is at `/var/www` (if it isn't, just **change the steps to match your installation**)
`/var/www/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php`
Add `return 99999999;` after the line where it checks if the user is authenticated.
```php
/**
* Resolve the number of attempts if the user is authenticated or not.
*
* @param \Illuminate\Http\Request $request
* @param int|string $maxAttempts
* @return int
*/
protected function resolveMaxAttempts($request, $maxAttempts)
{
if (Str::contains($maxAttempts, '|')) {
$maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0];
}
if (! is_numeric($maxAttempts) && $request->user()) {
return 99999999;
$maxAttempts = $request->user()->{$maxAttempts};
}
return (int) $maxAttempts;
}
```