Pyright and README tweaks

This commit is contained in:
Phin 2024-02-10 12:41:18 +05:30
parent 83c21ad526
commit 69eef9e94a
3 changed files with 7 additions and 7 deletions

View file

@ -219,8 +219,8 @@ services:
DRPP_UID: 1000 DRPP_UID: 1000
DRPP_GID: 1000 DRPP_GID: 1000
volumes: volumes:
- ./data:/app/data
- /run/user/1000:/run/app - /run/user/1000:/run/app
- ./drpp:/app/data
``` ```
### Containerised Discord ### Containerised Discord
@ -252,8 +252,8 @@ services:
image: ghcr.io/phin05/discord-rich-presence-plex:latest image: ghcr.io/phin05/discord-rich-presence-plex:latest
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- ./kasmcord:/run/app:ro
- ./drpp:/app/data - ./drpp:/app/data
- ./kasmcord:/run/app:ro
depends_on: depends_on:
- kasmcord - kasmcord
``` ```

View file

@ -30,10 +30,10 @@ class DiscordIpcService:
for pipe in self.pipes: for pipe in self.pipes:
try: try:
if isUnix: if isUnix:
self.pipeReader, self.pipeWriter = await asyncio.open_unix_connection(pipe) # pyright: ignore[reportGeneralTypeIssues,reportUnknownMemberType] self.pipeReader, self.pipeWriter = await asyncio.open_unix_connection(pipe) # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType]
else: else:
self.pipeReader = asyncio.StreamReader() self.pipeReader = asyncio.StreamReader()
self.pipeWriter = (await self.loop.create_pipe_connection(lambda: asyncio.StreamReaderProtocol(self.pipeReader), pipe))[0] # pyright: ignore[reportGeneralTypeIssues,reportUnknownMemberType] self.pipeWriter = (await self.loop.create_pipe_connection(lambda: asyncio.StreamReaderProtocol(self.pipeReader), pipe))[0] # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType,reportArgumentType]
self.write(0, { "v": 1, "client_id": discordClientID }) self.write(0, { "v": 1, "client_id": discordClientID })
if await self.read(): if await self.read():
self.connected = True self.connected = True

View file

@ -7,7 +7,7 @@ if isInContainer:
if not os.path.isdir(runtimeDirectory): if not os.path.isdir(runtimeDirectory):
logger.error(f"Runtime directory does not exist. Ensure that it is mounted into the container at {runtimeDirectory}") logger.error(f"Runtime directory does not exist. Ensure that it is mounted into the container at {runtimeDirectory}")
exit(1) exit(1)
if os.geteuid() == 0: # pyright: ignore[reportGeneralTypeIssues,reportUnknownMemberType] if os.geteuid() == 0: # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType]
if uid == -1 or gid == -1: if uid == -1 or gid == -1:
logger.warning(f"Environment variable(s) DRPP_UID and/or DRPP_GID are/is not set. Manually ensure appropriate ownership of {runtimeDirectory}") logger.warning(f"Environment variable(s) DRPP_UID and/or DRPP_GID are/is not set. Manually ensure appropriate ownership of {runtimeDirectory}")
statResult = os.stat(runtimeDirectory) statResult = os.stat(runtimeDirectory)
@ -19,8 +19,8 @@ if isInContainer:
os.system(f"chmod 700 {runtimeDirectory}") os.system(f"chmod 700 {runtimeDirectory}")
os.system(f"chown -R {uid}:{gid} {runtimeDirectory}") os.system(f"chown -R {uid}:{gid} {runtimeDirectory}")
os.system(f"chown -R {uid}:{gid} {containerCwd}") os.system(f"chown -R {uid}:{gid} {containerCwd}")
os.setgid(gid) # pyright: ignore[reportGeneralTypeIssues,reportUnknownMemberType] os.setgid(gid) # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType]
os.setuid(uid) # pyright: ignore[reportGeneralTypeIssues,reportUnknownMemberType] os.setuid(uid) # pyright: ignore[reportAttributeAccessIssue,reportUnknownMemberType]
else: else:
logger.warning(f"Not running as the superuser. Manually ensure appropriate ownership of mounted contents") logger.warning(f"Not running as the superuser. Manually ensure appropriate ownership of mounted contents")
else: else: