aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activityPubStruct.go2
-rw-r--r--client.go1
-rw-r--r--static/clover.pngbin0 -> 92559 bytes
-rw-r--r--static/js/posts.js7
-rw-r--r--static/posts.html31
5 files changed, 34 insertions, 7 deletions
diff --git a/activityPubStruct.go b/activityPubStruct.go
index 06c97e1..e790573 100644
--- a/activityPubStruct.go
+++ b/activityPubStruct.go
@@ -138,7 +138,7 @@ type ObjectBase struct {
MediaType string `json:"mediatype,omitempty"`
Duration string `json:"duration,omitempty"`
Size int64 `json:"size,omitempty"`
- Sensitive bool `json:"sensitive"`
+ Sensitive bool `json:"sensitive,omitempty"`
}
type CryptoCur struct {
diff --git a/client.go b/client.go
index 1c2b8ce..d91bbc7 100644
--- a/client.go
+++ b/client.go
@@ -9,7 +9,6 @@ import "strings"
import "strconv"
import "sort"
import "regexp"
-import "os"
var Key *string = new(string)
diff --git a/static/clover.png b/static/clover.png
new file mode 100644
index 0000000..305748e
--- /dev/null
+++ b/static/clover.png
Binary files differ
diff --git a/static/js/posts.js b/static/js/posts.js
index 06aab77..79fb7c4 100644
--- a/static/js/posts.js
+++ b/static/js/posts.js
@@ -296,7 +296,12 @@ function dragElement(elmnt) {
function stripTransferProtocol(value){
var re = /(https:\/\/|http:\/\/)?(www.)?/
-
return value.replace(re, "")
}
+function isOnion(value){
+ var re = /\.onion/
+ if(value.match(re) != null)
+ return true
+ return false
+}
diff --git a/static/posts.html b/static/posts.html
index 1b1d78b..194c273 100644
--- a/static/posts.html
+++ b/static/posts.html
@@ -18,19 +18,30 @@
{{ end }}
<span style="display: block;">File: <a id="{{ .Id }}-img" href="{{ (index .Attachment 0).Href}}">{{ (index .Attachment 0).Name }}</a><span id="{{ .Id }}-size">({{ (index .Attachment 0).Size }})</span></span>
<div id="hide-{{ .Id }}" style="display: none;">[Hide]</div>
- <div id="sensitive-{{ .Id }}" style="display: none;"><div style="position: relative; text-align: center;"><img style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div style="width: 240px; position: absolute; margin-top: 110px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div></div></div>
+ <div id="sensitive-{{ .Id }}" style="display: none;"><div style="position: relative; text-align: center;"><img id="sensitive-img-{{ .Id }}" style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div id="sensitive-text-{{ .Id }}" style="width: 240px; position: absolute; margin-top: 110px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div></div></div>
<div id="media-{{ .Id }}"></div>
<script>
media = document.getElementById("media-{{ .Id }}")
- if({{ .Sensitive }} && {{ $board.Actor.Restricted }}){
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || isOnion("{{ .Id }}")){
sensitive = document.getElementById("sensitive-{{ .Id }}")
hide = document.getElementById("hide-{{ .Id }}")
sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
sensitive.style = "display: block"
media.style = "display: none;"
- }
+ }
+
+ if(isOnion("{{ .Id }}")) {
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ document.getElementById("sensitive-img-{{ .Id }}").src = "/static/clover.png"
+ document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Node"
+ hide = document.getElementById("hide-{{ .Id }}")
+ sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
+ hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
+ sensitive.style = "display: block"
+ media.style = "display: none;"
+ }
if(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){
var img = document.createElement("img");
@@ -100,11 +111,12 @@
<div id="hide-{{ .Id }}" style="display: none;">[Hide]</div>
<div id="sensitive-{{ .Id }}" style="display: none;"><div style="position: relative; text-align: center;"><img style="float: left; margin-right: 10px; margin-bottom: 10px; max-width: 250px; max-height: 250px;" src="/static/sensitive.png"><div style="width: 240px; position: absolute; margin-top: 110px; padding: 5px; background-color: black; color: white; cursor: default; ">NSFW Content</div></div></div>
{{ end }}
+ <div> </div>
<div id="media-{{ .Id }}" sensitive="0"></div>
<script>
media = document.getElementById("media-{{ .Id }}")
- if({{ .Sensitive }} && {{ $board.Actor.Restricted }}){
+ if(({{ .Sensitive }} && {{ $board.Actor.Restricted }}) || isOnion("{{ .Id }}")){
sensitive = document.getElementById("sensitive-{{ .Id }}")
hide = document.getElementById("hide-{{ .Id }}")
sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
@@ -112,6 +124,17 @@
sensitive.style = "display: block"
media.style = "display: none;"
}
+
+ if(isOnion("{{ .Id }}")) {
+ sensitive = document.getElementById("sensitive-{{ .Id }}")
+ document.getElementById("sensitive-img-{{ .Id }}").src = "/static/clover.png"
+ document.getElementById("sensitive-text-{{ .Id }}").innerText = "Tor Node"
+ hide = document.getElementById("hide-{{ .Id }}")
+ sensitive.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: block;"; document.getElementById("sensitive-{{ .Id }}").style="display: none;"; document.getElementById("hide-{{ .Id }}").style="display: block; cursor: pointer;"}
+ hide.onclick = function(){document.getElementById("media-{{ .Id }}").style="display: none;"; document.getElementById("sensitive-{{ .Id }}").style="display: block;"; document.getElementById("hide-{{ .Id }}").style="display: none;"}
+ sensitive.style = "display: block"
+ media.style = "display: none;"
+ }
if(getMIMEType({{ (index .Attachment 0).MediaType }}) == "image"){
var img = document.createElement("img");