Compare commits

..

No commits in common. "1434a8c35b7736a396d74572d0331f48b4d7b6a3" and "2491b0a5961d853548da78f6f211c07cc76de373" have entirely different histories.

8 changed files with 27 additions and 103 deletions

View file

@ -1,16 +0,0 @@
# Set the base image
FROM python:3.12-slim
# Set the working directory inside the container
WORKDIR /app
RUN pip install --no-cache-dir requests discord.py
# Copy the rest of the application code
COPY . .
# Expose the ports needed to access the application
EXPOSE 8080
# Specify the command to run your Python application
CMD ["python", "main.py"]

View file

@ -1,3 +0,0 @@
Simple little Discord bot that pings my internal Nitter instance with the [read only patch](https://git.gmem.ca/arch/nitter/commit/ab48e5885161880438db4b0451e8bd2e568f14b0) applied to generate links using Discord.
An alternative to fx/vxtwitter that is able to link to the full post and replies.

View file

@ -1,51 +0,0 @@
#!/usr/bin/env nix-shell
#!nix-shell -i python3 -p bash python312 python312Packages.requests python312Packages.discordpy
# permission int: 277025409024
import discord
from discord import app_commands
from urllib.parse import urlparse
import requests
import os
intents = discord.Intents.default()
client = discord.Client(intents=intents, activity=discord.Game('Swearing at Twitter'))
tree = app_commands.CommandTree(client)
@client.event
async def on_ready():
await tree.sync()
print(f'We have logged in as {client.user}')
@tree.command()
async def nitter(interaction: discord.Interaction, link: str):
"""Create a nitter.gmem.ca link"""
if link[:4] != 'http':
link = f'//{link}'
try:
urlparsed = urlparse(link)
except:
print(f'failed to parse {link}')
if 'twitter.com' not in urlparsed.netloc:
await interaction.response.send_message('invalid twitter link', ephemeral=True)
return
nitter_url = f'https://nitter.gmem.ca{urlparsed.path}'
response = requests.get(nitter_url)
# 4xx error codes
if 399 < response.status_code < 500:
await interaction.response.send_message('could not find tweet/user', ephemeral=True)
return
# 5xx error codes
if 499 < response.status_code < 600:
await interaction.response.send_message('internal nitter server error', ephemeral=True)
return
await interaction.response.send_message(nitter_url)
token = os.environ['DISCORD_BOT_TOKEN']
client.run(token)

View file

@ -29,11 +29,6 @@
];
};
};
"_acme-challenge.router" = {
txt = {
data = ["CJKnxKczldLEAy6zPkST0xeJ5Cy-xdT_ElzqMxhNh5E"];
};
};
}
// lib.attrsets.genAttrs [
# Internally hosted applications

View file

@ -239,11 +239,11 @@
]
},
"locked": {
"lastModified": 1712212014,
"narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=",
"lastModified": 1711133180,
"narHash": "sha256-WJOahf+6115+GMl3wUfURu8fszuNeJLv9qAWFQl3Vmo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b",
"rev": "1c2c5e4cabba4c43504ef0f8cc3f3dfa284e2dbb",
"type": "github"
},
"original": {
@ -260,11 +260,11 @@
"treefmt": "treefmt"
},
"locked": {
"lastModified": 1711480255,
"narHash": "sha256-CPF0+ZW3biHoWHE88bZt6a7G65X5Bxtgvw7xwLGrDJ4=",
"lastModified": 1705801181,
"narHash": "sha256-vH+n5qMnwFCx3LMON2hQMi9PjMpmTraGYXe1czJTfAg=",
"owner": "hall",
"repo": "kubenix",
"rev": "5692af23e0835e7b21ec4e2f362b5ef9ff96d893",
"rev": "76b8053b27b062b11f0c9b495050cc55606ac9dc",
"type": "github"
},
"original": {
@ -279,11 +279,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1711886936,
"narHash": "sha256-D2WENp9GuaCostvNcQ7vElekk0V5cuMdnFZ7NfRhVrQ=",
"lastModified": 1711282133,
"narHash": "sha256-s6z371miAZonduv53LQzjthvNCs4R+oTbv9cRu+iyL8=",
"owner": "nix-community",
"repo": "lib-aggregate",
"rev": "9c06929b83e57c18d125f1105ba6a423f24083d2",
"rev": "120535dff702c551ec76a125a181d90131407264",
"type": "github"
},
"original": {
@ -355,11 +355,11 @@
},
"nixlib": {
"locked": {
"lastModified": 1711846064,
"narHash": "sha256-cqfX0QJNEnge3a77VnytM0Q6QZZ0DziFXt6tSCV8ZSc=",
"lastModified": 1711241261,
"narHash": "sha256-knrTvpl81yGFHIpm1SsLDApe0thFkw1cl3ISAMPmP/0=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "90b1a963ff84dc532db92f678296ff2499a60a87",
"rev": "b2a1eeef8c185f6bd27432b053ff09d773244cbc",
"type": "github"
},
"original": {
@ -397,11 +397,11 @@
]
},
"locked": {
"lastModified": 1712191720,
"narHash": "sha256-xXtSSnVHURHsxLQO30dzCKW5NJVGV/umdQPmFjPFMVA=",
"lastModified": 1711375484,
"narHash": "sha256-+d4HqehyQvuHUKR8Nv9HGGd/SP5wjg3MA/hEYJBWQq0=",
"owner": "nix-community",
"repo": "nixos-generators",
"rev": "0c15e76bed5432d7775a22e8d22059511f59d23a",
"rev": "2b3720c7af2271be8cee713cd2f69c5127b0a8e4",
"type": "github"
},
"original": {
@ -444,11 +444,11 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1711846064,
"narHash": "sha256-cqfX0QJNEnge3a77VnytM0Q6QZZ0DziFXt6tSCV8ZSc=",
"lastModified": 1711241261,
"narHash": "sha256-knrTvpl81yGFHIpm1SsLDApe0thFkw1cl3ISAMPmP/0=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "90b1a963ff84dc532db92f678296ff2499a60a87",
"rev": "b2a1eeef8c185f6bd27432b053ff09d773244cbc",
"type": "github"
},
"original": {
@ -467,11 +467,11 @@
]
},
"locked": {
"lastModified": 1712237761,
"narHash": "sha256-NoMBBCADTms3yx5BL+sbc7vfDivNiYULO6t9GBAsPt0=",
"lastModified": 1711448229,
"narHash": "sha256-/6y7LCwrworngRqqnUCf+J1QbscCBiWrFFsz3xkY6ls=",
"owner": "nix-community",
"repo": "nixpkgs-wayland",
"rev": "9b77653338f52da4b498abdf4835efb6ff6e453e",
"rev": "d06cfad4d4684e0ed64b914d39b8f21a002a3a51",
"type": "github"
},
"original": {
@ -530,11 +530,11 @@
},
"nixpkgs_5": {
"locked": {
"lastModified": 1712192574,
"narHash": "sha256-LbbVOliJKTF4Zl2b9salumvdMXuQBr2kuKP5+ZwbYq4=",
"lastModified": 1711370797,
"narHash": "sha256-2xu0jVSjuKhN97dqc4bVtvEH52Rwh6+uyI1XCnzoUyI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "f480f9d09e4b4cf87ee6151eba068197125714de",
"rev": "c726225724e681b3626acc941c6f95d2b0602087",
"type": "github"
},
"original": {

View file

@ -54,7 +54,7 @@
owner = "octodns";
repo = pname;
rev = "main";
sha256 = "sha256-KVdH55wkTk2n2t/Y+n9+/5SCk3ml8vXIlFbtmOL4DlA=";
sha256 = "sha256-NSA6loxfvhlqzWJ77kLQQzseRNR5E/sVOxsusf3ATts=";
};
doCheck = false;
propagatedBuildInputs = with pkgs.python3Packages; [

View file

@ -15,7 +15,7 @@
(import ./immich.nix)
(import ./endpoints.nix)
(import ./homepage.nix)
# (import ./pterodactyl.nix)
(import ./pterodactyl.nix)
(import ./cloudflare-exporter.nix)
(import ./piped.nix)
(import ./conduit.nix)
@ -24,6 +24,5 @@
(import ./nitter.nix)
(import ./changedetection.nix)
(import ./nextdns-exporter.nix)
(import ./nitter-bot.nix)
];
}

View file

@ -409,7 +409,7 @@
trustedInterfaces = ["tailscale0"];
checkReversePath = "loose";
enable = true;
allowedTCPPorts = [22 80 443 9798 2049 4328];
allowedTCPPorts = [22 80 443 9798 2049];
allowedUDPPorts = [41641];
};
nftables.enable = true;