Skip to content

Commit db8efb5

Browse files
committed
correcting merge
2 parents 9ad3e67 + 22cc329 commit db8efb5

File tree

21 files changed

+139
-55
lines changed

21 files changed

+139
-55
lines changed

coder-base/apps/auth/app.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,8 @@ exports.api_addpassword_handler = function( req, res ) {
351351
//device_settings.device_name = devicename;
352352
var erroutput = "";
353353
var output = "";
354-
var setpass = spawn( '/usr/bin/sudo', ['/usr/bin/passwd', 'pi'] );
354+
var setpipass = process.cwd() + '/sudo_scripts/setpipass';
355+
var setpass = spawn( '/usr/bin/sudo', [setpipass] );
355356
setpass.stdout.on( 'data', function( d ) {
356357
output += d;
357358
});
@@ -435,7 +436,8 @@ exports.api_changepassword_handler = function( req, res ) {
435436
//device_settings.device_name = devicename;
436437
var erroutput = "";
437438
var output = "";
438-
var setpass = spawn( '/usr/bin/sudo', ['/usr/bin/passwd', 'pi'] );
439+
var setpipass = process.cwd() + '/sudo_scripts/setpipass';
440+
var setpass = spawn( '/usr/bin/sudo', [setpipass] );
439441
setpass.stdout.on( 'data', function( d ) {
440442
output += d;
441443
});

coder-base/apps/eyeball/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"created": "2013-03-15",
3-
"modified": "2013-06-26",
3+
"modified": "2013-07-08",
44
"color": "#f39c12",
55
"author": "Justin Windle",
66
"name": "Eyeball",

coder-base/apps/hello_coder/meta.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"created": "2013-05-08",
3+
<<<<<<< HEAD
34
"modified": "2013-07-17",
5+
=======
6+
"modified": "2013-07-08",
7+
>>>>>>> 22cc3296fd20d049c9cee6e700e6e8a80380909c
48
"color": "#d977d4",
59
"author": "Jason Striegel",
610
"name": "Hello Coder",

coder-base/apps/wifi/app.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ var mustache = require('mustache');
2222
var util = require('util');
2323
var fs = require('fs');
2424

25+
var sudoscripts = process.cwd() + '/sudo_scripts';
26+
2527
exports.settings={};
2628
//These are dynamically updated by the runtime
2729
//settings.appname - the app id (folder) where your app is installed
@@ -154,7 +156,7 @@ var saveWifiConfigEntry = function( configdata ) {
154156

155157
exports.api_reboot_handler = function( req, res ) {
156158
var spawn = require('child_process').spawn;
157-
var rebootproc = spawn( '/sbin/shutdown', ['-r', 'now'] );
159+
var rebootproc = spawn( '/usr/bin/sudo', [ sudoscripts + '/reboot'] );
158160
rebootproc.addListener( 'exit', function( code, signal ) {
159161
res.json( { status: 'success' } );
160162
});
@@ -166,19 +168,19 @@ exports.api_wifi_list_handler = function( req, res ) {
166168
var data = "";
167169

168170
var scanStep1 = function( ) {
169-
var scanproc = spawn( '/sbin/wpa_cli', ['ap_scan', '2'] );
171+
var scanproc = spawn( '/usr/bin/sudo', [ sudoscripts + '/wpa_cli_apscan'] );
170172
scanproc.addListener( 'exit', function( code, signal ) {
171173
scanStep2();
172174
});
173175
};
174176
var scanStep2 = function( ) {
175-
var scanproc = spawn( '/sbin/wpa_cli', ['scan'] );
177+
var scanproc = spawn( '/usr/bin/sudo', [ sudoscripts + '/wpa_cli_scan'] );
176178
scanproc.addListener( 'exit', function( code, signal ) {
177179
scanStep3();
178180
});
179181
};
180182
var scanStep3 = function( ) {
181-
var scanproc = spawn( '/sbin/wpa_cli', ['scan_results'] );
183+
var scanproc = spawn( '/usr/bin/sudo', [ sudoscripts + '/wpa_cli_scanresults'] );
182184
scanproc.stdout.on( 'data', function(d) { data += d; } );
183185
scanproc.addListener( 'exit', function( code, signal ) {
184186
returnData();

coder-base/config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11

22
exports.listenIP = null; //Defaults to *
3-
exports.listenPort = '443'; //the SSL port things run on
4-
exports.httpListenPort = '80'; //this will all be redirected to SSL
3+
exports.listenPort = '8081'; //the SSL port things run on
4+
exports.httpListenPort = '8080'; //this will all be redirected to SSL
55
exports.cacheApps = true;
6+
exports.httpVisiblePort = '80'; //forwarded http port the user sees
7+
exports.httpsVisiblePort = '443'; //forwarded https port the user sees
68

79

810
//SSL Info

coder-base/server.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var apphandler = function( req, res, appdir ) {
6969
auth = require(appdir + "auth" + "/app");
7070
user = auth.isAuthenticated(req, res);
7171
if ( !user && publicAllowed.indexOf( appname ) < 0) {
72-
res.redirect("https://" + getHost(req) + ":" + config.listenPort + '/app/auth' );
72+
res.redirect("https://" + getHost(req) + ":" + config.httpsVisiblePort + '/app/auth' );
7373
return;
7474
}
7575

@@ -262,8 +262,8 @@ var redirectapp = express();
262262
params.extend( redirectapp );
263263
redirectapp.engine( 'html', cons.mustache );
264264
redirectapp.all( /.*/, function( req, res ) {
265-
util.log( 'redirect: ' + getHost(req) + " " + config.listenPort + " " + req.url );
266-
res.redirect("https://" + getHost(req) + ":" + config.listenPort + req.url);
265+
util.log( 'redirect: ' + getHost(req) + " " + config.httpsVisiblePort + " " + req.url );
266+
res.redirect("https://" + getHost(req) + ":" + config.httpsVisiblePort + req.url);
267267
});
268268

269269
startSSL();

coder-base/sudo_scripts/reboot

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
/sbin/shutdown -r now

coder-base/sudo_scripts/setpipass

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
/usr/bin/passwd pi
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
/sbin/wpa_cli scan

coder-base/sudo_scripts/wpa_cli_scan

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
/sbin/wpa_cli ap_scan 2
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
/sbin/wpa_cli scan_results

installer/macosx/CoderSetup.py

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -27,47 +27,57 @@
2727
import tkFont
2828
import threading
2929

30-
BGCOLOR = "#f0f0f0"
31-
ACTIVECOLOR = "#55E7FF"
32-
TEXTCOLOR = "#999999"
33-
PROGRESSBG = "#909090"
34-
30+
WINWIDTH = 776
31+
WINHEIGHT = 390
32+
BGCOLOR = "#3BD7EA"
33+
ACTIVECOLOR = "#3BD7EA"
34+
TEXTCOLOR = "#FFFFFF"
35+
PROGRESSBG = "#FFFFFF"
36+
BTNTEXT = "#2AD4E7"
37+
BTNCOLOR = "#FFFFFF"
3538

3639
class Application(Frame):
3740

41+
def createStartButton(self, master, onclick):
42+
b = Label( master )
43+
b.config( text="START", highlightthickness=1, highlightbackground=ACTIVECOLOR, background=BTNCOLOR, foreground=BTNTEXT, width=12, height=3 )
44+
b.bind("<Button-1>", onclick)
45+
b.place( x=336, y=80, anchor=NW )
46+
return b
47+
3848
def createNextButton(self, master, onclick):
3949
b = Label( master )
40-
b.config( text="NEXT", highlightthickness=1, highlightbackground=ACTIVECOLOR, width=10, height=3, foreground=TEXTCOLOR )
50+
b.config( text="NEXT", highlightthickness=1, highlightbackground=ACTIVECOLOR, background=BTNCOLOR, foreground=BTNTEXT, width=12, height=3 )
4151
b.bind("<Button-1>", onclick)
42-
b.place( x=900, y=230, anchor=NW )
52+
b.place( x=336, y=80, anchor=NW )
4353
return b
4454

4555
def createDoneButton(self, master, onclick):
4656
b = Label( master )
47-
b.config( text="DONE", highlightthickness=1, highlightbackground=ACTIVECOLOR, width=10, height=3, foreground=TEXTCOLOR )
57+
b.config( text="OK", highlightthickness=1, highlightbackground=ACTIVECOLOR, background=BTNCOLOR, foreground=BTNTEXT, width=12, height=3 )
4858
b.bind("<Button-1>", onclick)
49-
b.place( x=900, y=230, anchor=NW )
59+
b.place( x=336, y=80, anchor=NW )
5060
return b
5161

5262
def createStartOverButton(self, master, onclick):
5363
b = Label( master )
54-
b.config( text="START OVER", highlightthickness=1, highlightbackground=ACTIVECOLOR, width=15, height=3, foreground=TEXTCOLOR )
64+
b.config( text="START OVER", highlightthickness=1, highlightbackground=ACTIVECOLOR, background=BTNCOLOR, foreground=BTNTEXT, width=12, height=3 )
5565
b.bind("<Button-1>", onclick)
56-
b.place( x=860, y=230, anchor=NW )
66+
b.place( x=336, y=80, anchor=NW )
5767
return b
5868

5969
def createFormatButton(self, master, onclick):
6070
b = Label( master )
61-
b.config( text="FORMAT", highlightthickness=1, highlightbackground=ACTIVECOLOR, width=15, height=3, foreground=TEXTCOLOR )
71+
b.config( text="INSTALL", highlightthickness=1, highlightbackground=ACTIVECOLOR, background=BTNCOLOR, foreground=BTNTEXT, width=12, height=3 )
6272
b.bind("<Button-1>", onclick)
63-
b.place( x=860, y=230, anchor=NW )
73+
b.place( x=336, y=80, anchor=NW )
6474
return b
6575

6676
def createInstructionTxt(self, master, text):
67-
instructionFont = tkFont.Font(family="Helvetica", size=20)
77+
instructionFont = tkFont.Font(family="Helvetica", size=18)
6878
instruction = Label( master, background=BGCOLOR, foreground=TEXTCOLOR, font=instructionFont )
6979
instruction["text"] = text
70-
instruction.place( relx=0.5, y=50, anchor=N )
80+
instruction.place( relx=0.5, y=14, anchor=N )
7181
return instruction
7282

7383

@@ -79,35 +89,36 @@ def createWidgets(self):
7989
#self.QUIT.place( relx=0, rely=1, anchor=SW )
8090

8191

82-
self.step1Frame = Frame( width=1000, height=300, background=BGCOLOR )
92+
self.step1Frame = Frame( width=WINWIDTH, height=190, background=BGCOLOR )
8393

84-
self.step1Frame.instruction = self.createInstructionTxt( self.step1Frame, "Remove any SD Cards from your computer and click Next." )
85-
self.step1Frame.nextButton = self.createNextButton( self.step1Frame, self.preStep2 )
94+
self.step1Frame.instruction = self.createInstructionTxt( self.step1Frame, "Remove any SD Cards from your computer and click Start." )
95+
self.step1Frame.nextButton = self.createStartButton( self.step1Frame, self.preStep2 )
8696

8797

88-
self.step2Frame = Frame( width=1000, height=300, background=BGCOLOR )
98+
self.step2Frame = Frame( width=WINWIDTH, height=190, background=BGCOLOR )
8999
self.step2Frame.nextButton = self.createNextButton( self.step2Frame, self.preStep3 )
90-
self.step2Frame.instruction = self.createInstructionTxt( self.step2Frame, "Now insert the SD Card you wish to format with Coder." )
100+
self.step2Frame.instruction = self.createInstructionTxt( self.step2Frame, "Insert an SD Card you wish to format with Coder." )
91101

92102

93-
self.step3Frame = Frame( width=1000, height=300, background=BGCOLOR )
103+
self.step3Frame = Frame( width=WINWIDTH, height=190, background=BGCOLOR )
94104
self.step3Frame.nextButton = self.createFormatButton( self.step3Frame, self.preStep4 )
95-
self.step3Frame.instruction = self.createInstructionTxt( self.step3Frame, "Click Format to completely erase this SD Card and install Coder." )
96-
self.step3Frame.progress = Meter( self.step3Frame, width=800, height=2, bg=PROGRESSBG, progcolor=ACTIVECOLOR )
105+
self.step3Frame.instruction = self.createInstructionTxt( self.step3Frame, "Click Install to format this SD Card and install Coder." )
106+
self.step3Frame.progress = Meter( self.step3Frame, width=600, height=6, bg=PROGRESSBG, progcolor=ACTIVECOLOR )
97107

98108

99-
self.step4Frame = Frame( width=1000, height=300, background=BGCOLOR )
109+
self.step4Frame = Frame( width=WINWIDTH, height=190, background=BGCOLOR )
100110
self.step4Frame.instruction = Label( self.step4Frame )
101-
self.step4Frame.instruction = self.createInstructionTxt( self.step4Frame, "You can now use this card in Raspberry Pi to run Coder." )
111+
self.step4Frame.instruction = self.createInstructionTxt( self.step4Frame, "Coder has been successfully installed. You may now remove your SD Card.\nFollow instructions at goo.gl/coder to get started." )
112+
self.step4Frame.instruction.place( relx=0.5, y=8, anchor=N )
102113
self.step4Frame.doneButton = self.createDoneButton( self.step4Frame, self.doneClick )
103114

104-
self.errorFrame = Frame( width=1000, height=300, background=BGCOLOR )
115+
self.errorFrame = Frame( width=WINWIDTH, height=190, background=BGCOLOR )
105116
self.errorFrame.soButton = self.createStartOverButton( self.errorFrame, self.step1 )
106117
self.errorFrame.instruction = Label( self.errorFrame )
107118
self.errorFrame.instruction = self.createInstructionTxt( self.errorFrame, "Error" )
108119

109120

110-
self.workingFrame = Frame( width=1000, height=300, background=BGCOLOR )
121+
self.workingFrame = Frame( width=WINWIDTH, height=190, background=BGCOLOR )
111122
self.workingFrame.instruction = Label( self.workingFrame )
112123
self.workingFrame.instruction = self.createInstructionTxt( self.workingFrame, "Thinking..." )
113124

@@ -117,7 +128,7 @@ def createWidgets(self):
117128
self.logo.config( background=BGCOLOR, image = self.logoimg )
118129

119130

120-
self.logo.place( x=340, y=100, anchor=NW )
131+
self.logo.place( x=170, y=55, anchor=NW )
121132
#self.logo.config( image = self.logoimg )
122133
#self.logo.geometry("+%d+%d" % (self.winfo_rootx()+50,
123134
# self.winfo_rooty()+50))
@@ -189,16 +200,16 @@ def preStep3( self, event=None ):
189200
self.errorRetry( "Your card wasn't correctly detected. Let's try again." )
190201
#self.errorRetry( "Error: found " + str( len( self.newDrives ) ) + " new disks inserted but expected 1" )
191202
else:
192-
self.showWorking( "Device found." )
203+
self.showWorking( "SD Card found." )
193204
self.update()
194205
time.sleep(2)
195206
self.step3()
196207

197208
def step3( self, event=None ):
198209
self.unPlace()
199210
self.step3Frame.progress.place_forget()
200-
self.step3Frame.nextButton.place( x=860, y=230, anchor=NW )
201-
self.step3Frame.instruction['text'] = "Click Format to completely erase this SD Card and install Coder."
211+
self.step3Frame.nextButton.place( x=336, y=80, anchor=NW )
212+
self.step3Frame.instruction['text'] = "Click Install to format this SD Card and install Coder."
202213
self.step3Frame.place( relx=0, rely=1, anchor=SW )
203214

204215

@@ -207,8 +218,8 @@ def preStep4( self, event=None ):
207218

208219
self.update_idletasks();
209220
self.step3Frame.nextButton.place_forget()
210-
self.step3Frame.progress.place( relx=0.5, y=100, anchor=N )
211-
self.step3Frame.instruction['text'] = "Writing to SD Card..."
221+
self.step3Frame.progress.place( relx=0.5, y=85, anchor=N )
222+
self.step3Frame.instruction['text'] = "Installing Coder on your SD Card."
212223
self.update_idletasks();
213224

214225
formatProgress = 0.0
@@ -251,7 +262,7 @@ def errorRetry( self, message ):
251262

252263
def __init__(self, master=None):
253264
Frame.__init__(self, master)
254-
self.config(width = 1000, height = 500, background="#f0f0f0")
265+
self.config(width = WINWIDTH, height = WINHEIGHT, background=BGCOLOR)
255266
self.createMenu()
256267
self.pack_propagate(0)
257268
self.pack()
@@ -364,7 +375,7 @@ def formatSDDevice():
364375
root = Tk()
365376
screen_width = root.winfo_screenwidth()
366377
screen_height = root.winfo_screenheight()
367-
root.geometry("1000x500+%d+%d" % (screen_width/2-500, screen_height/2-250))
378+
root.geometry("%dx%d+%d+%d" % (WINWIDTH, WINHEIGHT, screen_width/2-500, screen_height/2-250))
368379
root.wm_title("Coder for Pi")
369380
root.wm_client("Coder for Pi")
370381
root.lift()

installer/macosx/codersd.icns

535 KB
Binary file not shown.

installer/macosx/installerlogo.gif

21.2 KB
Loading
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# The init.d script will only run if this variable non-empty.
2-
CODER_USER="root" # !!!CHANGE THIS!!!!
2+
CODER_USER="coder" # !!!should not be root!!!!
33

44
# Should we run at startup?
55
RUN_AT_STARTUP="YES"

raspbian-addons/etc/init.d/coder-daemon

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
1818
DESC="Coder Server"
1919
NAME="coder-daemon"
2020
DAEMON=/usr/bin/nodejs
21-
DAEMON_ARGS="/home/pi/coder/coder-base/server.js"
22-
DAEMON_PATH="/home/pi/coder/coder-base/"
21+
DAEMON_ARGS="/home/coder/coder-dist/coder-base/server.js"
22+
DAEMON_PATH="/home/coder/coder-dist/coder-base/"
2323
PIDFILE=/var/run/$NAME.pid
2424
UMASK=022 # Change this to 0 if running deluged as its own user
2525
PKGNAME=coder-daemon

raspbian-addons/etc/init.d/pull-coder-reset

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ logger="logger -t $prog"
1717
reset_file="/boot/reset.txt"
1818
source_wpa_conf="/etc/wpa_supplicant/wpa_supplicant.conf.reset"
1919
dest_wpa_conf="/etc/wpa_supplicant/wpa_supplicant.conf"
20-
source_device_json="/home/pi/coder/coder-base/device.json.reset"
21-
dest_device_json="/home/pi/coder/coder-base/device.json"
20+
source_device_json="/home/coder/coder-dist/coder-base/device.json.reset"
21+
dest_device_json="/home/coder/coder-dist/coder-base/device.json"
2222

2323
# copy from source to dest if source exists
2424
if [ -f $reset_file ]; then
2525
echo "-----RESET WPA_SUPPLICANT.CONF-----" | $logger
2626
cp $source_wpa_conf $dest_wpa_conf
27-
chmod 600 $dest_wpa_conf
27+
chown root:wpaconfig $dest_wpa_conf
28+
chmod 660 $dest_wpa_conf
2829
echo "-----RESET DEVICE.JSON-----" | $logger
2930
cp $source_device_json $dest_device_json
30-
chown pi $dest_device_json
31+
chown coder $dest_device_json
3132
chmod 600 $dest_device_json
3233
rm -f $reset_file
3334
fi

raspbian-addons/etc/init.d/pull-wpa-supplicant

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ dest_conf="/etc/wpa_supplicant/wpa_supplicant.conf"
2121
if [ -f $source_conf ]; then
2222
echo "-----IMPORTING WPA_SUPPLICANT.CONF FROM SD-----" | $logger
2323
cp $source_conf $dest_conf
24-
chmod 600 $dest_conf
24+
chown root:wpaconfig $dest_conf
25+
chmod 660 $dest_conf
2526
rm -f $source_conf
2627
fi
2728

raspbian-addons/etc/iptables.up.rules

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Generated by iptables-save v1.4.14 on Mon Jul 8 15:57:20 2013
2+
*nat
3+
:PREROUTING ACCEPT [99:5850]
4+
:INPUT ACCEPT [113:6746]
5+
:OUTPUT ACCEPT [0:0]
6+
:POSTROUTING ACCEPT [0:0]
7+
-A PREROUTING -p tcp -m tcp --dport 443 -j REDIRECT --to-ports 8081
8+
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
9+
COMMIT
10+
# Completed on Mon Jul 8 15:57:20 2013
11+
# Generated by iptables-save v1.4.14 on Mon Jul 8 15:57:20 2013
12+
*filter
13+
:INPUT ACCEPT [1237:98511]
14+
:FORWARD ACCEPT [0:0]
15+
:OUTPUT ACCEPT [672:465045]
16+
COMMIT
17+
# Completed on Mon Jul 8 15:57:20 2013
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
#restore iptables on boot
3+
4+
iptables-restore < /etc/iptables.up.rules

0 commit comments

Comments
 (0)