Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Snowflake
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
shelikhoo
Snowflake
Commits
85625e19
Commit
85625e19
authored
5 years ago
by
Arlo Breault
Browse files
Options
Downloads
Patches
Plain Diff
Count the number of clients the webext has served
parent
91255463
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
proxy/ui.coffee
+14
-0
14 additions, 0 deletions
proxy/ui.coffee
proxy/webext/popup.css
+1
-0
1 addition, 0 deletions
proxy/webext/popup.css
proxy/webext/popup.html
+2
-1
2 additions, 1 deletion
proxy/webext/popup.html
proxy/webext/popup.js
+4
-2
4 additions, 2 deletions
proxy/webext/popup.js
with
21 additions
and
3 deletions
proxy/ui.coffee
+
14
−
0
View file @
85625e19
...
...
@@ -51,13 +51,26 @@ class DebugUI extends UI
class
WebExtUI
extends
UI
port
:
null
stats
:
null
constructor
:
->
@
initStats
()
chrome
.
runtime
.
onConnect
.
addListener
@
onConnect
initStats
:
->
@
stats
=
[
0
]
setInterval
(()
=>
@
stats
.
unshift
0
@
stats
.
splice
24
@
postActive
()
),
60
*
60
*
1000
postActive
:
->
@
port
?
.
postMessage
active
:
@
active
total
:
@
stats
.
reduce
((
t
,
c
)
->
t
+
c
),
0
onConnect
:
(
port
)
=>
@
port
=
port
...
...
@@ -69,6 +82,7 @@ class WebExtUI extends UI
setActive
:
(
connected
)
->
super
connected
if
connected
then
@
stats
[
0
]
+=
1
@
postActive
()
chrome
.
browserAction
.
setIcon
path
:
...
...
This diff is collapsed.
Click to expand it.
proxy/webext/popup.css
+
1
−
0
View file @
85625e19
...
...
@@ -5,6 +5,7 @@ body {
#active
{
padding
:
2em
;
text-align
:
center
;
min-width
:
128px
;
}
.learn
{
...
...
This diff is collapsed.
Click to expand it.
proxy/webext/popup.html
+
2
−
1
View file @
85625e19
...
...
@@ -8,7 +8,8 @@
<body>
<div
id=
"active"
>
<img
src=
"icons/status-off.png"
/>
<p>
Offline
</p>
<p></p>
<p></p>
</div>
<div
class=
"learn"
>
<a
target=
"_blank"
href=
"https://snowflake.torproject.org/"
>
Learn more
</a>
...
...
This diff is collapsed.
Click to expand it.
proxy/webext/popup.js
+
4
−
2
View file @
85625e19
...
...
@@ -7,6 +7,8 @@ port.onMessage.addListener((m) => {
const
div
=
document
.
getElementById
(
'
active
'
);
const
img
=
div
.
querySelector
(
'
img
'
);
img
.
src
=
`icons/status-
${
active
?
"
on
"
:
"
off
"
}
.png`
;
const
p
=
div
.
querySelector
(
'
p
'
);
p
.
innerText
=
active
?
"
Connected
"
:
"
Offline
"
;
const
ps
=
div
.
querySelectorAll
(
'
p
'
);
const
clients
=
active
?
1
:
0
;
ps
[
0
].
innerText
=
`
${
clients
}
client
${(
clients
!==
1
)
?
'
s
'
:
''
}
connected.`
;
ps
[
1
].
innerText
=
`Your snowflake has helped
${
m
.
total
}
user
${(
m
.
total
!==
1
)
?
'
s
'
:
''
}
circumvent censorship in the last 24 hours.`
;
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment