Git repository hosting, collaboration, and discovery for the Fediverse.
Update to new structure
parent: tbd commit: b49b7cd
1 | use FromStr; |
2 | |
3 | use DaemonConnectionPool; |
4 | use |
5 | , |
6 | , |
7 | ; |
8 | |
9 | use ; |
10 | // use jwt::SignWithKey; |
11 | |
12 | |
13 | extern crate tracing; |
14 | |
15 | // #[tokio::main] |
16 | // async fn main() -> Result<(), anyhow::Error> { |
17 | // tracing_subscriber::fmt::init(); |
18 | |
19 | // let pool = DaemonConnectionPool::connect(Instance::from_str("giterated.dev")?).unwrap(); |
20 | |
21 | // let mut api = GiteratedApiBuilder::from_local("giterated.dev") |
22 | // .unwrap() |
23 | // .private_key(include_str!("example_keys/giterated.key")) |
24 | // .public_key(include_str!("example_keys/giterated.key.pub")) |
25 | // .build() |
26 | // .await |
27 | // .unwrap(); |
28 | |
29 | // info!("Lets try to make an account!"); |
30 | |
31 | // let response = api |
32 | // .register( |
33 | // String::from("ambee"), |
34 | // None, |
35 | // String::from("lolthisisinthecommithistory"), |
36 | // &pool, |
37 | // ) |
38 | // .await; |
39 | |
40 | // info!("Registration response: {:?}", response); |
41 | |
42 | // let token = api |
43 | // .authentication_token( |
44 | // String::from("foobar"), |
45 | // String::from("ambee"), |
46 | // String::from("password"), |
47 | // &pool, |
48 | // ) |
49 | // .await |
50 | // .unwrap(); |
51 | |
52 | // println!("Token: {}", token); |
53 | |
54 | // let public_key = api.public_key().await; |
55 | |
56 | // println!("Server public key:\n{}", public_key); |
57 | // let verification_key = DecodingKey::from_rsa_pem(public_key.as_bytes()).unwrap(); |
58 | // let data: TokenData<UserTokenMetadata> = decode( |
59 | // &token, |
60 | // &verification_key, |
61 | // &Validation::new(Algorithm::RS256), |
62 | // ) |
63 | // .unwrap(); |
64 | |
65 | // println!("The token was valid! Data:\n{:#?}", data.claims); |
66 | |
67 | // info!("Lets extend that token!"); |
68 | |
69 | // let new_token = api |
70 | // .extend_token(String::from("foobar"), token.clone(), &pool) |
71 | // .await |
72 | // .unwrap(); |
73 | // info!("New Token Returned:\n{:?}", new_token); |
74 | |
75 | // info!("Try to create a repository? uwu"); |
76 | |
77 | // let repository = api |
78 | // .create_repository( |
79 | // new_token.unwrap(), |
80 | // String::from("super-repository"), |
81 | // None, |
82 | // RepositoryVisibility::Public, |
83 | // String::from("master"), |
84 | // User::from_str("ambee:giterated.dev").unwrap(), |
85 | // &pool, |
86 | // ) |
87 | // .await |
88 | // .unwrap(); |
89 | |
90 | // assert!(repository); |
91 | |
92 | // info!("Lets view our repository!"); |
93 | |
94 | // let view = api |
95 | // .repository_info( |
96 | // &token, |
97 | // Repository::from_str("ambee:giterated.dev/[email protected]").unwrap(), |
98 | // &pool, |
99 | // ) |
100 | // .await |
101 | // .unwrap(); |
102 | |
103 | // info!("Repository Info:\n{:#?}", view); |
104 | |
105 | // Ok(()) |
106 | // } |
107 | |
108 | |
109 | async |
110 | ; | init
111 | let pool = connect .unwrap; |
112 | |
113 | let request = UserBioRequest |
114 | user: from_str .unwrap, |
115 | ; |
116 | |
117 | let response = request_local |
118 | . |
119 | .await?; |
120 | |
121 | info!; |
122 | |
123 | Ok |
124 | |
125 | |
126 | |
127 | |
128 | user: User, |
129 | generated_for: Instance, |
130 | exp: u64, |
131 | |
132 |