Flip camera
This commit is contained in:
parent
d05067b553
commit
8b7ba7ecc1
@ -827,6 +827,10 @@ function __wbg_get_imports() {
|
|||||||
const ret = result;
|
const ret = result;
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
imports.wbg.__wbg_set_eacc7d73fefaafdf = function() { return handleError(function (arg0, arg1, arg2) {
|
||||||
|
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
||||||
|
return ret;
|
||||||
|
}, arguments) };
|
||||||
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
||||||
const ret = debugString(getObject(arg1));
|
const ret = debugString(getObject(arg1));
|
||||||
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||||
@ -841,15 +845,15 @@ function __wbg_get_imports() {
|
|||||||
const ret = wasm.memory;
|
const ret = wasm.memory;
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_closure_wrapper175 = function(arg0, arg1, arg2) {
|
imports.wbg.__wbindgen_closure_wrapper176 = function(arg0, arg1, arg2) {
|
||||||
const ret = makeMutClosure(arg0, arg1, 31, __wbg_adapter_36);
|
const ret = makeMutClosure(arg0, arg1, 31, __wbg_adapter_36);
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_closure_wrapper176 = function(arg0, arg1, arg2) {
|
imports.wbg.__wbindgen_closure_wrapper177 = function(arg0, arg1, arg2) {
|
||||||
const ret = makeMutClosure(arg0, arg1, 31, __wbg_adapter_39);
|
const ret = makeMutClosure(arg0, arg1, 31, __wbg_adapter_39);
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
imports.wbg.__wbindgen_closure_wrapper1772 = function(arg0, arg1, arg2) {
|
imports.wbg.__wbindgen_closure_wrapper1773 = function(arg0, arg1, arg2) {
|
||||||
const ret = makeMutClosure(arg0, arg1, 499, __wbg_adapter_42);
|
const ret = makeMutClosure(arg0, arg1, 499, __wbg_adapter_42);
|
||||||
return addHeapObject(ret);
|
return addHeapObject(ret);
|
||||||
};
|
};
|
||||||
|
Binary file not shown.
@ -90,7 +90,13 @@ pub fn init_camera_feed(product_options_js: JsValue) -> Result<(), String> {
|
|||||||
let navigator = window.navigator();
|
let navigator = window.navigator();
|
||||||
let media_devices = navigator.media_devices().unwrap();
|
let media_devices = navigator.media_devices().unwrap();
|
||||||
let media_stream_constraints = MediaStreamConstraints::new();
|
let media_stream_constraints = MediaStreamConstraints::new();
|
||||||
media_stream_constraints.set_video(&JsValue::from_bool(true));
|
let video_constraint = js_sys::Object::new();
|
||||||
|
let _ = js_sys::Reflect::set(
|
||||||
|
&video_constraint,
|
||||||
|
&JsValue::from("facingMode"),
|
||||||
|
&JsValue::from("environment"),
|
||||||
|
);
|
||||||
|
media_stream_constraints.set_video(&video_constraint);
|
||||||
media_stream_constraints.set_audio(&JsValue::from_bool(false));
|
media_stream_constraints.set_audio(&JsValue::from_bool(false));
|
||||||
let user_media = media_devices
|
let user_media = media_devices
|
||||||
.get_user_media_with_constraints(&media_stream_constraints)
|
.get_user_media_with_constraints(&media_stream_constraints)
|
||||||
|
2
run.sh
2
run.sh
@ -8,4 +8,4 @@ wasm-pack build --target web || exit;
|
|||||||
cd ..;
|
cd ..;
|
||||||
|
|
||||||
cd server || exit;
|
cd server || exit;
|
||||||
cargo run || exit;
|
env DB_NAME=Food DB_HOST=db.knyffen.dk DB_USER=root DB_PASSWD=hQqjjMa3JbpLrJvJo7FV cargo run || exit;
|
||||||
|
@ -33,9 +33,17 @@ struct AppState {
|
|||||||
sql_pool: Pool,
|
sql_pool: Pool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_sql_pool(url: &str) -> Pool {
|
fn get_sql_pool() -> Pool {
|
||||||
|
let db_user = std::env::var("DB_USER").expect("DB_USER environment variable not set!");
|
||||||
|
let db_password = std::env::var("DB_PASSWD").expect("DB_PASSWD environment variable not set!");
|
||||||
|
let db_host = std::env::var("DB_HOST").expect("DB_HOST environment variable not set!");
|
||||||
|
let db_name = std::env::var("DB_NAME").expect("DB_NAME environment variable not set!");
|
||||||
|
let url = format!(
|
||||||
|
"mysql://{}:{}@{}:3306/{}",
|
||||||
|
db_user, db_password, db_host, db_name
|
||||||
|
);
|
||||||
loop {
|
loop {
|
||||||
let sql_pool_attempt = Pool::new(url);
|
let sql_pool_attempt = Pool::new(url.as_str());
|
||||||
match sql_pool_attempt {
|
match sql_pool_attempt {
|
||||||
Ok(sql_pool) => return sql_pool,
|
Ok(sql_pool) => return sql_pool,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -49,8 +57,7 @@ fn get_sql_pool(url: &str) -> Pool {
|
|||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
//Initialize state
|
//Initialize state
|
||||||
let sql_pool =
|
let sql_pool = get_sql_pool();
|
||||||
get_sql_pool("mysql://calories_user:I96xkFy0UFPbB0JCP6X6@db.knyffen.dk:3306/Food");
|
|
||||||
let shared_state = Arc::new(AppState { sql_pool });
|
let shared_state = Arc::new(AppState { sql_pool });
|
||||||
|
|
||||||
// build our application with a single route
|
// build our application with a single route
|
||||||
|
Loading…
Reference in New Issue
Block a user