Skip to content

Commit d2b87ce

Browse files
authored
Merge pull request #201 from kzahel/react-ui
React ui
2 parents 91190d2 + ad46f1e commit d2b87ce

File tree

12 files changed

+628
-17
lines changed

12 files changed

+628
-17
lines changed

README.md

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<a target="_blank" href="https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb">![Try it now in CWS](https://raw.github.com/GoogleChrome/chrome-app-samples/master/tryitnowbutton.png "Click here to install this sample from the Chrome Web Store")</a>
22

3-
# Chrome Web Server - an HTTP web server for Chrome (chrome.sockets)
3+
## Web Server for Chrome
4+
5+
an HTTP web server for Chrome (chrome.sockets)
46

57
Get it in the chrome web store:
68
https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb
@@ -28,8 +30,7 @@ How to include into your own chrome app
2830

2931
run minimize.sh to concatenate all the required files together and then include the resulting wsc-chrome.min.js in your project. Here is an example of another project's usage: https://github.com/zebradog/kiosk/blob/f7a398f697edc1c22b90c14f959779f1e850012a/src/js/main.js#L124
3032

31-
===
32-
Basic usage:
33+
### Basic usage:
3334

3435
```
3536
var app = new WSC.WebApplication(options)
@@ -82,14 +83,25 @@ handlers is an array of 2 element arrays where the first item is a regular expre
8283
```
8384

8485

85-
====
86-
Building
87-
====
88-
Unfortunately there is a build process if you want to run this from source directly because I am using a Polymer (polymer-project.org) user interface. There is a bower.json in the polymer-ui folder and you will need to install node+npm+bower and then run bower install from that folder. Oh, and then you will need to "Refactor for CSP" (chrome apps do not allow inline scripts), one way of doing this is using https://chrome.google.com/webstore/detail/chrome-dev-editor-develop/pnoffddplpippgcfjdhbmhkofpnaalpg (open the folder and right click and select refactor for CSP)
8986

90-
I'm now using a script that can do this (look in polymer-ui/build.sh. You'll need to npm install -g vulcanize crisper)
87+
### Building
88+
89+
```
90+
cd web-server-chrome
91+
cd makedeps
92+
npm install
93+
npm run make # this builds the app dependencies such as react and material-ui into a bundle
94+
cd ../react-ui
95+
npm run watch # Press ctrl-c if you just want to build it once.
96+
# press ctrl-C if you are done editing
97+
cd ../
98+
bash package.sh
99+
```
100+
101+
This creates package.zip, which can then be distributed.
102+
91103

92-
====
104+
### Where to get it
93105

94106
Get it in the chrome web store:
95107
https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb
@@ -101,7 +113,7 @@ handle range requests. It also sets mime types correctly.
101113
Here is an example project based on it:
102114
https://chrome.google.com/webstore/detail/flv-player/dhogabmliblgpadclikpkjfnnipeebjm
103115

104-
====
116+
---
105117

106118
MIT license
107119

background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ function launch(launchData) {
207207
height: 700 }
208208
}
209209
//var page = 'index.html'
210-
var page = 'polymer-ui/index.html'
210+
var page = 'react-ui/index.html'
211211
chrome.app.window.create(page,
212212
opts,
213213
function(mainWindow) {

handlers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@
474474
}
475475
}, WSC.BaseHandler.prototype)
476476

477-
if (chrome.runtime.id == WSC.store_id) {
477+
if (chrome.runtime.id == WSC.store_id || true) {
478478

479479
chrome.runtime.getPackageDirectoryEntry( function(pentry) {
480480
var template_filename = 'directory-listing-template.html'

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"short_name": "Web Server",
55
"description": "A Web Server for Chrome, serves web pages from a local folder over the network, using HTTP. Runs offline.",
66
"author": "Kyle Graehl",
7-
"version": "0.4.8",
7+
"version": "0.5.0",
88
"manifest_version": 2,
99
"offline_enabled": true,
1010
"minimum_chrome_version": "45",

manifest.json.scratch

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
"key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv7ZULSqbpKKQ1QP5Tb9f8g306PlY87OYYlXBrp7PlBHd/LJMUBDNWMCrWhpFR8sIjpvHjYipDr60j+2i7vj3PZlwbxZ7e3x+2A4cQt1LaC1PVZ6avnbsV0YMkFQi8H5f7NQiBKE2i2/Z/kB2r/DzyiUdGW63/sgjpBvgDCCMysHl3NWCnHqIOOtGD8SFlT5clgNJgVOgosFwHE4yYJDpIkvJ+nrLia9v6V/Cyc8ITEd0njvsp0q0aFJp332Ua/RPvh/m1UKcj8f3FNbaCrdScFzfKo5UNmifKLGhT377xhnvhOKuEJbyghNkPheMUquwVpTEHdRFMm7nVcLAt/kuZwIDAQAB",
1+
// this is the production app key
2+
"key":"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv7ZULSqbpKKQ1QP5Tb9f8g306PlY87OYYlXBrp7PlBHd/LJMUBDNWMCrWhpFR8sIjpvHjYipDr60j+2i7vj3PZlwbxZ7e3x+2A4cQt1LaC1PVZ6avnbsV0YMkFQi8H5f7NQiBKE2i2/Z/kB2r/DzyiUdGW63/sgjpBvgDCCMysHl3NWCnHqIOOtGD8SFlT5clgNJgVOgosFwHE4yYJDpIkvJ+nrLia9v6V/Cyc8ITEd0njvsp0q0aFJp332Ua/RPvh/m1UKcj8f3FNbaCrdScFzfKo5UNmifKLGhT377xhnvhOKuEJbyghNkPheMUquwVpTEHdRFMm7nVcLAt/kuZwIDAQAB",

package.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ rm package.zip
22

33
#zip package.zip -r * -x package.sh -x *.git* -x "*.*~" -x images/cws_*.png -x *.scratch -x polymer-ui/node-modules/**\* -x wsc-chrome.min.js
44

5-
zip package.zip manifest.json *.js *.html images/200*.png polymer-ui/*.html polymer-ui/*.js polymer-ui/*.css polymer-ui/bower_components/font-roboto/fonts/roboto/Roboto-Bold.ttf -x wsc-chrome.min.js
5+
#zip package.zip manifest.json *.js *.html images/200*.png polymer-ui/*.html polymer-ui/*.js polymer-ui/*.css polymer-ui/bower_components/font-roboto/fonts/roboto/Roboto-Bold.ttf -x wsc-chrome.min.js
6+
7+
zip package.zip manifest.json *.js *.html images/200*.png react-ui/*.html react-ui/nojsx/* assets/* -x wsc-chrome.min.js

polymer-ui/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
not used any more. see https://github.com/kzahel/web-server-chrome/issues/199

react-ui/index.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<html style="overflow-y: auto">
2+
<script src="../chromise.js"></script>
3+
<script src="../assets/bundle.js"></script> <!-- scripts from "makedeps" -->
4+
<body style="margin: 0">
5+
<div id="app"></div>
6+
<script type="module" src="nojsx/index.js"></script>
7+
</body>
8+
</html>

0 commit comments

Comments
 (0)