-
Notifications
You must be signed in to change notification settings - Fork 4
Add Solid-Relay Basic Config #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
ee39b7d
9368e5b
719d03a
7f28cc6
c1a6009
f012ea5
a6bb326
8ce8fcc
43f65ea
79d3533
5343b58
2ce9f2d
d042c37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,10 @@ | ||
| .DS_Store | ||
| *.graphql | ||
| *.graphql.ts | ||
|
|
||
| .pgdata/ | ||
|
|
||
| node_modules/ | ||
| packages/*/dist/ | ||
|
|
||
| index.db |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "src": "./src", | ||
| "schema": "./schema.graphql", | ||
| "language": "typescript", | ||
| "eagerEsModules": true | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // DrFed: A web-based platform for developing and debugging ActivityPub apps | ||
| // Copyright (C) 2026 DrFed team | ||
| // | ||
| // This program is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU Affero General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
| // | ||
| // This program is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU Affero General Public License for more details. | ||
| // | ||
| // You should have received a copy of the GNU Affero General Public License | ||
| // along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| import { | ||
| Environment, | ||
| type FetchFunction, | ||
| Network, | ||
| RecordSource, | ||
| Store, | ||
| } from "relay-runtime"; | ||
|
|
||
| // oxlint-disable no-async-await | ||
| const fetchFn: FetchFunction = async (params, variables) => { | ||
| const response = await fetch("http://0.0.0.0:8888/graphql", { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it should be configurable? |
||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| }, | ||
| body: JSON.stringify({ | ||
| query: params.text, | ||
| variables, | ||
| }), | ||
| }); | ||
|
|
||
| // oxlint-disable return-await no-unsafe-return | ||
| return await response.json(); | ||
| }; | ||
|
|
||
| export function createRelayEnvironment() { | ||
| return new Environment({ | ||
| network: Network.create(fetchFn), | ||
| store: new Store(new RecordSource()), | ||
| }); | ||
| } | ||
|
dodok8 marked this conversation as resolved.
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,15 +15,37 @@ | |
| // along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
|
|
||
| import { Title } from "@solidjs/meta"; | ||
| import { graphql } from "relay-runtime"; | ||
| import { Show } from "solid-js"; | ||
| import { createLazyLoadQuery } from "solid-relay"; | ||
|
|
||
| import Counter from "~/components/Counter"; | ||
| import type { HomeViewerQuery } from "./__generated__/HomeViewerQuery.graphql"; | ||
|
|
||
| const homeViewerQuery = graphql` | ||
| query HomeViewerQuery { | ||
| viewer { | ||
| name | ||
| admin | ||
| } | ||
| } | ||
| `; | ||
|
|
||
| export default function Home() { | ||
| const query = createLazyLoadQuery<HomeViewerQuery>(homeViewerQuery, {}); | ||
|
|
||
| return ( | ||
| <main> | ||
| <Title>Hello World</Title> | ||
| <h1>Hello world!</h1> | ||
| <Counter /> | ||
| <Show when={query()?.viewer} fallback={<p>로그인되지 않았습니다.</p>}> | ||
| {(viewer) => ( | ||
| <p> | ||
| {viewer().name} | ||
| {viewer().admin ? " (관리자)" : ""} | ||
|
Comment on lines
+40
to
+44
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, it's okay to write UI messages in Korean right now, but we should eventually write them in English (or properly internationalize them).
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe just |
||
| </p> | ||
| )} | ||
| </Show> | ||
|
|
||
| <p> | ||
| Visit{" "} | ||
| <a href="https://start.solidjs.com" target="_blank"> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.