Skip to content

Commit f1eb4d6

Browse files
committed
adds config option for site wide freeleech
1 parent 56dad07 commit f1eb4d6

5 files changed

Lines changed: 13 additions & 1 deletion

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ If your configuration is not valid, sqtracker will fail to start.
8383
| SQ_BP_EARNED_PER_GB | envs | 1 | Number of bonus points awarded to a user for each GB they upload |
8484
| SQ_BP_COST_PER_INVITE | envs | 3 | Number of bonus it costs a user to buy 1 invite (set to 0 to disable buying invites) |
8585
| SQ_BP_COST_PER_GB | envs | 3 | Number of bonus it costs a user to buy 1 GB of upload (set to 0 to disable buying upload) |
86+
| SQ_SITE_WIDE_FREELEECH | envs | `true` | Whether or not to enable freeleech on all torrents |
8687
| SQ_TORRENT_CATEGORIES | envs | `["Movies", "TV"]` | An array of categories available on your tracker site |
8788
| SQ_BASE_URL | envs | https://demo.sqtracker.dev | The URL of your tracker site |
8889
| SQ_API_URL | envs | https://demo.sqtracker.dev/api | The URL of your API. Under the recommended setup, it should be `${SQ_BASE_URL}/api` |

api/src/controllers/torrent.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ export const downloadTorrent = async (req, res) => {
152152
const parsed = bencode.decode(Buffer.from(binary, 'base64'))
153153

154154
parsed.announce = `${process.env.SQ_BASE_URL}/sq/${user.uid}/announce`
155+
parsed.info.private = 1
155156

156157
await Torrent.findOneAndUpdate({ infoHash }, { $inc: { downloads: 1 } })
157158

api/src/utils/validateConfig.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const configSchema = yup
1919
SQ_BP_EARNED_PER_GB: yup.number().min(0).required(),
2020
SQ_BP_COST_PER_INVITE: yup.number().min(0).required(),
2121
SQ_BP_COST_PER_GB: yup.number().min(0).required(),
22+
SQ_SITE_WIDE_FREELEECH: yup.boolean().required(),
2223
SQ_TORRENT_CATEGORIES: yup
2324
.array()
2425
.of(yup.string())

client/pages/_app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,11 @@ const SqTracker = ({ Component, pageProps, initialTheme }) => {
247247
>
248248
<Menu size={24} />
249249
</Button>
250-
{loading && <Loading size={24} />}
250+
{loading && (
251+
<Box mr={3}>
252+
<Loading size={24} />
253+
</Box>
254+
)}
251255
{SQ_SITE_WIDE_FREELEECH === true && (
252256
<Text
253257
icon={Bell}

client/pages/torrent/[infoHash].js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,11 @@ const Torrent = ({ token, torrent, userId, userRole, uid }) => {
381381
>
382382
<Text as="h1" mb={[4, 0]}>
383383
{torrent.name}
384+
{(torrent.freeleech || SQ_SITE_WIDE_FREELEECH === true) && (
385+
<Text as="span" fontSize={3} color="primary" ml={3}>
386+
FL!
387+
</Text>
388+
)}
384389
</Text>
385390
<Box display="flex" alignItems="center" ml={3}>
386391
{(userRole === 'admin' || userId === torrent.uploadedBy._id) && (

0 commit comments

Comments
 (0)