mirror of
https://github.com/stonith404/pingvin-share.git
synced 2024-07-02 07:20:38 +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"))
|
if (!this.config.get("email.enableShareEmailRecipients"))
|
||||||
throw new InternalServerErrorException("Email service disabled");
|
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(
|
await this.sendMail(
|
||||||
recipientEmail,
|
recipientEmail,
|
||||||
|
@ -75,7 +75,7 @@ export class EmailService {
|
||||||
}
|
}
|
||||||
|
|
||||||
async sendMailToReverseShareCreator(recipientEmail: string, shareId: string) {
|
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(
|
await this.sendMail(
|
||||||
recipientEmail,
|
recipientEmail,
|
||||||
|
|
|
@ -15,7 +15,7 @@ const showShareInformationsModal = (
|
||||||
maxShareSize: number
|
maxShareSize: number
|
||||||
) => {
|
) => {
|
||||||
const t = translateOutsideContext();
|
const t = translateOutsideContext();
|
||||||
const link = `${appUrl}/share/${share.id}`;
|
const link = `${appUrl}/s/${share.id}`;
|
||||||
|
|
||||||
let shareSize: number = 0;
|
let shareSize: number = 0;
|
||||||
for (let file of share.files as FileMetaData[])
|
for (let file of share.files as FileMetaData[])
|
||||||
|
|
|
@ -8,7 +8,7 @@ const showShareLinkModal = (
|
||||||
appUrl: string
|
appUrl: string
|
||||||
) => {
|
) => {
|
||||||
const t = translateOutsideContext();
|
const t = translateOutsideContext();
|
||||||
const link = `${appUrl}/share/${shareId}`;
|
const link = `${appUrl}/s/${shareId}`;
|
||||||
return modals.openModal({
|
return modals.openModal({
|
||||||
title: t("account.shares.modal.share-link"),
|
title: t("account.shares.modal.share-link"),
|
||||||
children: (
|
children: (
|
||||||
|
|
|
@ -30,7 +30,7 @@ const Body = ({ share, appUrl }: { share: Share; appUrl: string }) => {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const t = useTranslate();
|
const t = useTranslate();
|
||||||
|
|
||||||
const link = `${appUrl}/share/${share.id}`;
|
const link = `${appUrl}/s/${share.id}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Stack align="stretch">
|
<Stack align="stretch">
|
||||||
|
|
|
@ -168,8 +168,7 @@ const CreateUploadModalBody = ({
|
||||||
color: theme.colors.gray[6],
|
color: theme.colors.gray[6],
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{options.appUrl}/share/
|
{`${options.appUrl}/s/${form.values.link}`}
|
||||||
{form.values.link == "" ? "myAwesomeShare" : form.values.link}
|
|
||||||
</Text>
|
</Text>
|
||||||
{!options.isReverseShare && (
|
{!options.isReverseShare && (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -14,7 +14,7 @@ export const config = {
|
||||||
export async function middleware(request: NextRequest) {
|
export async function middleware(request: NextRequest) {
|
||||||
const routes = {
|
const routes = {
|
||||||
unauthenticated: new Routes(["/auth/*", "/"]),
|
unauthenticated: new Routes(["/auth/*", "/"]),
|
||||||
public: new Routes(["/share/*", "/upload/*"]),
|
public: new Routes(["/share/*", "/s/*", "/upload/*"]),
|
||||||
admin: new Routes(["/admin/*"]),
|
admin: new Routes(["/admin/*"]),
|
||||||
account: new Routes(["/account*"]),
|
account: new Routes(["/account*"]),
|
||||||
disabled: new Routes([]),
|
disabled: new Routes([]),
|
||||||
|
|
|
@ -159,7 +159,7 @@ const MyShares = () => {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (window.isSecureContext) {
|
if (window.isSecureContext) {
|
||||||
clipboard.copy(
|
clipboard.copy(
|
||||||
`${appUrl}/share/${share.id}`
|
`${appUrl}/s/${share.id}`
|
||||||
);
|
);
|
||||||
toast.success(t("common.notify.copied"));
|
toast.success(t("common.notify.copied"));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -132,7 +132,7 @@ const MyShares = () => {
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (window.isSecureContext) {
|
if (window.isSecureContext) {
|
||||||
clipboard.copy(
|
clipboard.copy(
|
||||||
`${config.get("general.appUrl")}/share/${
|
`${config.get("general.appUrl")}/s/${
|
||||||
share.id
|
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