aaronpk / compass Goto Github PK
View Code? Open in Web Editor NEWCompass is a GPS tracking server that stores data in flat files.
Compass is a GPS tracking server that stores data in flat files.
See discussion on #indieweb-dev.
Since Compass does not request scopes, it does not need to request an access token at the token endpoint.
Right now it does so in IndieAuth.php#L77
if($tokenEndpoint) {
$token = \IndieAuth\Client::getAccessToken($tokenEndpoint, $request->input('code'), session('attempted_me'), $this->_redirectURI(), env('BASE_URL'), $request->input('state'));
} else {
$token = \IndieAuth\Client::verifyIndieAuthCode($authorizationEndpoint, $request->input('code'), session('attempted_me'), $this->_redirectURI(), env('BASE_URL'), $request->input('state'));
}
If there is no token endpoint it is already verifying with the authorization endpoint directly, and it does not store the access token, so no need for an extra discovery.
I'd like to be able to define geofences and rules that will run whenever a fence is entered or exited.
Currently I do this with an external script that receives the "ping" from Compass whenever a new location is received. It would be nice to have it integrated and have a better UI.
There should be meta-geofences created by default for locality, region and country boundaries, triggered off of the geocoding done with each location. You should be able to define a web hook to run whenever the locality changes for example.
I spent a few hours trying and failing to get this up and running on my machine, eventually gave up due to php plugin installation issues.
It would be great to have a tested, working docker image for the php portion (not database, redis, nginx, I already have those running).
Really like what this project is doing - however I'm unable to get up and running as there appear to be a number of database migrations missing (presumably as this project was built on top of an existing database structure).
Is there any way to get an indication of the pre-existing database schema so that I can bootstrap my own copy of the project?
Thanks.
Hey Aaron,
I'm a little tired of the ESRI style map as it feels cluttered and at the same time, doesn't have enough information (such as building/business names). I favor the mapbox street map and right now, I sometimes go into the console and switch over to the street map using the following commands -
map.removeLayer(layer);
layer = new L.TileLayer('https://a.tiles.mapbox.com/v4/mapbox.streets-basic/{z}/{x}/{y}.png?access_token=<my_access_token>').addTo(map);
This is obviously not ideal. I'm moving to permanently change the map in the map.js file (for my use), but I'm wondering if this would be a good setting to add to the Settings page. There are a few moving parts to this, so I wanted to discuss this with you -
Do you want me to take a crack at it? I could submit a pull request if/when I get the code ready.
Suddenly, about 10 days ago, I started getting this error when trying to access my database: Whoops, looks like something went wrong.
That's all I can see.
Error log shows:
[Sat Dec 31 06:34:58.604186 2022] [:error] [pid 77843:tid 140111362651904] [client 34.124.232.135:63961] [client 34.124.232.135] ModSecurity: Access denied with code 418 (phase 2). Matched phrase "curl" at ARGS:l. [file "/dh/apache2/template/etc/mod_sec2/99_dreamhost_rules.conf"] [line "133"] [id "1990070"] [msg "Common known arguments for backdoor shell present in ARGS:l"] [hostname "www.compass.jeremycherfas.net"] [uri "/wp-plain.php"] [unique_id "Y7BIkj2g0wAQFF8XGhPWnwAAABI"], referer: www.google.com
[Sat Dec 31 07:52:20.914283 2022] [:error] [pid 83878:tid 140111287150336] [client 34.124.232.135:62246] [client 34.124.232.135] ModSecurity: Access denied with code 418 (phase 2). Matched phrase "curl" at ARGS:l. [file "/dh/apache2/template/etc/mod_sec2/99_dreamhost_rules.conf"] [line "133"] [id "1990070"] [msg "Common known arguments for backdoor shell present in ARGS:l"] [hostname "www.compass.jeremycherfas.net"] [uri "/wp-plain.php"] [unique_id "Y7BatLdVOtUXFx5ZHqbJ2QAAABM"], referer: www.google.com
I'm guessing this may be something new that Dreamhost has instituted, and I am wondering if there is a workaround.
I have asked Dreamhost too.
Thanks
Jeremy
Using a Shortcut to share my location for a limited period, the display shows a dropped pin, but no background tiles.
Getting a 410 Gone for GET https://api.tiles.mapbox.com/v4/mapbox.streets/14/8761/6088.png?access_token=pk.eyXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Does it need a new token, or something else?
Thanks
If the client doesn't get back a 200 OK
response, it will send the same batch of data again. When there is either excessive load on the server, or the phone has a bad network connection, it has happened that the client doesn't get the 200 OK
response and thinks the data isn't sent. In reality, part of the data was written to disk already.
The server should take some measures to prevent the duplicate data from being written. Either:
I got a application_launched_with_location
event today which breaks line 58 in events.js since there is no value for this in the series array.
Hey Aaron,
I'm on the same setup as I made when I installed and configured compass in November of 2017. Nothing has changed on my server, other than potentially the https cert by certbot.
I hadn't logged into Compass since a while so I did today and noticed that it's not showing the database. This is on Firefox 58 on Windows 10. I thought that it might be an FF issue, so I went to my Chrome where I have an older login. Chrome showed my database as expected, along with all my data. Then I went to Chrome incognito mode and it too failed to show me my database.
My login hasn't changed. What does seem to have changed is the username string I get from withKnown.
When I first logged into Compass using withKnown, it showed my username to be -
https://nitinkhanna.withknown.com/profile/nitinkhanna
so that's what I kept using. I used to login using nitinkhanna.withknown.com and it used to work.
Now when I login, it shows the logged in user as -
https://nitinkhanna.withknown.com
Even when I add the profile/nitinkhanna part, it still shows the username as the one above.
So I did the obvious thing and in Chrome, added a User -
https://nitinkhanna.withknown.com
Now I have two users for my database but it still doesn't give me access to the db on the new login.
Overland seems to be working fine in submitting events, so it doesn't seem to be a database issue.
I tried to create a new db with the same name as my old one and it doesn't let me as "That database name is already in use." So that's good. At least the data isn't lost.
Any tips/ideas? If nothing, then could you please guide me on how to recover/change my database so I can potentially just create a new db and drop all my old data into the new one and move the Overland tokens to the new one. Then I can figure out how to deal with this login issue without losing any data.
Thanks!
Nitin
Hi Aaron
I host Compass at Dreamhost, which has now enforced updating to PHP > 7.4, with a monthly fee for any apps that cannot be upgraded. I'd be happy to pay a bounty to have Compass work with PHP 8
Jeremy
Surprisingly, all it took was creating an SQLite file and adopting PR #51 for this to work.
DB_CONNECTION=sqlite
DB_DATABASE=filename
I'm not sure what else might happen
From time to time I get an error in de GPS logger, and /storage/logs/lumen.log
says:
lumen.ERROR: ErrorException: Trying to get property of non-object in /var/www/compass/compass/app/Http/Controllers/Api.php:274
This is because $geocode
, from self::geocode()
is not an object in:
$geocode = self::geocode(['latitude'=>$last_location['geometry']['coordinates'][1], 'longitude'=>$last_location['geometry']['coordinates'][0]]);
$response['geocode'] = [
'full_name' => $geocode->full_name,
'locality' => $geocode->locality,
'country' => $geocode->country
];
And I think that is because self::geocode()
returns a json_decode()
of the cURL response to Atlas.
After a few tries Atlas returns something again, and the party goes on.
There are a few things required during setup that aren't explicitly noted in the readme. Some of them are Lumen framework things, others are just missing. @EdwardHinkle just got everything running and was taking notes.
Hello everyone, i try install the compass server on my local server with mama and i have the message above when i go to "http://localhost/public/"
the message : Sorry, the page you are looking for could not be found.
i check .env file but i don't find the problem.
Any help for running nicely my server?
I like very much your project.
Robert.
This used to work, but I moved the site to another server and now it doesn't.
I log in, select a database, see the map screen. I click on 'settings' but instead of being taken to the settings, I get redirected to the database selection screen.
If I create a brand new database, all works great..
Return info about the current in-progress trip or last trip.
Overland now sends a current
property when also sending a batch that is old. Instead of sending the point from the batch to the web hook, Compass should send the current
if it's present, and return that when last
is queried.
I was on a trip to another country. I'm back now and it suddenly throws 500 errors with overland. I had it running on the airplane, maybe that messed things up somehow?
[2021-10-01 06:38:44] lumen.ERROR: ErrorException: Undefined index: geometry in /opt/compass/compass/app/Http/Controllers/Api.php:280
Stack trace:
#0 /opt/compass/compass/app/Http/Controllers/Api.php(280): Laravel\Lumen\Application->Laravel\Lumen\{closure}(8, 'Undefined index...', '/opt/compass/co...', 280, Array)
#1 [internal function]: App\Http\Controllers\Api->input(Object(Illuminate\Http\Request))
#2 /opt/compass/compass/vendor/illuminate/container/Container.php(507): call_user_func_array(Array, Array)
#3 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1399): Illuminate\Container\Container->call(Array, Array)
#4 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1363): Laravel\Lumen\Application->callControllerCallable(Array, Array)
#5 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1335): Laravel\Lumen\Application->callLumenController(Object(App\Http\Controllers\Api), 'input', Array)
#6 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1303): Laravel\Lumen\Application->callControllerAction(Array)
#7 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1288): Laravel\Lumen\Application->callActionOnArrayBasedRoute(Array)
#8 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1207): Laravel\Lumen\Application->handleFoundRoute(Array)
#9 [internal function]: Laravel\Lumen\Application->Laravel\Lumen\{closure}(Object(Illuminate\Http\Request))
#10 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#11 /opt/compass/compass/vendor/illuminate/session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#12 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#13 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#14 /opt/compass/compass/vendor/illuminate/cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#15 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#16 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#17 /opt/compass/compass/vendor/illuminate/cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#18 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#19 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#20 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#21 /opt/compass/compass/vendor/illuminate/pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#22 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1439): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#23 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1213): Laravel\Lumen\Application->sendThroughPipeline(Array, Object(Closure))
#24 /opt/compass/compass/vendor/laravel/lumen-framework/src/Application.php(1153): Laravel\Lumen\Application->dispatch(NULL)
#25 /opt/compass/compass/public/index.php(28): Laravel\Lumen\Application->run()
#26 {main}
Composer 2.0 will block upper case package name.
Deprecation warning: Your package name p3k/Compass is invalid, it should not contain uppercase characters. We suggest using p3k/compass instead. Make sure you fix this as Composer 2.0 will error.
Currently Compass sends a multipart request with a payload that contains a nested object. Even though Compass is using some pretty experimental Microformats vocabularies, it should still follow the Micropub syntax, so the payload should be switched to a regular JSON payload to contain the nested object, and the route.json
file should be uploaded to the Media Endpoint first.
I'm new to composer, lumen, lavarel, all that. I'm familiar enough with php, but not quite to this level.
Trying to install compass on my own server here, and
when I run the step 'php artisan migrate' I get an error..
ubuntu@instance-20221026-1202:~/Compass/compass$ php artisan migrate
[ErrorException]
Method ReflectionParameter::getClass() is deprecated
I'm stuck.. Any help appreciated!
here's my environment in case that helps:
$uname -a
Linux instance-20221026-1202 5.15.0-1021-oracle #27-Ubuntu SMP Fri Oct 14 20:04:20 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux
$ php --version
PHP 8.1.2-1ubuntu2.6 (cli) (built: Sep 15 2022 11:30:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2-1ubuntu2.6, Copyright (c), by Zend Technologies
$ composer --version
Composer 2.2.6 2022-02-04 17:00:38
thanks
After some thought, I decided it would be better to do this in Compass rather than Overland. See aaronpk/Overland-iOS#40 for more details.
I’ve been running low on disk space on my server and have discovered that storage/framework/cache
on my install of Compass is up to 15G.
Are all those files necessary if I have all the daily .txt
files in the data
folder?
Sometimes when querying /last
, the position from the previous day is returned. This happens shortly after 5pm PDT for example. I suspect it's when there is no data for the current UTC date, so it starts looking for data on the previous day but doesn't start at the end of the day and instead starts looking from the current time on the previous day.
I came up with an interesting problem here
Compass/compass/app/Http/Controllers/Api.php
Line 137 in c17f7b2
I'm storing in the database using no timezone offset. So just Z. But, if I send in an API query with an offset in the timezone, it responds, Exception in Shard.php line 199:
It should respond with a proper API error instead of a "Whoops, looks like something went wrong." message.
Not sure if you have any thoughts on the practical problem I have here. The app I used to send the data didn't have the option to send timestamp with offset so I didn't. I usually figure it out later for display purposes.
Right now trips are stored along with the GPS data, but this can cause problems when creating trip records long after the trip has taken place. (e.g. my car2go import script.)
The documentation does not provide details on creating a database 'user-table'
Following the Lumen documentation I created a users_table; however it does not appear that this has been effective, as compass now errors after indieauth with:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'url' in 'where clause' (SQL: select * from
userswhere
url = https://example.com/ limit 1)
Inspection of the table users
does not show an index for url
I'm trying to use Compass + Overland and am encountering 500 Internal Service Error's when attempting to POST to /api/input
while running in MAMP. I see this same issue when I test locally with Postman. It seems the server is rejecting the request due to invalid content types - "Request failed: unacceptable content-type: text/html"
.
Is there a way to set acceptable content types for the server or is there something else causing this issue?
When testing with Postman, if I send the body GeoJSON data as text/html the server returns a 200 but just can't parse it, if I send as application/json it fails with a 500 even though it's seemingly correctly-formed.
Here's the full printed error Overland's side:
Error Domain=com.alamofire.error.serialization.response Code=-1011 "Request failed: internal server error (500)" UserInfo={NSLocalizedDescription=Request failed: internal server error (500), NSUnderlyingError=0x600000f879c0 {Error Domain=com.alamofire.error.serialization.response Code=-1016 "Request failed: unacceptable content-type: text/html" UserInfo={NSLocalizedDescription=Request failed: unacceptable content-type: text/html, NSErrorFailingURLKey=http://192.168.1.XX/api/input?token=VieLE9Mu3TWRITE, com.alamofire.serialization.response.error.data={length = 4519, bytes = 0x3c21444f 43545950 45206874 6d6c3e0a ... 0a3c2f68 746d6c3e }, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x6000001eed20> { URL: http://192.168.1.XX/api/input?token=VieLE9Mu3TWRITE } { Status Code: 500, Headers {
"Cache-Control" = (
"no-cache, private"
);
Connection = (
close
);
"Content-Length" = (
4519
);
"Content-Type" = (
"text/html; charset=UTF-8"
);
Date = (
"Wed, 04 Sep 2019 05:28:45 GMT"
);
Server = (
"Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.3.7 mod_ssl/2.2.34 OpenSSL/1.0.2o DAV/2 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.10 Perl/v5.24.0"
);
"X-Powered-By" = (
"PHP/7.3.7"
);
} }}}, NSErrorFailingURLKey=http://192.168.1.XX/api/input?token=VieLE9Mu3TWRITE, com.alamofire.serialization.response.error.data={length = 4519, bytes = 0x3c21444f 43545950 45206874 6d6c3e0a ... 0a3c2f68 746d6c3e }, com.alamofire.serialization.response.error.response=<NSHTTPURLResponse: 0x6000001eed20> { URL: http://192.168.1.XX/api/input?token=VieLE9Mu3TWRITE } { Status Code: 500, Headers {
"Cache-Control" = (
"no-cache, private"
);
Connection = (
close
);
"Content-Length" = (
4519
);
"Content-Type" = (
"text/html; charset=UTF-8"
);
Date = (
"Wed, 04 Sep 2019 05:28:45 GMT"
);
Server = (
"Apache/2.2.34 (Unix) mod_wsgi/3.5 Python/2.7.13 PHP/7.3.7 mod_ssl/2.2.34 OpenSSL/1.0.2o DAV/2 mod_fastcgi/mod_fastcgi-SNAP-0910052141 mod_perl/2.0.10 Perl/v5.24.0"
);
"X-Powered-By" = (
"PHP/7.3.7"
);
} }}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.