Signed by hanna SSH key fingerprint: SHA256:4g9cWhkAAw8gwqhJUcVbSnGEvdGwklW+1Aa/fMUu59k
crates/auth/src/access.rs +1 −0 crates/model/src/entity.rs +2 −0 crates/store/src/repos.rs +21 −2 crates/web/src/icons.rs +5 −0 crates/web/src/pages.rs +10 −0 crates/web/src/repo.rs +6 −1 migrations/postgres/0015_repo_mirror.sql +1 −0 migrations/sqlite/0015_repo_mirror.sql +1 −0 crates/auth/src/access.rs +1 −0 Expand 149 hidden lines 150 150 object_format: "sha1" . to_string ( ) , 151 151 issues_enabled: true , 152 152 pulls_enabled: true , 153 + is_mirror: false , 153 154 next_iid: 1 , 154 155 archived_at: None , 155 156 size_bytes: 0 ,
crates/model/src/entity.rs +2 −0 Expand 424 hidden lines 425 425 pub issues_enabled: bool , 426 426 427 427 pub pulls_enabled: bool , 428 + 429 + pub is_mirror: bool , 428 430 429 431 pub next_iid: Timestamp , 430 432
crates/store/src/repos.rs +21 −2 Expand 11 hidden lines 12 12 13 13 14 14 const REPO_COLUMNS : & str = "id, owner_id, group_id, name, path, description, visibility, \ 15 - default_branch, object_format, issues_enabled, pulls_enabled, next_iid, archived_at, \ 16 - size_bytes, pushed_at, created_at, updated_at" ; 15 + default_branch, object_format, issues_enabled, pulls_enabled, is_mirror, next_iid, \ 16 + archived_at, size_bytes, pushed_at, created_at, updated_at" ; 17 17 18 18 19 19 Expand 49 hidden lines 69 69 object_format: "sha1" . to_string ( ) , 70 70 issues_enabled: true , 71 71 pulls_enabled: true , 72 + is_mirror: false , 72 73 next_iid: 1 , 73 74 archived_at: None , 74 75 size_bytes: 0 , Expand 213 hidden lines 288 289 Ok ( updated > 0 ) 289 290 } 290 291 292 + 293 + 294 + 295 + 296 + 297 + 298 + pub async fn set_mirror ( & self , repo_id : & str , is_mirror : bool ) -> Result < bool , StoreError > { 299 + let updated = sqlx:: query ( "UPDATE repos SET is_mirror = $1, updated_at = $2 WHERE id = $3" ) 300 + . bind ( is_mirror) 301 + . bind ( now_ms ( ) ) 302 + . bind ( repo_id) 303 + . execute ( & self . pool) 304 + . await ? 305 + . rows_affected ( ) ; 306 + Ok ( updated > 0 ) 307 + } 308 + 291 309 292 310 293 311 Expand 154 hidden lines 448 466 object_format: row. try_get ( "object_format" ) ?, 449 467 issues_enabled: self . get_bool ( row, "issues_enabled" ) ?, 450 468 pulls_enabled: self . get_bool ( row, "pulls_enabled" ) ?, 469 + is_mirror: self . get_bool ( row, "is_mirror" ) ?, 451 470 next_iid: row. try_get ( "next_iid" ) ?, 452 471 archived_at: row. try_get ( "archived_at" ) ?, 453 472 size_bytes: row. try_get ( "size_bytes" ) ?,
crates/web/src/icons.rs +5 −0 Expand 38 hidden lines 39 39 Scale , 40 40 Globe , 41 41 Download , 42 + Mirror , 42 43 Github , 43 44 Mastodon , 44 45 } Expand 73 hidden lines 118 119 Icon :: Download => { 119 120 r#"<path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/>"# 120 121 } 122 + 123 + Icon :: Mirror => { 124 + r#"<path d="M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"/><path d="M21 3v5h-5"/><path d="M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"/><path d="M8 16H3v5"/>"# 125 + } 121 126 Icon :: Github => { 122 127 r#"<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>"# 123 128 }
crates/web/src/pages.rs +10 −0 Expand 597 hidden lines 598 598 sync_on_push: false , 599 599 } ) 600 600 . await ; 601 + 602 + let _ = state. store. set_mirror ( & repo. id, true ) . await ; 603 + let _ = state 604 + . store 605 + . set_feature_enabled ( & repo. id, "issues" , false ) 606 + . await ; 607 + let _ = state 608 + . store 609 + . set_feature_enabled ( & repo. id, "pulls" , false ) 610 + . await ; 601 611 } 602 612 Ok ( path) 603 613 }
crates/web/src/repo.rs +6 −1 Expand 2353 hidden lines 2354 2354 pub ( crate ) updated: i64 , 2355 2355 2356 2356 pub ( crate ) archived: bool , 2357 + 2358 + pub ( crate ) is_mirror: bool , 2357 2359 2358 2360 pub ( crate ) description: Option < String > , 2359 2361 } Expand 8 hidden lines 2368 2370 default_branch: repo. default_branch. clone ( ) , 2369 2371 updated: repo. pushed_at. unwrap_or ( repo. updated_at) , 2370 2372 archived: repo. archived_at. is_some ( ) , 2373 + is_mirror: repo. is_mirror, 2371 2374 description: repo. description. clone ( ) , 2372 2375 } 2373 2376 } Expand 8 hidden lines 2382 2385 default_branch: repo. default_branch. clone ( ) , 2383 2386 updated: repo. pushed_at. unwrap_or ( repo. updated_at) , 2384 2387 archived: repo. archived_at. is_some ( ) , 2388 + is_mirror: repo. is_mirror, 2385 2389 description: repo. description. clone ( ) , 2386 2390 } 2387 2391 } Expand 33 hidden lines 2421 2425 li { 2422 2426 a class="repo-row" href=( e. href) { 2423 2427 span class="repo-row-name" { 2424 - ( icon ( Icon :: Box ) ) span { ( e. label) } 2428 + ( icon ( if e. is_mirror { Icon :: Mirror } else { Icon :: Box } ) ) 2429 + span { ( e. label) } 2425 2430 ( visibility_badge ( e. visibility) ) 2426 2431 ( archived_badge ( e. archived) ) 2427 2432 }
migrations/postgres/0015_repo_mirror.sql +1 −0 1 + ALTER TABLE repos ADD COLUMN is_mirror BOOLEAN NOT NULL DEFAULT FALSE ;
migrations/sqlite/0015_repo_mirror.sql +1 −0 1 + ALTER TABLE repos ADD COLUMN is_mirror INTEGER NOT NULL DEFAULT 0 ;