Skip to content
API Documentation
BastionGuard™
google_safe.cpp
Go to the documentation of this file.
1/*
2 * BastionGuard™
3 * Copyright (C) 2025–2026 Calogero Scarnà
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 3.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 *
17 * BastionGuard™ is a trademark of Calogero Scarnà.
18 * The BastionGuard™ name and branding are not licensed under the GPL.
19 */
20
21#include "google_safe.hpp"
22#include <glibmm/miscutils.h>
23#include <filesystem>
24#include <fstream>
25#include <iostream>
26#include <glib/gi18n.h>
27
29 try {
30
31 std::string conf = Glib::get_home_dir() + "/.config/BastionGuard/google_safe.conf";
32 std::ifstream f(conf);
33 if (f.is_open())
34 std::getline(f, api_key_);
35 std::string flag = Glib::get_home_dir() + "/.config/BastionGuard/google_safe_enabled";
36 enabled_ = std::filesystem::exists(flag);
37 } catch (...) {
38 enabled_ = false;
39 }
40
41 if (enabled_)
42 std::cout << _("[GoogleSafe] 🛈 Modulo attivo ma disabilitato in questa build (dnsmasq backend)\n");
43}
44
46 return false;
47}
48
49bool GoogleSafe::is_unsafe(const std::string& url, std::string& threatType) {
50 (void)url;
51 (void)threatType;
52 return false;
53}
#define _(s)
bool is_enabled() const
bool is_unsafe(const std::string &url, std::string &threatType)
std::string api_key_