GithubHelp home page GithubHelp logo

cutelyst / cmlyst Goto Github PK

View Code? Open in Web Editor NEW
22.0 22.0 7.0 494 KB

CMlyst is a Content Management application built upon Cutelyst with support for Menus, Pages, Blogs and Feeds

CMake 1.40% C++ 80.00% HTML 15.82% CSS 2.48% JavaScript 0.30%
c-plus-plus c-plus-plus-11 cms cutelyst qt qt5 webapp website

cmlyst's Introduction

Cutelyst - The Qt Web Framework Cutelyst logo

A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework.

Qt's meta object system is what powers the core of Cutelyst, it allows for introspecting controller's methods signatures and generate matching actions that can be invoked later.

BENCHMARKS

Don't trust us on being fast, check out the most comprehensive web framework benchmarks by TechEmpower http://www.techempower.com/benchmarks/

FEATURES:

  • Cross-platform
  • Stable API/ABI - v3 tagged from v3.x.x, v2 tags, v1 on v1.x.x branch (unmaintained)
  • Pluggable Engines
    • Cutelyst::Server - A cross-platform and fast server engine
      • HTTP/1.1 - Pipelining and Keep-Alive
      • HTTP/2 - Upgrade to H2, ALPN negotiation on HTTPS and direct H2C
      • FastCGI - Pipelining and Keep-Alive
  • WebSockets
  • REST with ActionREST
  • Plugin based views
    • Cutelee (A Qt implementation of Django's template engine)
    • JSON
    • Email
  • Dispatcher
    • Chained
    • Path
  • Plugins
    • Session
    • Authentication (with PBKDF2)
    • Authorization with RoleACL
    • StatusMessage
    • Validator (to validate user input)
    • CSRF protection
    • Memcached
    • UserAgent
  • Asynchronous processing (just don't use local QEventLoops or it will eventually crash)
    • Async SQL with ASql
  • Upload parser
  • JSON body as QJsonDocument when uploaded data is in JSON format
  • C++20
  • Chunked reponses (via QIODevice write API)
  • Request profiling/stats
  • Unit tested
  • QtCreator integration

DOCUMENTATION

Get started with our Tutorial or check the API.

COMMUNITY

The Cutelyst project IRC channel is #cutelyst on freenode.

Or you can use the Mailing List

REQUIREMENTS

  • CMake - for the build system (>= 3.16)
  • Qt - the core library of this framework (>= 6.2)

LICENSE

The source code is available is under the 3-Clause BSD.

cmlyst's People

Contributors

buschmann23 avatar dantti avatar light-wizzard avatar neochapay avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cmlyst's Issues

Some basic documentation to CMlyst

I'm reading the code of the project to figure out their functionalities, but it would be really nice some documentation.
Wt, Tufão, TreeFrog, neither of them have a CMS, so I think CMlyst can be a strong advantage to Cutelyst.

Run-time warning about translations

I get this warning:
cutelyst.core[warning] Can not load translations from not existing directory: "/usr/share/cutelyst2/translations"

There is nothing installed into /usr/share/cutelyst2 the folder does not exist.
I do not see any dependencies I have missed.

I found this in the issues for cutelyst:
[https://github.com/cutelyst/cutelyst/pull/103/commits/6ee6b4610d9d81b1c37b5bdadc158ae3b39fd5b1]

set (I18NDIR "${DATADIR}/cutelyst${PROJECT_VERSION_MAJOR}/translations" CACHE PATH "Directory to install translations")

if DATADIR=/usr/share that would explain the call; so how do I fix
I see a reference to transifex, but can not figure out the warning; is there a way to get this to work?

Menu should have option to set order

Currently when I create a menu; it reorders it, I would like to have my Menu look like this: Home Blog About,
this is not possible the way its written.

It looks like you can order it by moving items around, but on save, the order is lost.

Also I am not sure why, but if I have more then one menu; clicking in the any record name other then the first record, will not open the URL box for that record, instead it toggles if for the first record.

Thanks

Documentation

This really needs some Documentation, I know you closed a request based on the fact you were doing a major rewrite, can you give us status on where that is at, and do you have a forum or a better way to communicate problems other then issues; since sometimes people just have questions.

Please write some tutorial

I just compiled cutelyst and CMlyst, but I do not know what to do. I'm very interested in this CMS.
Please write just some basic info, then I will write more guide / how to/ tutorial to help people using CMlyst.
Thanks!

grantlee sintax error

I got latest grantlee and build it from git. After run CMlyst and going to http://localhost:3000/ i get error:

Error while rendering template: 'if' statement improperly formatted, line 0, posts.html, line 0, posts.html

If i go to /setup i got

3914:3914 cutelyst.dispatcher[debug] Path is "/"
3914:3914 cutelyst.dispatcher[debug] Arguments are "setup"
3914:3914 cutelyst.grantlee[debug] Rendering template "404.html"
3914:3914 grantlee.template[warning] "'if' statement improperly formatted, line 0, base.html, line 0, base.html"
3914:3914 cutelyst.stats[debug] Response Code: 404; Content-Type: text/html; charset=utf-8; Content-Length: 0

In stdout

Feature request: Version Manager for JavaScript and CSS

Currently all versions of JavaScript and CSS are Hard Coded; causing the developers to have to edit the templates to update them; this can be corrected by creating a class that tracks what version level every library is at; and this can be a config file or a database call at run time; it would allow you to update either without having to change existing templates. You could add the field names to the template itself as a variable, and only call the function once at run time to fill the values.

Upgrading from bootstrap 3 to 4 will require template changes; and you know this needs to be done; and this will make that transition easier; and do it all at once; if you need compatibility with ver 3; you can just use to different templates; it complicates things; but makes the transition easier for end users; so I would recommend upgrading to 4 at the same time.

if you can decide on what method you would like to see this done; I will work on this also and do a pull request; the truth is that these are all the changes I have to make to use it; so I have to do the work if you do not have the time; I am Medically Retired; so I have the time; and the need for all my Feature Request; so I make them more to open up a discussion on how to implement it then anything else.

Also I will send you a URL so you can see these changes in action and running before you look at the code I push; so you know it is working and how it works; you will want to test it out yourself, and make sure I use the best practices, and do not cause any errors in the app; Quality Control stuff.

Update: Upgrading to Bootstrap 4 means JavaScript updates also; one way to get around versions; and simplifying version control is to use SAS tools, and Node Magic to compile them at start up; that way your resource file name never changes; and there is no reason to track the version; a much better approach; but it requires the use of Nodes; and other tools that the go lang community use everyday; so it was an after thought; another way of doing the same thing; you could also just rename the updated files without using the version number; but then you could not use a CDN; so the above solution is better for that; but if you host your own JavaScript and CSS files; you could use this approach; so I will leave you with two approaches to the same Problem; and that what scripts and css do you need for Bootstrap 4; because Popper comes to mind; plus updated jquery and adding jquery-slim to the mix; with this method you can combine all your JavaScript and CSS into one file and Minimize it; even Optimize the JavaScript on the fly with a rebuild of all the script if any of them change; so this approach has its advantages; but it will also make the startup time slower if it has to generate them at startup; so you could just make rebuilding a button in the app; it does not require a reboot; so its easy to do; and only gets done when its needed; and does not require Nodes to Monitor for Files Changes; or what ever program you use that monitors files changes in real time and triggers this event; sending an encode request to the command line; or a manual button to keep it simple; even with CSRF checks having links like this can be dangerous if ran in a loop; even using slots; you would have to include a meter; and only allow so many calls per hour; and only one call per minute; so you can minimize the risk; just do not forget about it; or find a better way to do this; which safer might be to check for updates at startup; or require a database change that is checked at a preset time in the code; and used to do such background checks; so a watchdog function; keep in mind these are just files that get read every time and are cached in the users cache; so you have to reset the cache date on the file or it will never get updated in the client browser; so the template files are not static; they still require a version control system; that out dates the cache date; thus triggering a client side update.

Thanks

Feature request: Plugin

A lot of people that will use this CMS; may want to add something to it; yet they want to be able to use all your updates; so its not a good solution to add my new code to your project; and try to keep it up to date at the same time; so a Plugin could allow me to write my code in a separate project and link it to your CMS.

I have no clue as how to go about doing this; or if you have thought about it; and I just do not know how to implement it; so I am putting this out there.

I want to use your CMS as is for my Front and Back End; and add a book Manager to it; so all it needs to do is be able to link from your Menu; maybe make a code that embeds in the URL for the Menu Item; that calls a function instead of routing it to dispatch; that Feature would be great in itself.

Thanks

Code Injection

Not sure how this is suppose to work; but currently the header will print above and below the content; and the footer does not print at all.

Feature request: Header and Footer

Currently you would have to edit the Templates to add a Header and Footer; plus connect the database fields for Site Title and Tagline; and there is no Footer database field; so that would have to hard coded.

There are two ways I can think of to do this; one is to just duplicate the Code Injector and call it the HTML Injector; the other is to use Bootstrap and complete the code in the Templates; adding another field for the Footer.

The Code Injector allows you to inject Code into the Header and Footer; this HTML Injector injects HTML; so you can reuse the code for the injector; and just change where you inject the code into the Body instead of the Header; otherwise it seems to me we can just reuse this code by copy and rename, and a few changes; so its an easy feature to add as far as work goes.

This is a must have feature; it allows the user to set their Site Title and Tagline names; so if you make it flexible and allow them to edit the code; you should insert a default record with the correct Code; this is where Bootstrap comes in; I know it has features to do just this; so you could just hard code this into the code; or make it a database record you can edit; either way it needs to accomplish the same thing out of the box. Grant you that in the back end you would have an HTML code block to update; not nice; and why its best just to hard code the Header Site Title and Tagline; even add a field called footer; that is just like the tagline; extra info you want to display on all pages.

The Easy way to do this is to just Hard Code it and add the HTML Injector; and its also very Flexible; so you have to determine what is best; its not easy to maintain HTML code in a Database even with a WYSIWYG editor.

I can write the code if you are busy; and do a pull request; but I need guild lines for how you would like to have this feature work; I do not want to waist your time looking at code; if you do not like the concept of how its implemented; I would just copy how you did it; and try to duplicate that work, and apply it to this feature.

I could also do it both ways; and have the HTML Injector allow you to add more code to the page; while giving the CMS the ability to manage the Header and Footer in the back end; with no HTML code required; this requires template changes, and an extra footer field.

As the CMS is: we have no Header or Footer at start up out of the Box; and you would have to edit the Templates to accomplish this task if you wanted this feature to begin with; so its easy enough for anyone to do that now; without the Footer database code; and if you hard code it, you would have to do the same time by first updating the Template; and the database fields; and its not that hard to do; but its work, and I would always rather do things the right way the first time.

If export SETUP i got segfail

I use latest cutelyst and latest CMlyst
if i run that cutelyst-wsgi2 --application src/libcmlyst.so --http-socket :3000 --ini cmlyst.conf --static-map /static=../root/static/
all is good
BUT!
if i say export SETUP=true i got segfail

GNU gdb (Ubuntu 8.2-0ubuntu1) 8.2
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.
 
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from cutelyst-wsgi2...(no debugging symbols found)...done.
(gdb) run --application src/libcmlyst.so --http-socket :3000 --ini cmlyst.conf --static-map /static=../root/static/
Starting program: /usr/bin/cutelyst-wsgi2 --application src/libcmlyst.so --http-socket :3000 --ini cmlyst.conf --static-map /static=../root/static/
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Installing EPoll event loop
Loading INI configuration: cmlyst.conf section: wsgi
Cutelyst-WSGI starting
*** WARNING: you are running Cutelyst-WSGI without its master process manager ***
WSGI socket 0 bound to TCP address 0.0.0.0:3000 fd 7
Loading application: src/libcmlyst.so
22192:22192 cutelyst.core[warning] Can not load translations from not existing directory: "/usr/share/cutelyst2/translations"
22192:22192 wsgi[debug] Loaded application:  "cmlyst"
22192:22192 default[debug] Production false
22192:22192 cutelyst.core[warning] Can not load translations from not existing directory: "/usr/share/cutelyst2/translations"
22192:22192 cutelyst.core[warning] Can not load translations from not existing directory: "/usr/share/cutelyst2/translations"
22192:22192 default[debug] Root location "/home/OMP/s.chupligin/work/WEB/CMlyst/build/root"
22192:22192 default[debug] Root Admin location "/home/OMP/s.chupligin/work/WEB/CMlyst/build/root/src/admin"
22192:22192 default[debug] Data location "/home/OMP/s.chupligin/work/WEB/CMlyst/root"
22192:22192 cutelyst.core[debug] Loaded plugins:
.--------------------------.
| CWSGI::StaticMap         |
| Cutelyst::Session        |
| Cutelyst::Authentication |
| Cutelyst::StatusMessage  |
.--------------------------.
22192:22192 cutelyst.core[debug] Loaded Request Data Handlers:
.-----------------------------------.
| application/x-www-form-urlencoded |
| application/json                  |
| multipart/form-data               |
.-----------------------------------.
22192:22192 cutelyst.core[debug] Loaded dispatcher "Cutelyst::Dispatcher"
22192:22192 cutelyst.core[debug] Using engine "CWSGI::CWsgiEngine"
22192:22192 cutelyst.core[debug] Found home "/home/OMP/s.chupligin/work/WEB/CMlyst/build"
22192:22192 cutelyst.core[debug] Loaded components:
.---------------------------------+------------.
| Class                           | Type       |
.---------------------------------+------------.
| AdminSetup                      | Controller |
| Cutelyst::GrantleeView->execute | View       |
| Cutelyst::GrantleeView->execute | View       |
.---------------------------------+------------.
22192:22192 cutelyst.dispatcher[debug] Loaded Private actions:
.-----------+------------+----------.
| Private   | Class      | Method   |
.-----------+------------+----------.
| /End      | AdminSetup | End      |
| /notFound | AdminSetup | notFound |
| /setup    | AdminSetup | setup    |
.-----------+------------+----------.
22192:22192 cutelyst.dispatcher[debug] Loaded Path actions:
.--------+-----------.
| Path   | Private   |
.--------+-----------.
| /...   | /notFound |
| /setup | /setup    |
.--------+-----------.
22192:22192 cutelyst.dispatcher[debug]
 
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff75cd674 in Cutelyst::Component::d_func() const () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5.so.2
(gdb) bt
#0  0x00007ffff75cd674 in Cutelyst::Component::d_func() const () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5.so.2
#1  0x00007ffff75ccbf0 in Cutelyst::Component::reverse() const () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5.so.2
#2  0x00007ffff4258ce4 in CMDispatcher::list() const () from ./src/libcmlyst.so
#3  0x00007ffff75c78ea in Cutelyst::Dispatcher::setupActions(QVector<Cutelyst::Controller*> const&, QVector<Cutelyst::DispatchType*> const&, bool) ()
   from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5.so.2
#4  0x00007ffff75d1320 in Cutelyst::Application::setup(Cutelyst::Engine*) () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5.so.2
#5  0x00007ffff75ad421 in Cutelyst::Engine::initApplication() () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5.so.2
#6  0x00007ffff7f458c0 in CWSGI::CWsgiEngine::init() () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5Wsgi.so.2
#7  0x00007ffff7f223e3 in CWSGI::WSGIPrivate::createEngine(Cutelyst::Application*, int) () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5Wsgi.so.2
#8  0x00007ffff7f21974 in CWSGI::WSGIPrivate::setupApplication() () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5Wsgi.so.2
#9  0x00007ffff7f1e4b9 in CWSGI::WSGI::exec(Cutelyst::Application*) () from /usr/lib/x86_64-linux-gnu/libCutelyst2Qt5Wsgi.so.2
#10 0x000055555555671d in main ()```

Cannot create a user

After creating a SETUP environment variable: declare -x SETUP=true
I get this Error:
cutelyst.utils.sql[critical] Failed to prepare query: "INSERT OR REPLACE INTO users (name, email, password) VALUES (:name, :email, :password)" "table users has no column named name"
I verified the cmlyst.sqlite database only had 5 fields:
id
slug
email
password
json
sqluserstore.h seems to be where the call came from: bool SqlUserStore::addUser
setup.html is where the form data is located.
cmlyst.cpp calls adminsetup.cpp via AdminSetup,
sqlengine.cpp is where the create script seems to come from.
"CREATE TABLE users "
"( id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT "
", slug TEXT NOT NULL UNIQUE "
", email TEXT NOT NULL UNIQUE "
", password TEXT NOT NULL "
", json TEXT "
")"))) {
and as you can see, there is no name field.
adding:
", name TEXT NOT NULL UNIQUE "
gave me another error:
Failed to add new user: "NOT NULL constraint failed: users.slug"
which lead me to believe that name was suppose to map to slug,
I noticed that username maps to name,
bool ret = store->addUser({
{QStringLiteral("name"), username},
{QStringLiteral("email"), email},
{QStringLiteral("password"), password},
});
Since slug TEXT NOT NULL UNIQUE, it can not be sent to addUser without adding it.

I do not know enough about this function to fix it, it seems you need to fix a few things in order for this to work right, name looks like it was added to the function as an after thought and was not finished, my guess is that slug is used as username, in the code name is not used much but slug is, but the use of slug is normally used for specific reasons: http://codex.wordpress.org/Glossary#Slug, not sure how this relates to this function, but my guess is that its based on WordPress, but its obvious that name needs to be added unless it converts to slug, in which the names need to be fixed, but it seems to me that is not the case and name needs to be added to the database and slug needs to be populated from data collected, like Full Name, but a Slug is normally a one liner describing that person, and is normally used in signatures in posts.

I hope I gave enough information to resolve this issue.

Static front page not working

I created a page and configured a unique path and can access the page in this path, but if I configure the front page to display this page a get a "page not found" warning.

Feature Request: Comment System

I'm not sure, but it seems CMlyst doesn't have a built-in comment system. If I understand it correctly, one can integrate a third party comment system to pages and blog posts with the help of the allowComments variable.

However, in some cases, some users may not want to sign up for another service only to leave a simple comment.

I have no idea how difficult it would be to implement an built-in comment system, but it would be great if we had it.

If we document the missing features and how they can be done, we may use them when Cutelyst joins GSoC or similar organizations in the future.

Status in other CMSes

  • Ghost: no built-in comment system
  • Blogger: has a built-in comment system and support for Google+ comments
  • WordPress: it seems it has a built-in comment system

CMlyst exit immediately

Build without any changes in code.
I only have few lines of messages:

7803:7803 cutelyst.core[warning] Can not load translations from not existing directory: "/usr/share/cutelyst3/translations"
7803:7803 default[warning] QThread::setEventDispatcher: An event dispatcher has already been created for this thread
Cutelyst-Server starting
Installing EPoll event loop
*** WARNING: you are running Cutelyst-Server without its master process manager ***
Cutelyst-Server terminated

Process finished with exit code 1

I found that CMlyst class is created, but CMlyst::Init() is never called.

Unable to bind to designated IPv6 address

I am guessing this is due to the way that the --http-socket option is parsed. If I run it with elevated privileges I find it is bound to 0.0.0.0:80 which is clearly unintended.

$ cutelyst-wsgi2 --application build/src/libcmlyst.so --http-socket '[2001:470:1f1d:bd1:9e8e:99ff:fedc:26b3]:12001' --ini build/src/cmlyst.conf --chdir /tmp/CMlyst/ --static-map /static=root/static
Installing EPoll event loop
Loading INI configuration: build/src/cmlyst.conf section: wsgi
Cutelyst-WSGI starting
*** WARNING: you are running Cutelyst-WSGI without its master process manager ***
Failed to listen on TCP: [2001:470:1f1d:bd1:9e8e:99ff:fedc:26b3]:12001 : The address is protected

Blank page if using theme default-dark

If I select the theme default-dark in admin, the admin interface continue working, but the front page turns blank, without a any log. The normal log using default is bellow.

1452:1452 cwsgi.staticmap[debug] Serving "root/static/dist/css/bootstrap.css"
1452:1452 cwsgi.staticmap[debug] Serving "root/static/themes/default/blog.css"
1452:1452 cwsgi.staticmap[debug] Serving "root/static/dist/js/bootstrap.min.js"

The themes are quite different, but the default is much smaller:

$ cloc root/themes/default
       6 text files.
       6 unique files.                              
       0 files ignored.

github.com/AlDanial/cloc v 1.72  T=0.02 s (259.7 files/s, 5497.6 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
HTML                             6             27             12             88
-------------------------------------------------------------------------------
SUM:                             6             27             12             88
-------------------------------------------------------------------------------
$ cloc default-dark/
       5 text files.
       5 unique files.                              
       0 files ignored.

github.com/AlDanial/cloc v 1.72  T=0.02 s (215.7 files/s, 10655.3 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
HTML                             5             38             24            185
-------------------------------------------------------------------------------
SUM:                             5             38             24            185
-------------------------------------------------------------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.