fix: allow more variables on view
This commit is contained in:
parent
55bd72aef8
commit
9f534e18c8
1 changed files with 5 additions and 15 deletions
|
@ -173,29 +173,16 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||||
where: {
|
where: {
|
||||||
OR: [{ name: id }, { invisible: { invis: id } }],
|
OR: [{ name: id }, { invisible: { invis: id } }],
|
||||||
},
|
},
|
||||||
select: {
|
|
||||||
mimetype: true,
|
|
||||||
id: true,
|
|
||||||
name: true,
|
|
||||||
invisible: true,
|
|
||||||
userId: true,
|
|
||||||
createdAt: true,
|
|
||||||
password: true,
|
|
||||||
embed: true,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
if (!file) return { notFound: true };
|
if (!file) return { notFound: true };
|
||||||
|
|
||||||
const user = await prisma.user.findFirst({
|
const user = await prisma.user.findFirst({
|
||||||
select: {
|
|
||||||
username: true,
|
|
||||||
id: true,
|
|
||||||
embed: true,
|
|
||||||
},
|
|
||||||
where: {
|
where: {
|
||||||
id: file.userId,
|
id: file.userId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
delete user.password;
|
||||||
|
delete user.totpSecret;
|
||||||
|
|
||||||
// @ts-ignore workaround because next wont allow date
|
// @ts-ignore workaround because next wont allow date
|
||||||
file.createdAt = file.createdAt.toString();
|
file.createdAt = file.createdAt.toString();
|
||||||
|
@ -227,6 +214,8 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||||
const data = await datasource.get(file.name);
|
const data = await datasource.get(file.name);
|
||||||
if (!data) return { notFound: true };
|
if (!data) return { notFound: true };
|
||||||
|
|
||||||
|
delete file.password;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
file,
|
file,
|
||||||
|
@ -234,6 +223,7 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const pass = file.password ? true : false;
|
const pass = file.password ? true : false;
|
||||||
delete file.password;
|
delete file.password;
|
||||||
return {
|
return {
|
||||||
|
|
Loading…
Reference in a new issue