Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
screen
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
Model registry
Operate
Environments
Monitor
Incidents
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
pub
screen
Commits
423dc940
Commit
423dc940
authored
6 years ago
by
Neil Gershenfeld
Browse files
Options
Downloads
Patches
Plain Diff
add auth
parent
1d1cc1b5
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cast
+3
-0
3 additions, 0 deletions
cast
screen.js
+9
-3
9 additions, 3 deletions
screen.js
viewer.html
+24
-5
24 additions, 5 deletions
viewer.html
with
36 additions
and
8 deletions
cast
0 → 100755
+
3
−
0
View file @
423dc940
#!/bin/bash
cd
~/git/screen
sudo
node screen.js 80 10 10 1234
This diff is collapsed.
Click to expand it.
screen.js
+
9
−
3
View file @
423dc940
...
...
@@ -18,13 +18,17 @@
//
// command line
//
if
(
process
.
argv
.
length
!=
5
)
{
console
.
log
(
"
node screen.js server_port server_update_rate_ms client_update_rate_ms
"
)
if
(
(
process
.
argv
.
length
<
5
)
||
(
process
.
argv
.
length
>
6
)
)
{
console
.
log
(
"
node screen.js server_port server_update_rate_ms client_update_rate_ms
[code]
"
)
process
.
exit
()
}
var
port
=
parseInt
(
process
.
argv
[
2
])
var
server_delay
=
parseFloat
(
process
.
argv
[
3
])
var
client_delay
=
parseFloat
(
process
.
argv
[
4
])
if
(
process
.
argv
.
length
==
6
)
var
code
=
process
.
argv
[
5
]
else
var
code
=
"
''
"
//
// requires
//
...
...
@@ -56,7 +60,9 @@ http.createServer(function(request,response) {
if
(
url
==
'
/
'
)
{
fs
.
readFile
(
'
viewer.html
'
,
function
(
err
,
data
){
response
.
writeHead
(
200
,{
'
Content-Type
'
:
'
text/html
'
});
response
.
end
(
data
)
var
str
=
data
.
toString
()
str
=
str
.
replace
(
'
CODE
'
,
code
)
response
.
end
(
str
)
})
}
else
if
(
url
==
'
/img
'
)
{
...
...
This diff is collapsed.
Click to expand it.
viewer.html
+
24
−
5
View file @
423dc940
<html>
<body>
<div
id=
"page"
>
<img
id=
"img"
alt=
"waiting for screen transmission to start"
><br>
<a
href=
"screen.js"
>
screen.js
</a>
<a
href=
"viewer.html"
>
viewer.html
</a>
</div>
<script
type=
"text/javascript"
>
//
// viewer.html
// screen.js content viewer
// Neil Gershenfeld
// 2/
9
/1
7
// 2/
26
/1
9
//
var
client_delay
initialize
()
update
()
var
code
=
CODE
insecure_auth
()
function
insecure_auth
()
{
if
(
code
==
''
)
{
initialize
()
update
()
}
else
{
var
resp
=
prompt
(
'
screencast code?
'
)
if
(
resp
==
code
)
{
initialize
()
update
()
}
else
{
document
.
body
.
removeChild
(
document
.
getElementById
(
'
page
'
))
document
.
write
(
'
incorrect code
'
)
}
}
}
function
initialize
()
{
var
req
=
new
XMLHttpRequest
()
req
.
open
(
'
GET
'
,
'
/initvars
'
,
true
);
...
...
@@ -48,8 +67,8 @@ function update() {
req
.
addEventListener
(
'
loadend
'
,
function
(
evt
)
{
if
(
evt
.
loaded
==
0
)
{
req
.
abort
()
document
.
getElementById
(
"
img
"
).
alt
=
'
screen transmission ended
'
document
.
getElementById
(
"
img
"
).
src
=
''
document
.
body
.
removeChild
(
document
.
getElementById
(
'
page
'
))
document
.
write
(
'
screen transmission ended
'
)
}
else
{
var
url
=
window
.
URL
.
createObjectURL
(
req
.
response
)
...
...
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