summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArcade Wise <l3gacy.b3ta@disroot.org>2023-07-10 20:27:15 +0000
committerArcade Wise <l3gacy.b3ta@disroot.org>2023-07-10 20:27:15 +0000
commit4e1c1942285e13ded40e5b69c2ff1ea6dcb4aa59 (patch)
treee70626bc76d94d7289893d0c2f31209f9e3c1cc1
parentfix laser region camera code (diff)
downloadfolk-4e1c1942285e13ded40e5b69c2ff1ea6dcb4aa59.tar.gz
folk-4e1c1942285e13ded40e5b69c2ff1ea6dcb4aa59.zip
Better privacy for wifi in hosts.tcl
-rw-r--r--hosts.tcl12
1 files changed, 12 insertions, 0 deletions
diff --git a/hosts.tcl b/hosts.tcl
index d5b2e795..aa6700a9 100644
--- a/hosts.tcl
+++ b/hosts.tcl
@@ -1,3 +1,13 @@
+# TODO: Find a good C sha-smth instead of this.
+proc hashString {str} {
+ set hash 0
+ foreach char [split $str ""] {
+ set ascii [scan $char %c]
+ set hash [expr {($hash * 31 + $ascii) & 0xffffffff}]
+ }
+ set hash
+}
+
if {[info exists ::env(FOLK_SHARE_NODE)]} {
set ::shareNode $::env(FOLK_SHARE_NODE)
} else {
@@ -20,6 +30,8 @@ if {[info exists ::env(FOLK_SHARE_NODE)]} {
set ::shareNode "folk0.local"
} elseif {[string match "_onefact.org*" $wifi]} {
set ::shareNode "folk-onefact.local"
+ } elseif {[hashString $wifi] eq 4077950650 || [hashString $wifi] eq 862457117} {
+ set ::shareNode "folk-arc.local"
} else {
# there's no default.
}