-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
105 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { apiClient } from "@/app/apiClient"; | ||
|
||
export const GET = async (_request: Request) => { | ||
const { my_user: loggedInUser } = await apiClient.getSite(); | ||
|
||
if (!loggedInUser) { | ||
return Response.json({ status: "not_authorized" }, { status: 401 }); | ||
} | ||
|
||
const res = await apiClient.exportSettings(); | ||
|
||
const fileName = `export_${new URL(loggedInUser.local_user_view.person.actor_id).hostname}_${loggedInUser.local_user_view.person.name}_${Number(new Date())}.json`; | ||
return Response.json(res, { | ||
headers: { "Content-Disposition": `attachment; filename=${fileName}` }, | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
"use client"; | ||
|
||
import { MyUserInfo } from "lemmy-js-client"; | ||
import { updateSettingsAction } from "@/app/settings/userActions"; | ||
|
||
export const BlocksForm = (props: { readonly loggedInUser: MyUserInfo }) => { | ||
return ( | ||
<form | ||
action={updateSettingsAction} | ||
className={"flex max-w-96 flex-col gap-4"} | ||
> | ||
<h1 className={"text-xl font-bold"}>{"Blocks"}</h1> | ||
<p>{"(NOT IMPLEMENTED YET)"}</p> | ||
</form> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use client"; | ||
|
||
import { MyUserInfo } from "lemmy-js-client"; | ||
import { importSettingsAction } from "@/app/settings/userActions"; | ||
import { SubmitButton } from "@/app/(ui)/button/SubmitButton"; | ||
import { Input } from "@/app/(ui)/form/Input"; | ||
import { ButtonLink } from "@/app/(ui)/button/ButtonLink"; | ||
|
||
export const ExportImportForm = (props: { | ||
readonly loggedInUser: MyUserInfo; | ||
}) => { | ||
return ( | ||
<form | ||
action={importSettingsAction} | ||
className={"flex max-w-96 flex-col gap-4"} | ||
> | ||
<h1 className={"text-xl font-bold"}>{"Import/export settings"}</h1> | ||
<p>{"Import and export your account settings as JSON"}</p> | ||
<label> | ||
{"Export"} | ||
<ButtonLink | ||
download={`export_${new URL(props.loggedInUser.local_user_view.person.actor_id).hostname}_${props.loggedInUser.local_user_view.person.name}_${Number(new Date())}.json`} | ||
href={"/next/api/settings/export.json"} | ||
> | ||
{"Export"} | ||
</ButtonLink> | ||
</label> | ||
<div className={"border-t border-dashed border-neutral-700 pt-2"}> | ||
<label>{"Import (NOT IMPLEMENTED YET)"}</label> | ||
<Input | ||
disabled={true} | ||
id={"imported_file"} | ||
name={"imported_file"} | ||
required={true} | ||
type={"file"} | ||
/> | ||
<SubmitButton className={"mt-2 w-full"} disabled={true}> | ||
{"Import"} | ||
</SubmitButton> | ||
</div> | ||
</form> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters