From c7de224a22f0880a2c70afcbe05a9abfa204ae0a Mon Sep 17 00:00:00 2001 From: syui Date: Wed, 23 Oct 2024 19:52:36 +0900 Subject: [PATCH] fix --- .gitignore | 1 + .../python-oauth-web-app/templates/base.html | 40 ------- .../python-oauth-web-app/templates/home.html | 15 --- docker/rust-bbs/templates/index.html | 67 ----------- .../Public/player.html | 0 .../python-oauth-web-app/Dockerfile | 2 +- github/python-oauth-web-app/app_add.py | 3 + .../python-oauth-web-app/compose.yml | 2 +- .../python-oauth-web-app/templates/about.html | 18 +++ .../python-oauth-web-app/templates/base.html | 106 ++++++++++++++++++ .../templates/bsky_post.html | 8 ++ .../python-oauth-web-app/templates/error.html | 13 +++ .../python-oauth-web-app/templates/home.html | 25 +++++ .../python-oauth-web-app/templates/login.html | 15 +++ {docker => github}/restreamer/compose.yaml | 0 {docker => github}/rust-bbs/Cargo.toml | 0 {docker => github}/rust-bbs/Dockerfile | 5 +- {docker => github}/rust-bbs/compose.yml | 2 +- {docker => github}/rust-bbs/src/main.rs | 40 +++---- github/rust-bbs/templates/index.html | 77 +++++++++++++ .../rust-bbs/templates/post.html | 0 {slidev => github/slidev}/.gitignore | 0 {slidev => github/slidev}/.npmrc | 0 {slidev => github/slidev}/README.md | 0 .../slidev}/components/Counter.vue | 0 {slidev => github/slidev}/netlify.toml | 0 {slidev => github/slidev}/package.json | 0 .../slidev}/pages/imported-slides.md | 0 {slidev => github/slidev}/slides.md | 0 .../slidev}/snippets/external.ts | 0 {slidev => github/slidev}/vercel.json | 0 {issue/screenshots => img}/issue-9-0001.png | Bin {issue/screenshots => img}/issue-9-0002.png | Bin {issue/screenshots => img}/issue-9-0003.png | Bin {issue/screenshots => img}/issue-9-0004.png | Bin 35 files changed, 292 insertions(+), 147 deletions(-) delete mode 100644 docker/python-oauth-web-app/templates/base.html delete mode 100644 docker/python-oauth-web-app/templates/home.html delete mode 100644 docker/rust-bbs/templates/index.html rename {docker => github}/PixelStreamingInfrastructure/Public/player.html (100%) rename {docker => github}/python-oauth-web-app/Dockerfile (69%) create mode 100644 github/python-oauth-web-app/app_add.py rename {docker => github}/python-oauth-web-app/compose.yml (75%) create mode 100644 github/python-oauth-web-app/templates/about.html create mode 100644 github/python-oauth-web-app/templates/base.html create mode 100644 github/python-oauth-web-app/templates/bsky_post.html create mode 100644 github/python-oauth-web-app/templates/error.html create mode 100644 github/python-oauth-web-app/templates/home.html create mode 100644 github/python-oauth-web-app/templates/login.html rename {docker => github}/restreamer/compose.yaml (100%) rename {docker => github}/rust-bbs/Cargo.toml (100%) rename {docker => github}/rust-bbs/Dockerfile (54%) rename {docker => github}/rust-bbs/compose.yml (81%) rename {docker => github}/rust-bbs/src/main.rs (82%) create mode 100644 github/rust-bbs/templates/index.html rename {docker => github}/rust-bbs/templates/post.html (100%) rename {slidev => github/slidev}/.gitignore (100%) rename {slidev => github/slidev}/.npmrc (100%) rename {slidev => github/slidev}/README.md (100%) rename {slidev => github/slidev}/components/Counter.vue (100%) rename {slidev => github/slidev}/netlify.toml (100%) rename {slidev => github/slidev}/package.json (100%) rename {slidev => github/slidev}/pages/imported-slides.md (100%) rename {slidev => github/slidev}/slides.md (100%) rename {slidev => github/slidev}/snippets/external.ts (100%) rename {slidev => github/slidev}/vercel.json (100%) rename {issue/screenshots => img}/issue-9-0001.png (100%) rename {issue/screenshots => img}/issue-9-0002.png (100%) rename {issue/screenshots => img}/issue-9-0003.png (100%) rename {issue/screenshots => img}/issue-9-0004.png (100%) diff --git a/.gitignore b/.gitignore index 73008fa..227c809 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ *.sqlite *.lock *target +*.db diff --git a/docker/python-oauth-web-app/templates/base.html b/docker/python-oauth-web-app/templates/base.html deleted file mode 100644 index 08c0a6f..0000000 --- a/docker/python-oauth-web-app/templates/base.html +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - atproto OAuth Web Service Example - - -
-
- {% if g.user %} - {% endif %} -
- -
-
-
- {% for message in get_flashed_messages() %} -
{{ message }}
- {% endfor %} - {% block content %}{% endblock %} -
-
- - diff --git a/docker/python-oauth-web-app/templates/home.html b/docker/python-oauth-web-app/templates/home.html deleted file mode 100644 index 80ced36..0000000 --- a/docker/python-oauth-web-app/templates/home.html +++ /dev/null @@ -1,15 +0,0 @@ -{% extends 'base.html' %} -{% block content %} -{% if g.user %} -
- -
-@{{ g.user['handle'] }} -
- -
- -{% else %} -

Login to get started!

-{% endif %} -{% endblock %} diff --git a/docker/rust-bbs/templates/index.html b/docker/rust-bbs/templates/index.html deleted file mode 100644 index fbe4b49..0000000 --- a/docker/rust-bbs/templates/index.html +++ /dev/null @@ -1,67 +0,0 @@ - - - - Simple BBS - - - -
- - - -
- - - - - - - diff --git a/docker/PixelStreamingInfrastructure/Public/player.html b/github/PixelStreamingInfrastructure/Public/player.html similarity index 100% rename from docker/PixelStreamingInfrastructure/Public/player.html rename to github/PixelStreamingInfrastructure/Public/player.html diff --git a/docker/python-oauth-web-app/Dockerfile b/github/python-oauth-web-app/Dockerfile similarity index 69% rename from docker/python-oauth-web-app/Dockerfile rename to github/python-oauth-web-app/Dockerfile index 86e031f..42dcf64 100644 --- a/docker/python-oauth-web-app/Dockerfile +++ b/github/python-oauth-web-app/Dockerfile @@ -4,4 +4,4 @@ WORKDIR /app COPY . . RUN pacman -Syu rye --noconfirm RUN rye sync -#CMD ["rye", "run", "flask", "run"] + diff --git a/github/python-oauth-web-app/app_add.py b/github/python-oauth-web-app/app_add.py new file mode 100644 index 0000000..f8e0492 --- /dev/null +++ b/github/python-oauth-web-app/app_add.py @@ -0,0 +1,3 @@ +@app.route("/about") +def aboutpage(): + return render_template("about.html") diff --git a/docker/python-oauth-web-app/compose.yml b/github/python-oauth-web-app/compose.yml similarity index 75% rename from docker/python-oauth-web-app/compose.yml rename to github/python-oauth-web-app/compose.yml index 58fa04b..f915dd5 100644 --- a/docker/python-oauth-web-app/compose.yml +++ b/github/python-oauth-web-app/compose.yml @@ -7,4 +7,4 @@ services: - "5000:5000" volumes: - ./demo.sqlite:/app/demo.sqlite - command: rye run flask run + command: rye run flask run --host=0.0.0.0 diff --git a/github/python-oauth-web-app/templates/about.html b/github/python-oauth-web-app/templates/about.html new file mode 100644 index 0000000..e3fb71e --- /dev/null +++ b/github/python-oauth-web-app/templates/about.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} +{% block content %} + +

about

+

This service allows you to comment on live broadcasts using your atproto account.

+
+

このサービスはlive配信にatprotoアカウントを使ってコメントができます。

+ +

system

+

Display posts to BBS using atproto oauth.

+

This service is generated using bluesky/cookbook.

+

Authentication information will be deleted periodically.

+
+

atproto oauthを使用してbbsへの書き込みを許可します。

+

このサービスはbluesky/cookbookを使用して生成されています。

+

認証情報は定期的に削除されます。

+ +{% endblock %} diff --git a/github/python-oauth-web-app/templates/base.html b/github/python-oauth-web-app/templates/base.html new file mode 100644 index 0000000..34a0501 --- /dev/null +++ b/github/python-oauth-web-app/templates/base.html @@ -0,0 +1,106 @@ + + + + + + + + o.syui.ai | oauth service atproto + + +
+
+ {% if g.user %} + {% endif %} +
+ +
+ +
+
+ {% for message in get_flashed_messages() %} +
{{ message }}
+ {% endfor %} + {% block content %}{% endblock %} +
+
+ + + + + diff --git a/github/python-oauth-web-app/templates/bsky_post.html b/github/python-oauth-web-app/templates/bsky_post.html new file mode 100644 index 0000000..acec60e --- /dev/null +++ b/github/python-oauth-web-app/templates/bsky_post.html @@ -0,0 +1,8 @@ +{% extends 'base.html' %} + +{% block content %} +
+ + +
+{% endblock %} diff --git a/github/python-oauth-web-app/templates/error.html b/github/python-oauth-web-app/templates/error.html new file mode 100644 index 0000000..76fc860 --- /dev/null +++ b/github/python-oauth-web-app/templates/error.html @@ -0,0 +1,13 @@ +{% extends 'base.html' %} + +{% block title %}Error{% endblock %} + +{% block content %} +

⚠️ Error {{ status_code }} ⚠️

+{% if err.description %} +

{{ err.description }}

+{% else %} +

Something went wrong!

+{% endif %} +

Start Over

+{% endblock %} diff --git a/github/python-oauth-web-app/templates/home.html b/github/python-oauth-web-app/templates/home.html new file mode 100644 index 0000000..a0b1a06 --- /dev/null +++ b/github/python-oauth-web-app/templates/home.html @@ -0,0 +1,25 @@ +{% extends 'base.html' %} +{% block content %} + +
+
+
+ +
+
+
+ {% if g.user %} + @{{ g.user['handle'] }} +
+ +
+ {% else %} +
+ + +
+ {% endif %} +
+
+ +{% endblock %} diff --git a/github/python-oauth-web-app/templates/login.html b/github/python-oauth-web-app/templates/login.html new file mode 100644 index 0000000..a000403 --- /dev/null +++ b/github/python-oauth-web-app/templates/login.html @@ -0,0 +1,15 @@ +{% extends 'base.html' %} + +{% block content %} +
+

Login with atproto

+
+

Provide your handle or DID to authorize an existing account with PDS. +
You can also supply a PDS/entryway URL (eg, https://pds.example.com).

+
+ + +
+
+
+{% endblock %} diff --git a/docker/restreamer/compose.yaml b/github/restreamer/compose.yaml similarity index 100% rename from docker/restreamer/compose.yaml rename to github/restreamer/compose.yaml diff --git a/docker/rust-bbs/Cargo.toml b/github/rust-bbs/Cargo.toml similarity index 100% rename from docker/rust-bbs/Cargo.toml rename to github/rust-bbs/Cargo.toml diff --git a/docker/rust-bbs/Dockerfile b/github/rust-bbs/Dockerfile similarity index 54% rename from docker/rust-bbs/Dockerfile rename to github/rust-bbs/Dockerfile index 910bd0b..658c0fa 100644 --- a/docker/rust-bbs/Dockerfile +++ b/github/rust-bbs/Dockerfile @@ -1,7 +1,8 @@ FROM syui/aios WORKDIR /app -COPY . . +COPY ./src ./src +COPY ./templates ./templates +COPY ./Cargo.toml ./Cargo.toml RUN cargo build --release -COPY ./templates /templates CMD ["/app/target/release/rust-bbs"] diff --git a/docker/rust-bbs/compose.yml b/github/rust-bbs/compose.yml similarity index 81% rename from docker/rust-bbs/compose.yml rename to github/rust-bbs/compose.yml index 3b65404..d4e3dd7 100644 --- a/docker/rust-bbs/compose.yml +++ b/github/rust-bbs/compose.yml @@ -2,6 +2,6 @@ services: web: build: . ports: - - "8782:8782" + - 8080:8080 volumes: - ./sqlite.db:/app/sqlite.db diff --git a/docker/rust-bbs/src/main.rs b/github/rust-bbs/src/main.rs similarity index 82% rename from docker/rust-bbs/src/main.rs rename to github/rust-bbs/src/main.rs index 3ac4d66..a970690 100644 --- a/docker/rust-bbs/src/main.rs +++ b/github/rust-bbs/src/main.rs @@ -79,13 +79,13 @@ async fn submit_post( .unwrap_or_else(|_| web::Query(QueryParams { handle: None })); //let handle = query.handle.clone().filter(|h| !h.is_empty()); //println!("Debug: Extracted handle: {:?}", handle); - let handle = if !form.handle.is_empty() { - form.handle.clone() - } else { - query.handle.clone().unwrap_or_default() - }; +let handle = if !form.handle.is_empty() { + form.handle.clone() +} else { + query.handle.clone().unwrap_or_default() +}; - println!("Debug: Using handle: {:?}", handle); +println!("Debug: Using handle: {:?}", handle); let conn = Connection::open("sqlite.db") .map_err(|_| ErrorInternalServerError("Database connection failed"))?; @@ -94,19 +94,19 @@ async fn submit_post( &[&form.handle, &form.content], ); match result { - Ok(_) => { - let redirect_url = if !handle.is_empty() { - format!("/?handle={}", handle) - } else { - "/".to_string() - }; - Ok(HttpResponse::SeeOther() - .append_header(("Location", + Ok(_) => { + let redirect_url = if !handle.is_empty() { + format!("/?handle={}", handle) + } else { + "/".to_string() + }; + Ok(HttpResponse::SeeOther() + .append_header(("Location", redirect_url)) - .finish()) - }, + .finish()) + }, - //Ok(_) => Ok(web::Redirect::to("/").see_other()), + //Ok(_) => Ok(web::Redirect::to("/" + "?handle=" + handle).see_other()), Err(_) => Err(ErrorInternalServerError("Failed to insert post")), } } @@ -121,7 +121,7 @@ async fn main() -> std::io::Result<()> { .route("/post", web::get().to(post_form)) .route("/submit", web::post().to(submit_post)) }) - .bind("0.0.0.0:8782")? - .run() - .await + .bind("0.0.0.0:8080")? + .run() + .await } diff --git a/github/rust-bbs/templates/index.html b/github/rust-bbs/templates/index.html new file mode 100644 index 0000000..3cf9a36 --- /dev/null +++ b/github/rust-bbs/templates/index.html @@ -0,0 +1,77 @@ + + + + Simple BBS + + +
+
+ + + +
+
+
+ +
+ + + + + + + diff --git a/docker/rust-bbs/templates/post.html b/github/rust-bbs/templates/post.html similarity index 100% rename from docker/rust-bbs/templates/post.html rename to github/rust-bbs/templates/post.html diff --git a/slidev/.gitignore b/github/slidev/.gitignore similarity index 100% rename from slidev/.gitignore rename to github/slidev/.gitignore diff --git a/slidev/.npmrc b/github/slidev/.npmrc similarity index 100% rename from slidev/.npmrc rename to github/slidev/.npmrc diff --git a/slidev/README.md b/github/slidev/README.md similarity index 100% rename from slidev/README.md rename to github/slidev/README.md diff --git a/slidev/components/Counter.vue b/github/slidev/components/Counter.vue similarity index 100% rename from slidev/components/Counter.vue rename to github/slidev/components/Counter.vue diff --git a/slidev/netlify.toml b/github/slidev/netlify.toml similarity index 100% rename from slidev/netlify.toml rename to github/slidev/netlify.toml diff --git a/slidev/package.json b/github/slidev/package.json similarity index 100% rename from slidev/package.json rename to github/slidev/package.json diff --git a/slidev/pages/imported-slides.md b/github/slidev/pages/imported-slides.md similarity index 100% rename from slidev/pages/imported-slides.md rename to github/slidev/pages/imported-slides.md diff --git a/slidev/slides.md b/github/slidev/slides.md similarity index 100% rename from slidev/slides.md rename to github/slidev/slides.md diff --git a/slidev/snippets/external.ts b/github/slidev/snippets/external.ts similarity index 100% rename from slidev/snippets/external.ts rename to github/slidev/snippets/external.ts diff --git a/slidev/vercel.json b/github/slidev/vercel.json similarity index 100% rename from slidev/vercel.json rename to github/slidev/vercel.json diff --git a/issue/screenshots/issue-9-0001.png b/img/issue-9-0001.png similarity index 100% rename from issue/screenshots/issue-9-0001.png rename to img/issue-9-0001.png diff --git a/issue/screenshots/issue-9-0002.png b/img/issue-9-0002.png similarity index 100% rename from issue/screenshots/issue-9-0002.png rename to img/issue-9-0002.png diff --git a/issue/screenshots/issue-9-0003.png b/img/issue-9-0003.png similarity index 100% rename from issue/screenshots/issue-9-0003.png rename to img/issue-9-0003.png diff --git a/issue/screenshots/issue-9-0004.png b/img/issue-9-0004.png similarity index 100% rename from issue/screenshots/issue-9-0004.png rename to img/issue-9-0004.png