summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOmar Rizwan <omar@omar.website>2023-07-10 20:30:32 +0000
committerGitHub <noreply@github.com>2023-07-10 20:30:32 +0000
commit467ad97d3533d30ffc7addcfbb8683d8b05ea677 (patch)
tree571b832d03bc7a518df72e42804372c15f8fa892
parentMerge pull request #43 from FolkComputer/osnr/libdrm-rendering (diff)
parentBetter privacy for wifi in hosts.tcl (diff)
downloadfolk-467ad97d3533d30ffc7addcfbb8683d8b05ea677.tar.gz
folk-467ad97d3533d30ffc7addcfbb8683d8b05ea677.zip
Merge pull request #45 from FolkComputer/wifi-hashing
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.
}