diff --git a/css/index.scss b/css/index.scss
index 331f72d..02528b1 100644
--- a/css/index.scss
+++ b/css/index.scss
@@ -18,6 +18,10 @@ img {
max-width: 75%;
}
+h3 {
+ margin: 0em;
+}
+
.main {
display: flex;
flex-direction: column;
@@ -189,4 +193,21 @@ img {
.detail-buttons {
display: flex;
flex-direction: row;
+}
+
+.userprofile {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ div {
+ display: flex;
+ flex-direction: row;
+ align-items: start;
+ margin-left: 0.5em;
+ div {
+ flex-direction: column;
+ }
+ }
+ margin-top: 1em;
+ width: 75%;
}
\ No newline at end of file
diff --git a/index.tsx b/index.tsx
index 044c3a1..5fab6ab 100644
--- a/index.tsx
+++ b/index.tsx
@@ -58,7 +58,7 @@ app.use(async (ctx, next) => {
}
let rizz;
try {
- rizz = await mod.default(ctx.request.url.searchParams);
+ rizz = await mod.default(ctx.request.url.searchParams, ctx);
} catch (e) {
console.error(e);
mod = await import("./routes/500.tsx");
diff --git a/routes/404.tsx b/routes/404.tsx
index 74bef58..ed59f88 100644
--- a/routes/404.tsx
+++ b/routes/404.tsx
@@ -1,12 +1,16 @@
import { h } from "../jsx.ts";
+import { Context } from "../oak.ts";
import Base from "../templates/Base.tsx";
-export default () => (
-
-
-
404
-
Page not found.
-
-
-);
+export default (_: unknown, ctx: Context) => {
+ ctx.response.status = 404;
+ return (
+
+
+
404
+
Page not found.
+
+
+ );
+};
diff --git a/routes/story.tsx b/routes/story.tsx
index 826c601..80d5d5a 100644
--- a/routes/story.tsx
+++ b/routes/story.tsx
@@ -1,4 +1,5 @@
import { h } from "../jsx.ts";
+import { Context } from "../oak.ts";
import Story from "../templates/Story.tsx";
import watt from "../wattpad.ts";
@@ -9,8 +10,8 @@ import StoryButtonScript from "../scripts/Story.ts";
import StoryProgressSavingScript from "../scripts/StoryProgressSaving.ts";
import ScrollHeader from "../scripts/ScrollHeader.ts";
-export default async (params: URLSearchParams) => {
- if (!params.get("id")) return ;
+export default async (params: URLSearchParams, ctx: Context) => {
+ if (!params.get("id")) return FourOhFour(undefined, ctx);
const story = await watt.getStory(params.get("id") as string, false);
@@ -102,7 +103,7 @@ export default async (params: URLSearchParams) => {
Author:{" "}
{story.storyJSON.user.fullname
? story.storyJSON.user.fullname
diff --git a/routes/user.tsx b/routes/user.tsx
new file mode 100644
index 0000000..d086c5d
--- /dev/null
+++ b/routes/user.tsx
@@ -0,0 +1,53 @@
+import { h } from "../jsx.ts";
+import watt, { watt as originalWatt } from "../wattpad.ts";
+import { User } from "../wattpad.ts";
+import { Context } from "../oak.ts";
+
+import Base from "../templates/Base.tsx";
+
+import FourOhFour from "./404.tsx";
+
+export default async (params: URLSearchParams, ctx: Context) => {
+ const name = params.get("name");
+ if (!name) {
+ throw "deez";
+ }
+
+ const user = new User(originalWatt.session, name);
+ try {
+ await user.init();
+ } catch {
+ return FourOhFour(undefined, ctx);
+ }
+
+ return (
+
+
+
+
+
+
+
+ {user.displayName === ""
+ ? user.username
+ : user.displayName}
+
+ {user.displayName === ""
+ ? undefined
+ : user.username}
+
+
+
+ {user.description
+ ? user.description.replaceAll("\n", "
")
+ : undefined}
+
+
+
+
+ );
+};
diff --git a/wattpad.ts b/wattpad.ts
index 2223903..259f0b4 100644
--- a/wattpad.ts
+++ b/wattpad.ts
@@ -30,6 +30,7 @@ setInterval(() => {
export { watt };
export default {
+ getUser: watt.getUser,
search: watt.search,
async getStory(
id: string,
@@ -43,7 +44,7 @@ export default {
};
await cache[id].story.init();
cache[id].story.storyJSON.description = cache[id].story.storyJSON
- .description.replace(
+ .description.replaceAll(
"\n",
"
",
);