<commit_before>:- module(bc_admin, []).

:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_wrapper)).
:- use_module(library(arouter)).

:- use_module(bc_view).
:- use_module(bc_main).
:- use_module(bc_data_config).

:- route_get(admin/css/File, send_file(css/File)).

:- route_get(admin/fonts/File, send_file(fonts/File)).

:- route_get(admin/img/File, send_file(img/File)).

:- route_get(admin/tpl/File, send_file(tpl/File)).

:- route_get(admin/js/File, send_file(js/File)).

:- route_get(admin/js/shim/File, send_file(js/shim/File)).

:- route_get(admin/js/libs/File, send_file(js/libs/File)).

:- route_get(admin, send_admin).

% Renders the main admin HTML page.
% Provides it configuration info.

send_admin:-
    bc_environment(Env),
    bc_config_get(default_language, Lang),
    admin_relative(index, Full),
    bc_view_send(Full, _{
        environment: Env,
        language: Lang
    }).

send_file(Spec):-
    admin_relative(Spec, Full),
    check_path(Full),
    send_file_unsafe(Full).

send_file_unsafe(Path):-<commit_msg>Disable serving tpl directory in bc_admin<commit_after>:- module(bc_admin, []).

:- use_module(library(http/http_dispatch)).
:- use_module(library(http/http_wrapper)).
:- use_module(library(arouter)).

:- use_module(bc_view).
:- use_module(bc_main).
:- use_module(bc_data_config).

:- route_get(admin/css/File, send_file(css/File)).

:- route_get(admin/fonts/File, send_file(fonts/File)).

:- route_get(admin/img/File, send_file(img/File)).

:- route_get(admin/js/File, send_file(js/File)).

:- route_get(admin/js/shim/File, send_file(js/shim/File)).

:- route_get(admin/js/libs/File, send_file(js/libs/File)).

:- route_get(admin, send_admin).

% Renders the main admin HTML page.
% Provides it configuration info.

send_admin:-
    bc_environment(Env),
    bc_config_get(default_language, Lang),
    admin_relative(index, Full),
    bc_view_send(Full, _{
        environment: Env,
        language: Lang
    }).

send_file(Spec):-
    admin_relative(Spec, Full),
    check_path(Full),
    send_file_unsafe(Full).

send_file_unsafe(Path):-
{'fraction_non_alphanumeric': 0.16587452471482889, 'fraction_numerical': 0.0, 'mean_word_length': 4.439276485788113, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3475349', 'n_tokens_mistral': 780, 'n_tokens_neox': 769, 'n_words': 104}