mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-06-30 06:30:11 +02:00
feat: add share url alias /s
This commit is contained in:
parent
7827b687fa
commit
231a2e95b9
|
@ -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,
|
||||
|
|
|
@ -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[])
|
||||
|
|
|
@ -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: (
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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 && (
|
||||
<>
|
||||
|
|
|
@ -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([]),
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -132,7 +132,7 @@ const MyShares = () => {
|
|||
onClick={() => {
|
||||
if (window.isSecureContext) {
|
||||
clipboard.copy(
|
||||
`${config.get("general.appUrl")}/share/${
|
||||
`${config.get("general.appUrl")}/s/${
|
||||
share.id
|
||||
}`
|
||||
);
|
||||
|
|
18
frontend/src/pages/s/[shareId].ts
Normal file
18
frontend/src/pages/s/[shareId].ts
Normal 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user