feat: add share url alias /s
This commit is contained in:
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user