mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-04 21:08:09 +03:00
fix: i'm in the misery business lets take it from the top
This commit is contained in:
@@ -50,6 +50,11 @@ export function cdnObjectKey_PRIVATE(fileLoc: string): string {
|
||||
* Pushes a file to the configured S3 Bucket. Overwrites if already exists.
|
||||
*/
|
||||
export function PushToS3_PUBLIC(path: string, content: string | Buffer) {
|
||||
if (path.startsWith("/")) {
|
||||
throw new Error(
|
||||
`no. absolutely not. Trying to do s3 push with a prefix /. this causes all sorts of trouble: ${path}`,
|
||||
);
|
||||
}
|
||||
log.debug(`Saving content on S3 at ${path}.`);
|
||||
|
||||
return S3_PUBLIC.send(
|
||||
@@ -65,6 +70,11 @@ export function PushToS3_PUBLIC(path: string, content: string | Buffer) {
|
||||
* Pushes a file to the configured private S3 bucket. Overwrites if already exists.
|
||||
*/
|
||||
export function PushToS3_PRIVATE(path: string, content: string | Buffer) {
|
||||
if (path.startsWith("/")) {
|
||||
throw new Error(
|
||||
`no. absolutely not. Trying to do s3 push with a prefix /. this causes all sorts of trouble: ${path}`,
|
||||
);
|
||||
}
|
||||
log.debug(`Saving content on private S3 at ${path}.`);
|
||||
|
||||
return S3_PRIVATE.send(
|
||||
@@ -80,6 +90,11 @@ export function PushToS3_PRIVATE(path: string, content: string | Buffer) {
|
||||
* Reads a file from the configured S3 bucket.
|
||||
*/
|
||||
export async function GetObjectFromS3_PUBLIC(path: string): Promise<Buffer> {
|
||||
if (path.startsWith("/")) {
|
||||
throw new Error(
|
||||
`no. absolutely not. Trying to do s3 get with a prefix /. this causes all sorts of trouble: ${path}`,
|
||||
);
|
||||
}
|
||||
const response = await S3_PUBLIC.send(
|
||||
new GetObjectCommand({
|
||||
Bucket: saveLoc.BUCKET,
|
||||
@@ -98,6 +113,11 @@ export async function GetObjectFromS3_PUBLIC(path: string): Promise<Buffer> {
|
||||
* Reads a file from the configured private S3 bucket.
|
||||
*/
|
||||
export async function GetObjectFromS3_PRIVATE(path: string): Promise<Buffer> {
|
||||
if (path.startsWith("/")) {
|
||||
throw new Error(
|
||||
`no. absolutely not. Trying to do s3 get with a prefix /. this causes all sorts of trouble: ${path}`,
|
||||
);
|
||||
}
|
||||
const response = await S3_PRIVATE.send(
|
||||
new GetObjectCommand({
|
||||
Bucket: saveLocPrivate.BUCKET,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import type { integer } from "tachi-common";
|
||||
|
||||
export function GetUSCIRReplayURL(scoreID: string) {
|
||||
return `/uscir/replays/${scoreID}`;
|
||||
return `uscir/replays/${scoreID}`;
|
||||
}
|
||||
|
||||
export function GetProfilePictureURL(userID: integer, contentHash: string) {
|
||||
return `/users/${userID}/pfp-${contentHash}`;
|
||||
return `users/${userID}/pfp-${contentHash}`;
|
||||
}
|
||||
|
||||
export function GetProfileBannerURL(userID: integer, contentHash: string) {
|
||||
return `/users/${userID}/banner-${contentHash}`;
|
||||
return `users/${userID}/banner-${contentHash}`;
|
||||
}
|
||||
|
||||
export function GetScoreImportInputURL(importID: string) {
|
||||
return `/score-import-input/${importID}`;
|
||||
return `score-import-input/${importID}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user