diff --git a/src/tweaks/network.h b/src/tweaks/network.h index b7e0d6d2a2..0bfdd8d5d7 100644 --- a/src/tweaks/network.h +++ b/src/tweaks/network.h @@ -56,7 +56,6 @@ void network_loadState(void) network_state.hotspot = config_flag_get(".hotspotState"); network_state.ntp = config_flag_get(".ntpState"); network_state.ntp_wait = config_flag_get(".ntpWait"); - network_state.auth_smbd = config_flag_get(".authsmbdState"); network_state.auth_ftp = config_flag_get(".authftpState"); network_state.auth_http = config_flag_get(".authhttpState"); network_state.auth_ssh = config_flag_get(".authsshState"); @@ -297,12 +296,6 @@ void network_keepServicesAlive(void *pt) network_setState(&network_state.keep_alive, ".keepServicesAlive", !((ListItem *)pt)->value); } -void network_setSmbdAuthState(void *pt) -{ - network_setState(&network_state.auth_smbd, ".authsmbdState", ((ListItem *)pt)->value); - network_execServiceAuth("smbd"); -} - void network_setFtpAuthState(void *pt) { network_setState(&network_state.auth_ftp, ".authftpState", ((ListItem *)pt)->value); @@ -375,7 +368,7 @@ void menu_smbd(void *pt) if (!_menu_smbd._created) { network_getSmbShares(); - _menu_smbd = list_createWithSticky(2 + network_numShares, "Samba"); + _menu_smbd = list_createWithSticky(1 + network_numShares, "Samba"); list_addItemWithInfoNote(&_menu_smbd, (ListItem){ @@ -385,19 +378,6 @@ void menu_smbd(void *pt) .value = (int)network_state.smbd, .action = network_setSmbdState}, item->info_note); - list_addItemWithInfoNote(&_menu_smbd, - (ListItem){ - .label = "Enable authentication", - .sticky_note = "Enable password authentication", - .item_type = TOGGLE, - .disabled = !network_state.smbd, - .value = (int)network_state.auth_smbd, - .action = network_setSmbdAuthState}, - "Username: onion\n" - "Password: onion\n" - " \n" - "We're using a new auth system. User defined\n" - "passwords will come in a future update."); for (int i = 0; i < network_numShares; i++) { ListItem shareItem = { diff --git a/static/build/.tmp_update/runtime.sh b/static/build/.tmp_update/runtime.sh index aececa7c40..480131a979 100644 --- a/static/build/.tmp_update/runtime.sh +++ b/static/build/.tmp_update/runtime.sh @@ -125,6 +125,7 @@ main() { } state_change() { + log "state change: $1" runifnecessary "keymon" keymon check_networking touch /tmp/state_changed @@ -583,9 +584,12 @@ check_networking() { return fi - rm /tmp/network_changed - - $sysdir/script/network/update_networking.sh check + if pgrep -f update_networking.sh; then + log "update_networking already running" + else + rm /tmp/network_changed + $sysdir/script/network/update_networking.sh check + fi check_timezone } diff --git a/static/build/.tmp_update/script/network/update_networking.sh b/static/build/.tmp_update/script/network/update_networking.sh index ef5ee16a7e..d31344115a 100644 --- a/static/build/.tmp_update/script/network/update_networking.sh +++ b/static/build/.tmp_update/script/network/update_networking.sh @@ -150,9 +150,8 @@ check_smbdstate() { /var/private \ /var/log/ - update_smbconf $netscript/start_smbd.sh $PASS & - log "Samba: Starting smbd at exit of tweaks.." + log "Samba: Starting smbd.." else disable_flag smbdState fi @@ -165,14 +164,6 @@ check_smbdstate() { fi } -update_smbconf() { - if flag_enabled authsmbdState; then - sed -i -e '/guest only/s/1/0/g' -e 's/#alid users = onion/valid users = onion/g' $sysdir/config/smb.conf - else - sed -i -e '/guest only/s/0/1/g' -e 's/valid users = onion/#alid users = onion/g' $sysdir/config/smb.conf - fi -} - smbd_authed() { if flag_enabled smbdState; then update_smbconf @@ -436,11 +427,6 @@ check_ntpstate() { return 1 fi - # Try once for good luck (this is faster - when it works) - if get_time; then - return 0 - fi - attempts=0 max_wait_ip=10 max_attempts=3 @@ -456,6 +442,7 @@ check_ntpstate() { log "NTPwait: Could not aquire an IP address" ret_val=1 got_ip=0 + break fi else log "NTPwait: IP address aquired: $ip" @@ -493,7 +480,7 @@ check_ntpstate() { get_time() { # handles 2 types of network time, instant from an API or longer from an NTP server, if the instant API checks fails it will fallback to the longer ntp log "NTP: started time update" - response=$(curl -s --connect-timeout 3 http://worldtimeapi.org/api/ip.txt) + response=$(curl -s -m 3 http://worldtimeapi.org/api/ip.txt) utc_datetime=$(echo "$response" | grep -o 'utc_datetime: [^.]*' | cut -d ' ' -f2 | sed "s/T/ /") if ! flag_enabled "manual_tz"; then utc_offset="UTC$(echo "$response" | grep -o 'utc_offset: [^.]*' | cut -d ' ' -f2)" @@ -501,27 +488,33 @@ get_time() { # handles 2 types of network time, instant from an API or longer fr if [ -z "$utc_datetime" ]; then log "NTP: Failed to get time from worldtimeapi.org, trying timeapi.io" - utc_datetime=$(curl -s -k --connect-timeout 5 https://timeapi.io/api/Time/current/zone?timeZone=UTC | grep -o '"dateTime":"[^.]*' | cut -d '"' -f4 | sed 's/T/ /') + utc_datetime=$(curl -s -k -m 5 https://timeapi.io/api/Time/current/zone?timeZone=UTC | grep -o '"dateTime":"[^.]*' | cut -d '"' -f4 | sed 's/T/ /') if ! flag_enabled "manual_tz"; then - ip_address=$(curl -s -k --connect-timeout 5 https://api.ipify.org) - utc_offset_seconds=$(curl -s -k --connect-timeout 5 https://timeapi.io/api/TimeZone/ip?ipAddress=$ip_address | jq '.currentUtcOffset.seconds') + ip_address=$(curl -s -k -m 5 https://api.ipify.org) + utc_offset_seconds=$(curl -s -k -m 5 https://timeapi.io/api/TimeZone/ip?ipAddress=$ip_address | jq '.currentUtcOffset.seconds') utc_offset="$(convert_seconds_to_utc_offset $utc_offset_seconds)" fi fi - if [ ! -z "$utc_datetime" ]; then - if [ ! -z "$utc_offset" ]; then + if [ -n "$utc_datetime" ]; then + playActivity stop_all + + if [ -n "$utc_offset" ]; then echo "$utc_offset" | sed 's/\+/_/' | sed 's/-/+/' | sed 's/_/-/' > $sysdir/config/.tz cp $sysdir/config/.tz $sysdir/config/.tz_sync sync set_tzid fi + if date -u -s "$utc_datetime" > /dev/null 2>&1; then hwclock -w log "NTP: Time successfully aquired using API" touch /tmp/ntp_synced + playActivity resume return 0 fi + + playActivity resume fi log "NTP: Failed to get time via timeapi.io as well, falling back to NTP." diff --git a/static/configs/.tmp_update/config/smb.conf b/static/configs/.tmp_update/config/smb.conf index 6b6e78ca4d..b8b096c516 100644 --- a/static/configs/.tmp_update/config/smb.conf +++ b/static/configs/.tmp_update/config/smb.conf @@ -1,6 +1,7 @@ ## Onion smb.conf [global] + workgroup = workgroup client min protocol = SMB2 client max protocol = SMB3 @@ -17,96 +18,86 @@ cache directory = /var/run/samba/locks/cache ntp signd socket directory = /var/lib/ntp_signd pid directory = /var/run/ -map to guest = Bad User server role = standalone server ## Edit your shares below [BIOS] -#alid users = onion +valid users = onion path = /mnt/SDCARD/BIOS public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Media] -#alid users = onion +valid users = onion path = /mnt/SDCARD/Media public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Overlays] -#alid users = onion +valid users = onion path = /mnt/SDCARD/RetroArch/.retroarch/overlay public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Roms] -#alid users = onion +valid users = onion path = /mnt/SDCARD/Roms public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Saves] -#alid users = onion +valid users = onion path = /mnt/SDCARD/Saves/CurrentProfile/saves public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Screenshots] -#alid users = onion +valid users = onion path = /mnt/SDCARD/Screenshots public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Themes] -#alid users = onion +valid users = onion path = /mnt/SDCARD/Themes public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [Video filters] -#alid users = onion +valid users = onion path = /mnt/SDCARD/RetroArch/.retroarch/filters/video public = 1 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777 available = 1 [__SDCARD] -#alid users = onion +valid users = onion path = /mnt/SDCARD/ public = 0 -guest only = 1 writable = 1 force create mode = 0666 force directory mode = 0777