groundapps / shoppinglist_backend Goto Github PK
View Code? Open in Web Editor NEWSimple Centralized Shoppinglist - php backend
License: GNU General Public License v3.0
Simple Centralized Shoppinglist - php backend
License: GNU General Public License v3.0
Can we create the databases in the INSTALL.php file? Since this just needs to be done once.
I would also provide a init() function in the pdo class (see #38 ) that would create the table according to #47 . But due to the abstraction the database cannot be easily created there.
The init() function should be called after database creation. All necessary informations should be already in the config file (because the new database connector takes the config array as second argument).
Create install.php for shared hosting support and automatic creation of MySQL database.
Also supplies base for future features.
Sorry, I did not have the time.
The new app version has been pushed to fdroid and will only work with the new backend.
I hope I can comment while on vacation.
See you then, my flight leaves soon!
Hello,
I've tried to set up the backend, but wasn't successful.
App always displayes "Authentication failed".
Api-Key double checked and OK
I guess it's something related to access rights on my server?! I also didn't find the SQLlight DB.
Would be great to have a HowTo.
Best regards DaZeller
I finally got something working. If you are interested: https://janb.org/index.php/s/WlODAS0xyeeTKAt
It only works however with the error-handling branch and only for mysql because if have no idea of sqlite.
Feedback please :)
To delete or add multiple items at once we need 2 new functions that take every item and count from a json array and add/delete it.
Message "Multiple items deleted" not showing up using mysql and Shoppingslist 1.3, list must be synced to make the deleted items vanish.
That’s the highest version one can easily get on RHEL/CentOS-6, which is running on (too?) many servers yet.
I am very much willing to test.
List wont load when starting the app. Placed the getList() command in the wrong place.
Will be fixed in the next update:)
I'm entering something like "Joe's favourite sauce".
The apostrophe (') in the entry field causes the following error
The response did not make sense: <br /><b>Warning</b>: SQLite3::query(): Unable to prepare statement: 1, near "s": syntax error in /var/www/.../ShoppingList_Backend/sqlite_connector.php on line 47. Fatal error: Call to a member function fetchArray() on boolean in /var/www/
For those guys using a php-version lower than 5.5: you will see a blank screen after filling in all fields of http://<your_location>INSTALL.php and hitting the CREATE-button.
The reason for that issue is a FALSE-value as a result from the non-existing "password_hash()"-function. Go and get your copy of the repo at "https://github.com/ircmaxell/password_compat". Put it's files into your shopping-List-directory and last but not least: do not forget to "require 'password_compat-master/lib/password.php';" within INSTALL.php and config.php (if you are hashing your security token manually).
Wasn't that easy to get familliar to this - anyway, shopping-list is working now. Good job!
There should be minimal documentation on how to set this up (everything, but I'm thinking of MySQL especially).
What license should this project get?
I recommend GPLv3
When deleting an item, it is not removed from the list. Only after reloading the list it is gone.
Error messages are vague and missleading. They should be more specific on the actual error. Including errors with the backend.
There is bo config file
While trying to create a pdo abstraction (see #38 ) I noticed that the MySQL and the SQLite databases have different table layouts. That makes it difficult to create an abstraction and would cause much more code that could be avoided.
I would suggest using a unified table layout.
I would use:
STRING item PRIMARY INDEX NOT NULL; INT count NOT NULL; BOOL checked NOT NULL;
Same as #7.
Will be fixed with update.
To eliminate the need for two database adapters I think http://php.net/manual/en/book.pdo.php should provide the necessary abstractions...
We currently have a lot of different branches on different states. I recommend to use some rules to get these branches under control:
The reason is, that we have currently two branches that address a new version and that some changes that made it into master have not be applied to either of these two so these bug might be again in the next version.
I think it would be helpful if Versions and especially Milestones are the same with backend and app. So we can easier sort what each of us needs to do.
Do you have an idea?
Hi,
The mobile app is great but it's a real pain to input a full list on a phone : is there some plan to make a web version (to make the input with a real keyboard) ?
Didn't see anything like this on the roadmap.
Create in the Install File an Option to Create a User with Password and Database only for ShoppingList
ubuntu server currently uses
PHP 5.5.9-1ubuntu4.11 (cli) (built: Jul 2 2015 15:23:08)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies
with Xdebug v2.2.3, Copyright (c) 2002-2013, by Derick Rethans
so the function http://de2.php.net/hash_equals is not available
i needed to add the following to api.php to use the server api with the app
When you declare a var for table, then you should use it in mysql_connector:
$stmt = $handler->prepare("INSERT into testlist(item,count) VALUES(?,?)");
Thanks
As this is server-side code, I think that the code would be better protected under the AGPL instead of the regular GPL.
The PHP requirements according to the readme are >= 5.
As INSTALL.php
uses the password_hash() function, the requirements are in fact >= 5.5.0.
This leaves two options:
To use the new response handling of the app, it would be helpful if the SQLite would return
return json_encode(array('type' => API_SUCCESS_LIST_EMPTY));
I have added a webhook to test new functions.
You can always access the devel branch at [https://janb.org/devel]
Any suggestions?
hey there!
followed the instructions in readme.md. I created a new user shoppinglist with its own database and password. I'm using mysql.
I tried to setup the authkey in config.php.
I ran
php config.php testpassword
i am no expert in this, but shouldn't the hash always be the same? when i run it multiple times i get a new result each time.
root@odroid:/var/www/shoppinglist# php config.php testpassword
$2y$10$TWB8FAZmuec7YM5AJCmLv.qaJIXSgrR7cTIAhI7oQYwSti2LOIMny
root@odroid:/var/www/shoppinglist# php config.php testpassword
$2y$10$V8LRuyvk/IjHXP1eWyzJbuGgfjSzauGtmwPAKZuj2xQvznGhOi9AS
Is there something wrong with my apache or php config maybe? I read that the blowfish hash function is used.
Cant get the app to access the backend...
any suggestion?
update: cloned the repo again, ran install.php again and this time payed more attention when chosing a password.
still the app says that the auth key is rejected...
Apache log says this btw:
[Tue Aug 25 17:40:38.381868 2015] [:error] [pid 32015] [client 192.168.2.205:47002] PHP Notice: Undefined index: auth in /var/www/shoppinglist/api.php on line 14
I think it would be helpful if the app checks if the backend has a certain version to check for compatibility and to give a notice to update. (The update progress we yet have to figure out...)
Right now this would help, because app 1.1 is not compatible with the initial backend.
api.php:
header("ShoLiBackendVersion: 1");
Any comments or should I just implement it?
Morning!
I added improved error handling to the app. In my opinion the most important thing :)
So whenever an error is thrown by the api:
die (json_encode(array('code' => 'error', 'comment' => 'no database type specified')));
it should now be:
die (json_encode(array('type' => 1000, 'content' => 'specific error message')));
The values of type are all in CONSTANTS.php and the error message will be whatever is in 'content'.
Therefore we can give out new errors, without having to modify the app. So the app will show an error with 'content' as long as the 'type' is >= 5000.
If GroundApps/ShoppingList#27 is accepted the databases and php must be adapted.
I would do the SQLite part, and the api.php.
Add in .htacces DirectoryIndex to INSTALL.php before installation.
After installation set it to api.php
Hi,
I am superior to create a Windows VB Net App for the Shopping List.
What do you think about it?
It would be nice to have a SQL Template for the table you need
Sorry, guys.
You see and the next 2 weeks too I have so much work to do, that I didn't find th time to help you.
Sorry
We need a guide for contributions so that we are all on the same level and everybody knows that the devel branch is where things happen. Also how to give out errors and how to give proper feedback.
I went throught the database connectors and noticed that the error handling on multipleSave/multipleDelete is misleading. You iterate over all items and overwrite the return value each time. So the return status depends only on the last action.
The Server/Backend Need an update check.
It must check if there is a new Version from the backend, then download and install the new api.
Also it should send a notice message back to the user, that the Version on the Server is old and Need to update, when there is a major update like update the SQL Dump or secruity stuff like Password encryption!
Please, upgrade PPA to wily and xenial on https://launchpad.net/~jklmnn/+archive/ubuntu/groundapps
We maybe need to create a database conversion script, that converts the databases from the old structure to the one specified in #47 .
Hi,
I saw your project and wanted to test it. I did the backend installation on PHP Version 5.6.13.
In the android app, I configured the settings properly and it's the firt time I run the app. I got the message:
The server did not sent any content back. Likely due to an internal server error.
Here are my apache log. Can you help me to make the app work?
I choosed SQlite but the file shoppinglist.sqlite
was not created. How do I initialize it for the first time?
Apache2 acces.log
[01/Oct/2015:10:37:39 +0200] "POST /sholi/api.php/ HTTP/1.1" 500 2
Apache2 error.log
[:error] [pid 31406] [client 10.33.131.37:49095] PHP Notice: Undefined index: item in /home/jean/web/dev/sholi/api.php on line 13
[:error] [pid 31406] [client 10.33.131.37:49095] PHP Notice: Undefined index: count in /home/jean/web/dev/sholi/api.php on line 14
[:error] [pid 31406] [client 10.33.131.37:49095] PHP Notice: Undefined index: jsonArray in /home/jean/web/dev/sholi/api.php on line 15
[:error] [pid 31406] [client 10.33.131.37:49095] PHP Fatal error: Class 'SQLite3' not found in /home/jean/web/dev/sholi/sqlite_connector.php on line 10
The Floating Action Button should react to the Snackbar with a Coordinator Layout, not with a timer. Right now it gets pushed to far up when multiple actions occur.
I would be very thankful if someone could update the database connector and api.php to incorporate the new itemCategory and a function to toggle the 'checked' value.
I am working on adding the features to the app.
The function save and delete can also be deleted, because even when you add a single item, the app will use saveMultiple from now on.
Thanks :)
I watch over this project for the last days. And i think what we should do is define a script, milestones or somethink lile this to describe the project. What should the project do and so on
I think else we will lose the overview and the project will be lose a lot off thinks
We currently have the config.php
in git. When the user sets it up and then loads a new version, it will be overwritten.
We should move config.php
to config.php.def
(to keep a definition file) and create a new config.php
on install.
The same applies to .htaccess
.
We also should add those files to .gitignore
to prevent inadvertently pushing of credentials to the repo.
I have just noticed that the update command is not necessary. In the backend, if the command is save, and the item exists, it gets updated. That's actually the same as if you would send the update command. So I'd recommend to drop the update command and only use save.
(To be clear, I'm speaking about the post commands the app sends to the backend. The update function for the database is indeed necessary).
What do you think of using a REST Api for the backend?
I think it would help to create a standardized way of altering and retrieving data.
We could use the Slim Framework, so no need to reinvent the wheel.
Another benefit would be that the app would hopefully become less complicated programming wise. I never had scalability in mind and the code is basically a very rough proof of concept.
So, what are your thoughts?
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.