remove protocol enforcement

This commit is contained in:
SpikeHD
2022-06-11 15:48:33 -07:00
parent e71a73c19a
commit b8540f0891
2 changed files with 7 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
*/ */
use lazy_static::lazy_static; use lazy_static::lazy_static;
use std::sync::Mutex; use std::{sync::Mutex, str::FromStr};
use rcgen::*; use rcgen::*;
use hudsucker::{ use hudsucker::{
@@ -30,7 +30,7 @@ async fn shutdown_signal() {
// Global ver for getting server address. // Global ver for getting server address.
lazy_static! { lazy_static! {
static ref SERVER: Mutex<String> = { static ref SERVER: Mutex<String> = {
let m = "localhost:443".to_string(); let m = "http://localhost:443".to_string();
Mutex::new(m) Mutex::new(m)
}; };
} }
@@ -56,9 +56,9 @@ impl HttpHandler for ProxyHandler {
// Only switch up if request is to the game servers. // Only switch up if request is to the game servers.
if uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") { if uri.contains("hoyoverse.com") || uri.contains("mihoyo.com") || uri.contains("yuanshen.com") {
// Create new URI. // Create new URI.
let uri = format!("https://{}{}", SERVER.lock().unwrap(), uri_path).parse::<Uri>().unwrap(); let new_uri = Uri::from_str(format!("{}{}", SERVER.lock().unwrap(), uri_path).as_str()).unwrap();
// Set request URI to the new one. // Set request URI to the new one.
*request.uri_mut() = uri; *request.uri_mut() = new_uri;
} }
RequestOrResponse::Request(request) RequestOrResponse::Request(request)

View File

@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom/client'
import './index.css' import './index.css'
import App from './ui/App' import App from './ui/App'
// import Test from './ui/Test' import Test from './ui/Debug'
const root = ReactDOM.createRoot( const root = ReactDOM.createRoot(
document.getElementById('root') as HTMLElement document.getElementById('root') as HTMLElement
@@ -11,8 +11,8 @@ const root = ReactDOM.createRoot(
root.render( root.render(
<React.StrictMode> <React.StrictMode>
<App /> {/* <App /> */}
{/*<Test />*/} <Test />
</React.StrictMode> </React.StrictMode>
) )