Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
bumaociyuan committed Jun 13, 2016
1 parent d6c6e43 commit 68b90de
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
19 changes: 18 additions & 1 deletion bin/ios-ipa-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,27 @@ function main() {
};

var app = express();
app.use('/', express.static(__dirname + '/' + ipasDir));
app.use('/public', express.static(path.join(__dirname, '..', 'public')));
app.use('/cer', express.static(globalCerFolder));

app.get('/ipa/:ipa', function(req, res) {
var filename = ipasDir + '/' + req.params.ipa;
console.log(filename);

// This line opens the file as a readable stream
var readStream = fs.createReadStream(filename);

// This will wait until we know the readable stream is actually valid before piping
readStream.on('open', function() {
// This just pipes the read stream to the response object (which goes to the client)
readStream.pipe(res);
});

// This catches any errors that happen while creating the readable stream (usually invalid names)
readStream.on('error', function(err) {
res.end(err);
});
});
app.get(['/', '/download'], function(req, res, next) {

fs.readFile(path.join(__dirname, '..', 'templates') + '/download.html', function(err, data) {
Expand Down
2 changes: 1 addition & 1 deletion generate-certificate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ blackhole="/dev/null"

openssl genrsa -out "$cerDir"myCA.key 2048 2> $blackhole

openssl req -x509 -new -key "$cerDir"myCA.key -out "$cerDir"myCA.cer -days 730 -subj /CN="ios-ipa-server Custom CA" 2> $blackhole
openssl req -x509 -new -key "$cerDir"myCA.key -out "$cerDir"myCA.cer -days 730 -subj /CN="ios-ipa-server "$ip" Custom CA" 2> $blackhole

openssl genrsa -out "$cerDir"mycert1.key 2048 2> $blackhole

Expand Down
2 changes: 1 addition & 1 deletion templates/template.plist
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<key>kind</key>
<string>software-package</string>
<key>url</key>
<string>https://{{ip}}:{{port}}/{{name}}.ipa</string>
<string>https://{{ip}}:{{port}}/ipa/{{name}}.ipa</string>
</dict>
</array>
<key>metadata</key>
Expand Down

0 comments on commit 68b90de

Please sign in to comment.