Skip to content
This repository has been archived by the owner on Apr 26, 2022. It is now read-only.

Commit

Permalink
Fixing mobile sharing, adding fast scan mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mchristopher committed Jul 28, 2016
1 parent a45d02a commit 8e83eca
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 27 deletions.
6 changes: 3 additions & 3 deletions distrib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ find . -name "*.pyc" -delete
rm -fr map/pogom.db

rm -fr PokemonGoMap-OSX.zip
node_modules/.bin/electron-packager . "Pokemon GO Live Map" --platform=darwin --arch=x64 --icon=pokemon.icns --overwrite --prune --osx-sign.identity="Mac Developer: Mike Christopher (35938FGD4K)" --ignore=PokemonGoMap-Lin-x64.zip --ignore=PokemonGoMap-OSX.zip --ignore=PokemonGoMap-Win.zip --ignore=map/ve --ignore="map/Easy Setup" --ignore=distrib.sh --ignore=pywin --ignore=package_python.sh
node_modules/.bin/electron-packager . "Pokemon GO Live Map" --platform=darwin --arch=x64 --icon=pokemon.icns --overwrite --prune --osx-sign.identity="Mac Developer: Mike Christopher (35938FGD4K)" --ignore=win32output --ignore=PokemonGoMap-Lin-x64.zip --ignore=PokemonGoMap-OSX.zip --ignore=PokemonGoMap-Win.zip --ignore=map/ve --ignore="map/Easy Setup" --ignore=distrib.sh --ignore=pywin --ignore=package_python.sh
cd "Pokemon GO Live Map-darwin-x64"
zip -9ryv ../PokemonGoMap-OSX.zip .
cd ..

rm -fr PokemonGoMap-Win.zip
node_modules/.bin/electron-packager . "Pokemon GO Live Map" --platform=win32 --arch=ia32 --icon=pokemon.ico --overwrite --prune --version-string.ProductName="Pokemon GO Live Map" --ignore=map/ve --ignore=PokemonGoMap-Lin-x64.zip --ignore=PokemonGoMap-OSX.zip --ignore=PokemonGoMap-Win.zip --ignore="map/Easy Setup" --ignore=distrib.sh --ignore=package_python.sh
node_modules/.bin/electron-packager . "Pokemon GO Live Map" --platform=win32 --arch=ia32 --icon=pokemon.ico --overwrite --prune --version-string.ProductName="Pokemon GO Live Map" --ignore=map/ve --ignore=win32output --ignore=PokemonGoMap-Lin-x64.zip --ignore=PokemonGoMap-OSX.zip --ignore=PokemonGoMap-Win.zip --ignore="map/Easy Setup" --ignore=distrib.sh --ignore=package_python.sh
cd "Pokemon GO Live Map-win32-ia32"
zip -9rv ../PokemonGoMap-Win.zip .
cd ..

#grunt create-windows-installer

rm -fr PokemonGoMap-Lin-x64.zip
node_modules/.bin/electron-packager . "Pokemon GO Live Map" --platform=linux --arch=x64 --icon=pokemon.ico --overwrite --prune --ignore=map/ve --ignore=PokemonGoMap-Lin-x64.zip --ignore=PokemonGoMap-OSX.zip --ignore=PokemonGoMap-Win.zip --ignore="map/Easy Setup" --ignore=distrib.sh --ignore=package_python.sh --ignore=pywin
node_modules/.bin/electron-packager . "Pokemon GO Live Map" --platform=linux --arch=x64 --icon=pokemon.ico --overwrite --prune --ignore=map/ve --ignore=win32output --ignore=PokemonGoMap-Lin-x64.zip --ignore=PokemonGoMap-OSX.zip --ignore=PokemonGoMap-Win.zip --ignore="map/Easy Setup" --ignore=distrib.sh --ignore=package_python.sh --ignore=pywin
cd "Pokemon GO Live Map-linux-x64"
zip -9ryv ../PokemonGoMap-Lin-x64.zip .
cd ..
28 changes: 22 additions & 6 deletions login.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ <h4>Scanning Options</h4>
</span>
</div>
</div>
<div class="col-xs-8 col-xs-offset-2">
<div class="row">
<div class="col-xs-12">
<div class="col-xs-8 col-xs-offset-2">
<div class="checkbox">
<label>
<input type="checkbox" id="fast_scan">
Fast scanning mode
</label>
</div>
</div>
</div>
</div>
<br>
<div class="row">
<span>
This will increase scanning speed, but may be less accurate.
</span>
</div>
</div>
</div>

<hr>
Expand Down Expand Up @@ -235,7 +255,7 @@ <h4>Send your donation to the following address:</h4>

// Get checkbox state
[
'remember', 'is_public'//, 'showgym', 'showstop', 'onlylure'
'remember', 'is_public', 'fast_scan'
].forEach(function(elem){
if (localStorage.getItem(elem)) {
document.getElementById(elem).checked = (
Expand Down Expand Up @@ -524,11 +544,7 @@ <h4>Send your donation to the following address:</h4>
}
ipcRenderer.send('startPython', auth, code, geoLat, geoLon, {
is_public: checked('is_public'),
// show_gyms: checked('showgym'),
// show_pokestops: checked('showstop'),
// only_stops_with_lures: checked('onlylure'),
// filter_pokemon: $('#filter_type').val(),
// pokemon_ids: $('#pokeids').val(),
fast_scan: checked('fast_scan'),
radius: $('#radius').val(),
username: $('#ptc_username').val(),
password: $('#ptc_password').val(),
Expand Down
25 changes: 13 additions & 12 deletions main.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ <h2 id="sharing" class="sharing-on">Enabled</h2>
});

ipcRenderer.on('server-up', function(evt, url) {
console.log('server up');
console.log('server up: ' + url);
serverUrl = url;
serverUp(url);
});

Expand All @@ -172,10 +173,11 @@ <h2 id="sharing" class="sharing-on">Enabled</h2>
});

function handleServerStatus(msg) {
if (msg.indexOf('Completed ') >= 0) {
if (msg.indexOf('Upserted ') >= 0) {
$('#api-status-waiting,#api-status-down').hide();
$('#api-status-up').show();
} else if (msg.indexOf('server seems to be down') >= 0) {
} else if (msg.indexOf('server seems to be down') >= 0 ||
msg.indexOf('heavy load') >= 0) {
$('#api-status-waiting,#api-status-up').hide();
$('#api-status-down').show();
}
Expand All @@ -190,13 +192,11 @@ <h2 id="sharing" class="sharing-on">Enabled</h2>
}

function serverUp(url) {
serverUrl = url;
try {
mapView.loadURL(serverUrl);
$('#loading').hide();
$('#control').show();
} catch (e) {
console.log(e)
setTimeout(function() {serverUp(url)}, 500);
}
}
Expand Down Expand Up @@ -233,8 +233,8 @@ <h2 id="sharing" class="sharing-on">Enabled</h2>
console.log('No url received');
return;
}
console.log(url);
$("#mobileToggle").prop("disabled",false);
console.log('Got URL: ' + url);
$('#not-sharing').hide();
$('.sharing-on').show();
$('#sharing-url').html(url);
Expand All @@ -251,6 +251,13 @@ <h2 id="sharing" class="sharing-on">Enabled</h2>
}

function toggleMobile() {
if(serverUrl == null) {
ipcRenderer.send('getServer');
setTimeout(function() {
console.log('Attempting to get server address...');
toggleMobile();
}, 500);
}
$("#mobileToggle").prop("disabled",true);
if (mobileRunning) {
ngrok.disconnect();
Expand All @@ -262,12 +269,6 @@ <h2 id="sharing" class="sharing-on">Enabled</h2>
}
}

function setLocation() {
geoLat = $('#lat').val();
geoLon = $('#lon').val();
request.get(serverUrl + '/next_loc?lat=' + geoLat + '&lon=' + geoLon);
}

$( document ).ready(function(){
ipcRenderer.send('getServer');
$('#lat').val(geoLat);
Expand Down
13 changes: 8 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,12 @@ function startPython(auth, code, lat, long, opts) {

if (opts.is_public) {
cmdLine.push('--host');
cmdLine.push('0.0.0.0')
cmdLine.push('0.0.0.0');
}

if (opts.fast_scan) {
cmdLine.push('--num-threads');
cmdLine.push('5');
}

if (opts.maps_api_key) {
Expand Down Expand Up @@ -261,12 +266,10 @@ function startPython(auth, code, lat, long, opts) {
});

var rq = require('request-promise');
var pyAddr = 'http://127.0.0.1:' + py_port;
var pyAddr = 'http://localhost:' + py_port;

var openWindow = function(){
mainWindow.webContents.send('server-up', mainAddr);
mainWindow.webContents.executeJavaScript(
'serverUp("'+mainAddr+'")');
mainWindow.on('closed', function() {
mainWindow = null;
if (subpy && subpy.pid) {
Expand All @@ -280,7 +283,7 @@ function startPython(auth, code, lat, long, opts) {
portfinder.getPort(function(err, express_port) {
logData('Got open express port: ' + express_port);

mainAddr = 'http://127.0.0.1:' + express_port;
mainAddr = 'http://localhost:' + express_port;

var express_app = express();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "Mike Christopher",
"repository": "https://github.com/mchristopher/PokemonGo-DesktopMap",
"license": "MIT",
"version" : "0.1.4",
"version" : "0.1.5",
"main" : "main.js",
"scripts": {
"postinstall": "cd ./map/ && pip install -r requirements.txt",
Expand Down

0 comments on commit 8e83eca

Please sign in to comment.