mirror of
https://github.com/modrinth/code.git
synced 2026-08-27 01:54:47 +00:00
Commonized networking (#3310)
* Fix not being able to connect to local friends socket
* Start basic work on tunneling protocol and move some code into a common crate
* Commonize message serialization logic
* Serialize Base62Ids as u64 when human-readability is not required
* Move ActiveSockets tuple into struct
* Make CI run when rust-common is updated
CI is currently broken for labrinth, however
* Fix theseus-release.yml to reference itself correctly
* Implement Labrinth side of tunneling
* Implement non-friend part of theseus tunneling
* Implement client-side except for socket loop
* Implement the socket loop
Doesn't work though. Debugging time!
* Fix config.rs
* Fix deadlock in labrinth socket handling
* Update dockerfile
* switch to workspace prepare at root level
* Wait for connection before tunneling in playground
* Move rust-common into labrinth
* Remove rust-common references from Actions
* Revert "Update dockerfile"
This reverts commit 3caad59bb4.
* Fix Docker build
* Rebuild Theseus if common code changes
* Allow multiple connections from the same user
* Fix test building
* Move FriendSocketListening and FriendSocketStoppedListening to non-panicking TODO for now
* Make message_serialization macro take varargs for binary messages
* Improve syntax of message_serialization macro
* Remove the ability to connect to a virtual socket, and disable the ability to listen on one
* Allow the app to compile without running labrinth
* Clippy fix
* Update Rust and Clippy fix again
---------
Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
//! Functions for fetching infromation from the Internet
|
||||
use super::io::{self, IOError};
|
||||
use crate::config::{MODRINTH_API_URL, MODRINTH_API_URL_V3};
|
||||
use crate::event::emit::emit_loading;
|
||||
use crate::event::LoadingBarId;
|
||||
use bytes::Bytes;
|
||||
@@ -11,8 +13,6 @@ use std::time::{self};
|
||||
use tokio::sync::Semaphore;
|
||||
use tokio::{fs::File, io::AsyncWriteExt};
|
||||
|
||||
use super::io::{self, IOError};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IoSemaphore(pub Semaphore);
|
||||
#[derive(Debug)]
|
||||
@@ -87,7 +87,8 @@ pub async fn fetch_advanced(
|
||||
.map(|x| &*x.0.to_lowercase() == "authorization")
|
||||
.unwrap_or(false)
|
||||
&& (url.starts_with("https://cdn.modrinth.com")
|
||||
|| url.starts_with("https://api.modrinth.com"))
|
||||
|| url.starts_with(MODRINTH_API_URL)
|
||||
|| url.starts_with(MODRINTH_API_URL_V3))
|
||||
{
|
||||
crate::state::ModrinthCredentials::get_active(exec).await?
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user