on master help sign in
pages/ids: loosen for desig'd input
7b7a34bMatilde Park
pages/ids/[id].js+10−6
@@ -16,7 +16,8 @@ import Description from "../../components/gateway/Description";
16import axios from "axios";
16import axios from "axios";
17
17
18const IdPage = ({ data, markdown, applications, groups, network, params }) => {
18const IdPage = ({ data, markdown, applications, groups, network, params }) => {
19− const { id } = params;
19+ let { id } = params;
20+ id = `~${deSig(id)}`;
20 if (!ob.isValidPatp(id) || id.length > 14) {
21 if (!ob.isValidPatp(id) || id.length > 14) {
21 return <Gateway404 type="ID" />;
22 return <Gateway404 type="ID" />;
22 }
23 }
@@ -199,24 +200,27 @@ export const getServerSideProps = async ({ params, res }) => {
199 "public, s-maxage=3600, stale-while-revalidate=604800"
200 "public, s-maxage=3600, stale-while-revalidate=604800"
200 );
201 );
201
202
203+ let { id } = params;
204+ id = `~${deSig(id)}`;
205+
202 let { data, content } = getPage(
206 let { data, content } = getPage(
203− join(process.cwd(), "content/ids/", params.id.slice(1))
207+ join(process.cwd(), "content/ids/", id.slice(1))
204 ) || { data: {}, content: "" };
208 ) || { data: {}, content: "" };
205
209
206 const applications = getAllPosts(
210 const applications = getAllPosts(
207 ["title", "slug", "image", "bgColor"],
211 ["title", "slug", "image", "bgColor"],
208 `applications/${params.id}`
212 `applications/${params.id}`
209 );
213 );
210− const groups = getAllPosts(["title", "slug", "tile"], `groups/${params.id}`);
214+ const groups = getAllPosts(["title", "slug", "tile"], `groups/${id}`);
211
215
212− if (!data.ship && ob.isValidPatp(params.id)) {
216+ if (!data.ship && ob.isValidPatp(id)) {
213− data = { ship: params.id, description: "An Urbit ID." };
217+ data = { ship: id, description: "An Urbit ID." };
214 }
218 }
215
219
216 let network = await axios
220 let network = await axios
217 .get(
221 .get(
218 `https://mt2aga2c5l.execute-api.us-east-2.amazonaws.com/get-node?urbit-id=${
222 `https://mt2aga2c5l.execute-api.us-east-2.amazonaws.com/get-node?urbit-id=${
219− ob.isValidPatp(params.id) ? params.id : "~zod"
223+ ob.isValidPatp(id) ? id : "~zod"
220 }`
224 }`
221 )
225 )
222 .then((res) => res.data);
226 .then((res) => res.data);