Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
650 changes: 644 additions & 6 deletions backend/Cargo.lock

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ http = "1.3.1"
chrono = "0.4.41"
url = "2.2"
rand = "0.8"
serde = { "version" = "1.0", features = ["derive"] }
reqwest = "0.12.23"
serde_json = "1.0.142"

[dev-dependencies]
tokio = { version = "1", features = ["full"] }
rand = "0.8"
rand = "0.8"
23 changes: 23 additions & 0 deletions backend/src/api/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use serde::Deserialize;
use std::{error::Error, marker::Sync};

#[derive(Debug, Deserialize)]
pub struct Problem {
pub id: String,
pub contest_id: String,
pub title: String,
}

pub async fn fetch_problem() -> Result<Vec<Problem>, Box<dyn Error + Send + Sync>> {
let url = "https://kenkoooo.com/atcoder/resources/problems.json";

// reqwest::Clientを作成し、User-Agentヘッダーを追加
let client = reqwest::Client::builder()
.user_agent("atcoder-random-picker/0.1") // 任意の名前やバージョンを指定
.build()?;

let text = client.get(url).send().await?.text().await?;
let problem: Vec<Problem> = serde_json::from_str(&text)?;

Ok(problem)
}
1 change: 1 addition & 0 deletions backend/src/data/problem-models.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions backend/src/data/problems.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions backend/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod routing;
pub mod api;

pub use routing::router;
3 changes: 1 addition & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Svelte + TS</title>
<title>AtCoder Random Picker</title>
</head>
<body>
<div id="app"></div>
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/output.css
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,6 @@
font-size: var(--text-xl);
line-height: var(--tw-leading, var(--text-xl--line-height));
}
.text-xs {
font-size: var(--text-xs);
line-height: var(--tw-leading, var(--text-xs--line-height));
}
.leading-none {
--tw-leading: 1;
line-height: 1;
Expand Down