68 Commits

Author SHA1 Message Date
Sunil Mohan Adapa
65cdcb1bc3 Re-introduce Django CSRF middleware
It is a security issue not to include the Django CSRF middle. Also, since we
don't have a reason to alter the Django middleware list and order, we should
use the same list.
2014-08-17 19:29:31 +05:30
fonfon
f7c425384d updating documentation and translation 2014-07-11 03:14:45 +03:00
fonfon
1cf1cb2e90 moved context_processor from plinth.py to a separate file; removed two unnecessary context variables: 1) use cfg.main_menu instead of main_menu; 2) request_path is available automatically 2014-07-11 02:36:25 +03:00
fonfon
0d0c9f7bb0 removed all manual url prefix handling, we only use djangos url system now 2014-07-11 01:11:59 +03:00
fonfon
0e18fe3c1c Merge 'middleware' changes 2014-07-10 23:29:41 +03:00
fonfon
5150efac5f menu and submenu now also uses djangos named urls and url-reverse 2014-07-10 23:29:06 +03:00
fonfon
19f36f67d9 moved firstboot handling to a firstboot middleware 2014-07-10 19:49:41 +03:00
fonfon
a82a83576f use djangos named URLs and url-reverse instead of manually constructing urls 2014-07-10 03:44:52 +00:00
fonfon
d4d6948eb9 when running plinth with default server_dir '/' some static files and redirects were wrong -- fixed that; 2014-07-09 00:58:20 +00:00
Sunil Mohan Adapa
f88737b913 Configure python logging via Django and remove custom logger 2014-07-05 21:30:30 +02:00
Sunil Mohan Adapa
f4a2181762 Move main module to python logging 2014-07-05 21:29:40 +02:00
Sunil Mohan Adapa
cff0f1bdf6 Use Django auth framework instead of custom one
- Store users using Django user/group/permission model
- Database is data/plinth.sqlite3 instead of data/user.sqlite3
- Use Django auth context processors in templates
2014-06-28 13:11:34 +02:00
Sunil Mohan Adapa
f4fe85ae28 Refactor global code in configuration module 2014-06-23 12:22:46 +02:00
Sunil Mohan Adapa
b76a74e684 Use Django messages module for showing messages 2014-06-22 11:49:39 +02:00
Sunil Mohan Adapa
78406f16e8 Refactor global code from plinth.py 2014-06-21 11:44:21 +02:00
Sunil Mohan Adapa
ab80dc34d6 Add option to run as non-daemon mode
- Pass on debug option with Django
- Cleanup option parsing
2014-06-19 17:50:41 +02:00
Sunil Mohan Adapa
58d13e3ed8 Use Django dispatcher instead of CherryPy dispatcher
This commit is big because anything small breaks the code.

- Django dispatcher is based on regular expressions and does not need a tree structure
- Reduces a lot of unnecessary dependencies among modules
- Use Django sessions middlewear instead of CherryPy sessions
- Introduce dependency based modules instead of numeric load order
- Remove PagePlugin and simply use Django views
- Eliminate page rendering wrappers in favor of Django context processors
- Use custom auth for now until replaced by Django auth middlewear
- Use Django templated 404 and 500 error pages
2014-06-12 23:33:25 +05:30
Sunil Mohan Adapa
37206f1e83 Move all modules from 'modules/installed' to 'modules' directory 2014-06-06 12:14:17 +05:30
Sunil Mohan Adapa
912c5022ca Module is a directory instead of file
- Move enabled module symlinks to 'modules/enabled' directory.
- Make all modules properly importable
- Import modules instead of their symlinks
2014-06-06 12:01:08 +05:30
Sunil Mohan Adapa
64fa4189a9 Redirect to /apps instead of /router after login and firstboot 2014-06-01 23:35:11 +05:30
Sunil Mohan Adapa
94d0989503 Remove FormPlugin now that we use Django forms 2014-05-11 21:27:13 +05:30
Sunil Mohan Adapa
f097047b8b Introduce python-bootstrapform as dependency
Twitter Bootstrap provides good styling for forms. Our current
theme does not ouput forms in bootstrap styles although for
everything else, it does. The python-bootstrap from is a simple
Django helper application to render Django forms into bootstrap
theme.

Django forms themselves provide numerous advantages over the
current incomplete homegrown solution. It also has solutions for
problems such as CSRF attacks which the current application is
vulnerable to.
2014-05-11 10:41:34 +05:30
Sunil Mohan Adapa
a54672ae01 Allow placing templates inside module directories 2014-05-05 00:29:41 +05:30
Sunil Mohan Adapa
4b44741c68 Remove unnecessary layer of abstraction over template rendering 2014-05-05 00:08:58 +05:30
Sunil Mohan Adapa
9239d2c627 Migrate from Cheetah to Django template system
Compiled templates are an unnecessary pain in maintance and
packaging. If each module is to bring its own templates, compiling
them in the build process becomes unnecessarily more complex. The
current state of template mess can somewhat be attributed to this.

Cheetah only partially supports dynamic templates. It does not support
inheritence of dynamic templates. From its documentation: "There is no
support for extending from a class that is not imported; e.g., from a
template dynamically created from a string. Since the most practical
way to get a parent template into a module is to precompile it, all
parent templates essentially have to be precompiled."
2014-05-04 16:01:17 +05:30
Sunil Mohan Adapa
0f8050d031 Add a framework for working with services
- Basic information about each service is available for consumers
- Information about whether service is enabled or disabled is available
- Interested parties may listen to enabling/disabling of a service
- Information about some core services are made available
2014-04-18 12:50:14 +05:30
Nick Daly
68e186deff Finally fix firstboot redirect problems.
This issue was easy to solve once I started using the Live HTTP
Headers Firefox extension to debug it:

https://addons.mozilla.org/en-US/firefox/addon/live-http-headers/

With this particular InternalRedirect, CherryPy inexplicably responds
with a 301 ("Moved Permanently") unless we manually tell it to use a
307 ("Moved Temporarily") response code.  I don't know why CherryPy
does this, and it may be indicative of a deeper problem that I don't
currently have time to debug, as the request-response process for
redirecting from http://(server)/plinth to
https://(server)/plinth/firstboot is ridiculous and contains about
twice as many requests as I would've expected.
2013-12-08 11:46:33 -06:00
Nick Daly
83b4425a5a Merge pull request #54 from jvalleroy/bugfixes
Bugfixes
2013-11-18 20:18:38 -08:00
Petter Reinholdtsen
9274ccd814 Correct URL to current upstream github project. 2013-11-17 13:14:43 +01:00
James Valleroy
a7decf383e Check user db permissions when we redirect to firstboot, instead of trying to check if the file exists. 2013-11-14 18:28:47 -05:00
James Valleroy
3f36781fdf If creating a new user db, make sure it's permission is 640. 2013-11-13 23:45:40 -05:00
Nick Daly
d8ead196eb Added Debug flag (currently unused). 2013-11-10 21:50:09 -06:00
Nick Daly
421f20005e Plinth now hosted on (server)/plinth.
Plinth has been moved from plinth.(server).local to (server)/plinth.
*plinth.py* has been updated to take a new *--server_dir* argument,
which *share/init.d/plinth* now provides.  *plinth.sample.config* has
also been updated.

Actually, the whole package has been moved to a more Debian-friendly
configuration.  *share/apache2/plinth.conf* has been updated to
reflect the standard Debian directories.  It seems to make more sense
this way, as (other than FreedomMaker, which now uses this package
anyway) no other tools or derivatives use this system.  The
configuration can be patched out by other distributions easily enough.
2013-10-27 16:01:28 -05:00
Petter Reinholdtsen
7a74199ad6 Add missing return statement to parse_arguments(). 2013-10-07 09:15:54 +02:00
Nick Daly
a9c853e5bd Merged with upstream. 2013-10-06 21:21:43 -05:00
Nick Daly
c61e73245a Made URLs less absolute. 2013-10-06 21:11:08 -05:00
Nick Daly
54313fcb35 Update Plinth to handle new Apache config:
- Remove custom https redirect code.
- Hang Plinth off of any directory.
2013-10-06 21:04:29 -05:00
Nick Daly
63045d1928 Redirect all requests to HTTPS. 2013-10-05 14:36:07 -05:00
Petter Reinholdtsen
444365ec78 Rewrite plinth to use sudo and action scripts instead of exmachina for privileged accesss. 2013-09-23 09:37:24 +02:00
Nick Daly
c99f074f22 Use ExMachina already in Plinth/vendor. 2013-09-15 21:55:23 -05:00
Nick Daly
87753531d2 Reverted change 657068b0. 2013-09-15 21:47:18 -05:00
Petter Reinholdtsen
bad8939389 Fix typo blocking access to exmachina, and report the problem if unable to load the exmachina client library. 2013-09-11 13:46:37 +02:00
Nick Daly
ec9a457e3e Merged: tzafrir's novendor patch.
Author: Tzafrir Cohen <tzafrir@debian.org>
Description: "vendor" packages are installed as separate system debs
2013-09-08 17:34:53 -05:00
Nick Daly
a97061055c Merged: tzafrir's install_dir patch.
Author: Tzafrir Cohen <tzafrir@debian.org>
Description: These things are easier to install with dh

* Python modules: fighting with dh_python2 is tough
  (it changes the /etc/ symlink, for isntance)
* Let's just install man pages ourselves for now.
* symlinks: with dh_link
2013-09-08 17:31:27 -05:00
Nick Daly
f55c7a48ea Merged with James's upstream.
Hope I did it right.  If I screwed up, withsqlite is borked.
2013-04-23 17:49:22 -05:00
Nick Daly
ea49a08675 Don't crash if we couldn't import ExMachina. 2013-03-23 18:45:07 -05:00
Tom Galloway
b45d5cfe85 Extra predepend's, plinth doesn't need to run as root, pidfile location set in cfg file. 2013-01-04 12:50:51 +00:00
Tom Galloway
b2c157ec1d Added predepend packages and updated python path for build folders. 2013-01-03 15:08:06 +00:00
Nick Daly
c129254e8a Merge branch 'master' of github.com:NickDaly/Plinth 2012-10-07 20:37:36 -05:00
Nick Daly
f03e184c78 Added default pidfile. 2012-10-07 20:28:42 -05:00