1
0
mirror of https://github.com/stonith404/pingvin-share.git synced 2024-06-27 13:20:48 +02:00

feat: add share url alias /s

This commit is contained in:
Elias Schneider 2023-07-22 16:09:10 +02:00
parent 7827b687fa
commit 231a2e95b9
No known key found for this signature in database
GPG Key ID: 07E623B294202B6C
9 changed files with 27 additions and 10 deletions

View File

@ -54,7 +54,7 @@ export class EmailService {
if (!this.config.get("email.enableShareEmailRecipients"))
throw new InternalServerErrorException("Email service disabled");
const shareUrl = `${this.config.get("general.appUrl")}/share/${shareId}`;
const shareUrl = `${this.config.get("general.appUrl")}/s/${shareId}`;
await this.sendMail(
recipientEmail,
@ -75,7 +75,7 @@ export class EmailService {
}
async sendMailToReverseShareCreator(recipientEmail: string, shareId: string) {
const shareUrl = `${this.config.get("general.appUrl")}/share/${shareId}`;
const shareUrl = `${this.config.get("general.appUrl")}/s/${shareId}`;
await this.sendMail(
recipientEmail,

View File

@ -15,7 +15,7 @@ const showShareInformationsModal = (
maxShareSize: number
) => {
const t = translateOutsideContext();
const link = `${appUrl}/share/${share.id}`;
const link = `${appUrl}/s/${share.id}`;
let shareSize: number = 0;
for (let file of share.files as FileMetaData[])

View File

@ -8,7 +8,7 @@ const showShareLinkModal = (
appUrl: string
) => {
const t = translateOutsideContext();
const link = `${appUrl}/share/${shareId}`;
const link = `${appUrl}/s/${shareId}`;
return modals.openModal({
title: t("account.shares.modal.share-link"),
children: (

View File

@ -30,7 +30,7 @@ const Body = ({ share, appUrl }: { share: Share; appUrl: string }) => {
const router = useRouter();
const t = useTranslate();
const link = `${appUrl}/share/${share.id}`;
const link = `${appUrl}/s/${share.id}`;
return (
<Stack align="stretch">

View File

@ -168,8 +168,7 @@ const CreateUploadModalBody = ({
color: theme.colors.gray[6],
})}
>
{options.appUrl}/share/
{form.values.link == "" ? "myAwesomeShare" : form.values.link}
{`${options.appUrl}/s/${form.values.link}`}
</Text>
{!options.isReverseShare && (
<>

View File

@ -14,7 +14,7 @@ export const config = {
export async function middleware(request: NextRequest) {
const routes = {
unauthenticated: new Routes(["/auth/*", "/"]),
public: new Routes(["/share/*", "/upload/*"]),
public: new Routes(["/share/*", "/s/*", "/upload/*"]),
admin: new Routes(["/admin/*"]),
account: new Routes(["/account*"]),
disabled: new Routes([]),

View File

@ -159,7 +159,7 @@ const MyShares = () => {
onClick={() => {
if (window.isSecureContext) {
clipboard.copy(
`${appUrl}/share/${share.id}`
`${appUrl}/s/${share.id}`
);
toast.success(t("common.notify.copied"));
} else {

View File

@ -132,7 +132,7 @@ const MyShares = () => {
onClick={() => {
if (window.isSecureContext) {
clipboard.copy(
`${config.get("general.appUrl")}/share/${
`${config.get("general.appUrl")}/s/${
share.id
}`
);

View File

@ -0,0 +1,18 @@
import { GetServerSidePropsContext } from "next";
// Redirect to the share page
export function getServerSideProps(context: GetServerSidePropsContext) {
const { shareId } = context.params!;
return {
props: {},
redirect: {
permanent: false,
destination: "/share/" + shareId,
},
};
}
export default function ShareAlias() {
return null;
}