mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Start a webextension
This commit is contained in:
parent
5aca6028f9
commit
49dedf3a2f
11 changed files with 53 additions and 4 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -14,5 +14,6 @@ proxy/test
|
||||||
proxy/build
|
proxy/build
|
||||||
proxy/node_modules
|
proxy/node_modules
|
||||||
proxy/spec/support
|
proxy/spec/support
|
||||||
|
proxy/webext/snowflake.js
|
||||||
ignore/
|
ignore/
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
|
|
|
@ -21,14 +21,14 @@ FILES_SPEC = [
|
||||||
'spec/websocket.spec.coffee'
|
'spec/websocket.spec.coffee'
|
||||||
]
|
]
|
||||||
FILES_ALL = FILES.concat FILES_SPEC
|
FILES_ALL = FILES.concat FILES_SPEC
|
||||||
OUTFILE = 'build/snowflake.js'
|
OUTFILE = 'snowflake.js'
|
||||||
STATIC = 'static'
|
STATIC = 'static'
|
||||||
|
|
||||||
copyStaticFiles = ->
|
copyStaticFiles = ->
|
||||||
exec 'cp ' + STATIC + '/* build/'
|
exec 'cp ' + STATIC + '/* build/'
|
||||||
|
|
||||||
compileCoffee = ->
|
compileCoffee = (outDir) ->
|
||||||
exec 'cat ' + FILES.join(' ') + ' | coffee -cs > ' + OUTFILE, (err, stdout, stderr) ->
|
exec 'cat ' + FILES.join(' ') + ' | coffee -cs > ' + outDir + '/' + OUTFILE, (err, stdout, stderr) ->
|
||||||
throw err if err
|
throw err if err
|
||||||
|
|
||||||
task 'test', 'snowflake unit tests', ->
|
task 'test', 'snowflake unit tests', ->
|
||||||
|
@ -48,9 +48,13 @@ task 'test', 'snowflake unit tests', ->
|
||||||
task 'build', 'build the snowflake proxy', ->
|
task 'build', 'build the snowflake proxy', ->
|
||||||
exec 'mkdir -p build'
|
exec 'mkdir -p build'
|
||||||
copyStaticFiles()
|
copyStaticFiles()
|
||||||
compileCoffee()
|
compileCoffee('build')
|
||||||
console.log 'Snowflake prepared.'
|
console.log 'Snowflake prepared.'
|
||||||
|
|
||||||
|
task 'webext', 'build the webextension', ->
|
||||||
|
compileCoffee('webext')
|
||||||
|
console.log 'Webextension prepared.'
|
||||||
|
|
||||||
task 'lint', 'ensure idiomatic coffeescript', ->
|
task 'lint', 'ensure idiomatic coffeescript', ->
|
||||||
proc = spawn 'coffeelint', FILES_ALL, {
|
proc = spawn 'coffeelint', FILES_ALL, {
|
||||||
file: 'coffeelint.json'
|
file: 'coffeelint.json'
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
"test": "cake test",
|
"test": "cake test",
|
||||||
"lint": "cake lint",
|
"lint": "cake lint",
|
||||||
"build": "cake build",
|
"build": "cake build",
|
||||||
|
"webext": "cake webext",
|
||||||
"clean": "cake clean",
|
"clean": "cake clean",
|
||||||
"prepublish": "npm run build",
|
"prepublish": "npm run build",
|
||||||
"start": "node build/snowflake.js"
|
"start": "node build/snowflake.js"
|
||||||
|
|
9
proxy/webext/README.md
Normal file
9
proxy/webext/README.md
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
Build it,
|
||||||
|
|
||||||
|
```
|
||||||
|
cd ..
|
||||||
|
npm install
|
||||||
|
npm run webext
|
||||||
|
```
|
||||||
|
|
||||||
|
and then load this directory as an unpacked extension.
|
BIN
proxy/webext/icons/16-on.png
Normal file
BIN
proxy/webext/icons/16-on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
proxy/webext/icons/16.png
Normal file
BIN
proxy/webext/icons/16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
proxy/webext/icons/32-on.png
Normal file
BIN
proxy/webext/icons/32-on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3 KiB |
BIN
proxy/webext/icons/32.png
Normal file
BIN
proxy/webext/icons/32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
16
proxy/webext/manifest.json
Normal file
16
proxy/webext/manifest.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"manifest_version": 2,
|
||||||
|
"name": "Snowflake",
|
||||||
|
"version": "0.0.0",
|
||||||
|
"description": "Snowflake ...",
|
||||||
|
"background": {
|
||||||
|
"page": "snowflake.html",
|
||||||
|
"persistent": true
|
||||||
|
},
|
||||||
|
"browser_action": {
|
||||||
|
"default_icon": {
|
||||||
|
"16": "icons/16.png",
|
||||||
|
"32": "icons/32.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
proxy/webext/snowflake.html
Normal file
16
proxy/webext/snowflake.html
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<!doctype html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<!-- FIXME: Use a "script" instead of a "page" in the manifest.json -->
|
||||||
|
<script src="tmp.js"></script>
|
||||||
|
<script src="snowflake.js"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<!-- FIXME: Refactor snowflake.js to eliminate the need for this -->
|
||||||
|
<div>
|
||||||
|
<div id="status"></div>
|
||||||
|
<textarea id="msglog" readonly></textarea>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
2
proxy/webext/tmp.js
Normal file
2
proxy/webext/tmp.js
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
// FIXME: Refactor snowflake.js to eliminate the need for this
|
||||||
|
document.cookie = "snowflake-allow=1";
|
Loading…
Add table
Add a link
Reference in a new issue