Commit 846cbdaa authored by jan.koester's avatar jan.koester
Browse files

added cookiebanner initial support

parent 40ba0b24
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
<!DOCTYPE html>
   <html lang="de">
     <head>
       <title>Blogi</title>
       <meta name="author" content="Jan Koester">
       <meta name="robots" content="all" >
       <meta charset="utf-8">
       <meta name="viewport" content="width=device-width,initial-scale=0.3" >
       <link rel="stylesheet" href="public/reset.css">
       <link rel="stylesheet" href="public/style.css">
    </head>
    <body>
    <img alt="test" src="public/header.webp" >
    <div id="cookiebanner"></div>
        <div id="cookiesettings">
        </div>
        <div id="cookieform">
        </div>
    </body>
    </html>
+11 −0
Original line number Diff line number Diff line
@@ -413,3 +413,14 @@ a {
    display: inline-block;
    margin: 2em 0;
}

#cookiebanner{
  top:0px;
  bottom:0px;
  z-index:99;
  position:fixed;
  width:100%;
  height:100%;
  opacity:0.7;
  background:#000000;
}
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ add_library(blogidev STATIC
    plugin.cpp
    theme.cpp
    editor.cpp
    cookie.cpp
    database/pgsql.cpp
    database/sqlite.cpp
)
+2 −1
Original line number Diff line number Diff line
@@ -29,11 +29,12 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include "theme.h"
#include "plugin.h"
#include "cookie.h"

#pragma once

namespace blogi {
    class Blogi : public libhttppp::HttpEvent  {
    class Blogi : public libhttppp::HttpEvent, CookieBanner {
    public:
        Blogi(Config *blgcfg,netplus::socket *serversocket,bool debug);
        ~Blogi();

src/cookie.cpp

0 → 100644
+63 −0
Original line number Diff line number Diff line
/*******************************************************************************
Copyright (c) 2024, Jan Koester jan.koester@gmx.net
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in the
      documentation and/or other materials provided with the distribution.
    * Neither the name of the <organization> nor the
      names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************/

#include<cstring>
#include<algorithm>

#include "cookie.h"

bool blogi::CookieBanner::getPermission(const char *sessionid,const char* prefix, const char* cookiename){

  return false;
}

void blogi::CookieBanner::setPermission(const char *sessionid,const char* prefix, const char* cookiename, bool perm){
}


void blogi::CookieBanner::addRule(const char* pref, const char* cookname, const char* dspname, const char* desc){
  Rule rule;
  std::copy(pref,pref+strlen(pref)+1,std::back_inserter<std::vector<char>>(rule.prefix));
  std::copy(cookname,cookname+strlen(cookname)+1,std::back_inserter<std::vector<char>>(rule.name));
  std::copy(dspname,dspname+strlen(dspname)+1,std::back_inserter<std::vector<char>>(rule.displayname));
  std::copy(desc,desc+strlen(desc)+1,std::back_inserter<std::vector<char>>(rule.description));
}

blogi::CookieBanner::Rule::Rule(blogi::CookieBanner::Rule& src){
  name=src.name;
  prefix=src.prefix;
  displayname=src.displayname;
  description=src.description;
}

blogi::CookieBanner::Rule & blogi::CookieBanner::Rule::operator=(blogi::CookieBanner::Rule& src){
  name=src.name;
  prefix=src.prefix;
  displayname=src.displayname;
  description=src.description;
  return *this;
}
Loading