File tree 3 files changed +10
-5
lines changed
3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -14,8 +14,12 @@ pub async fn get_api_permlink(
14
14
State ( config) : State < Arc < AppConfig > > ,
15
15
Path ( permlink_id) : Path < String > ,
16
16
) -> Result < Json < GetPermlinkResponse > , AppError > {
17
- let permlink: GetPermlinkResponse =
18
- get_permlink ( & config. sqlite . clone ( ) . unwrap ( ) , & permlink_id) . await ?;
17
+ let permlink: GetPermlinkResponse = get_permlink (
18
+ & config. sqlite . clone ( ) . unwrap ( ) ,
19
+ & permlink_id,
20
+ & config. wandbox_url ,
21
+ )
22
+ . await ?;
19
23
return Ok ( Json ( permlink) ) ;
20
24
}
21
25
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ pub async fn make_permlink(
100
100
pub async fn get_permlink (
101
101
pool : & SqlitePool ,
102
102
permlink_name : & str ,
103
+ wandbox_url : & str ,
103
104
) -> Result < GetPermlinkResponse , anyhow:: Error > {
104
105
let mut tx: sqlx:: Transaction < ' _ , Sqlite > = pool. begin ( ) . await ?;
105
106
@@ -212,7 +213,7 @@ pub async fn get_permlink(
212
213
// CompileResult を計算する
213
214
let mut result: CompileResult = merge_compile_result ( & results) ;
214
215
result. permlink = permlink_name. to_string ( ) ;
215
- result. url = format ! ( "https://wandbox.org/ permlink/{}" , permlink_name) ;
216
+ result. url = format ! ( "{} permlink/{}" , wandbox_url , permlink_name) ;
216
217
217
218
Ok ( GetPermlinkResponse {
218
219
parameter,
@@ -376,7 +377,7 @@ mod tests {
376
377
assert ! ( result. is_ok( ) ) ;
377
378
378
379
let response: Result < GetPermlinkResponse , anyhow:: Error > =
379
- get_permlink ( & pool, & permlink_name) . await ;
380
+ get_permlink ( & pool, & permlink_name, "https://wandbox.org/" ) . await ;
380
381
assert ! ( response. is_ok( ) , "get_permlink failed: {:?}" , response) ;
381
382
382
383
let response: GetPermlinkResponse = response. unwrap ( ) ;
Original file line number Diff line number Diff line change @@ -246,7 +246,7 @@ pub struct CompileParameter {
246
246
pub created_at : i64 ,
247
247
#[ serde( default ) ]
248
248
pub is_private : bool ,
249
- #[ serde( default ) ]
249
+ #[ serde( rename = "compiler-info" , default ) ]
250
250
pub compiler_info : CompilerInfo ,
251
251
}
252
252
You can’t perform that action at this time.
0 commit comments