added builder, bug fixes

This commit is contained in:
equippedcoding-master
2025-09-30 13:25:09 -05:00
parent 7191e6ea8b
commit b25b26fde1
12 changed files with 65 additions and 155 deletions

View File

@@ -1,3 +1,6 @@
### Portal ### Portal
Appfactory Studio domain website

View File

@@ -1,3 +1,3 @@
{ {
"custom": true "custom": false
} }

View File

@@ -12,31 +12,14 @@ define([
function _init(app){ function _init(app){
$("#enter_builder_btn_id").on("click",function(e){ $("#enter_builder_btn_id").on("click",function(e){
e.preventDefault(); e.preventDefault();
if(window.location.host.includes(app.extra.config.managed_domain.Domain)){
console.log(window.location.host);
console.log(window.location.origin);
console.log(app.extra.config.managed_domain.Address);
console.log(app.extra.config.managed_domain.Address.split("//")[1]);
console.log(app.extra.config.managed_domain.Address2);
console.log(app.extra.config.managed_domain);
if(app.extra.config.managed_domain.Address!=undefined){
if(window.location.host.includes(app.extra.config.managed_domain.Address.split("//")[1])){
window.open(app.extra.config.managed_domain.Address + "/portal/admin/services/builder/web/v3", "appfactory_webbuilder"); window.open(app.extra.config.managed_domain.Address + "/portal/admin/services/builder/web/v3", "appfactory_webbuilder");
} }
}else if(app.extra.config.managed_domain.Address2!=undefined){ if(window.location.host.includes(app.extra.config.managed_domain.Domain2)){
if(window.location.host.includes(app.extra.config.managed_domain.Address2.split("//")[1])){
window.open(app.extra.config.managed_domain.Address2 + "/portal/admin/services/builder/web/v3", "appfactory_webbuilder"); window.open(app.extra.config.managed_domain.Address2 + "/portal/admin/services/builder/web/v3", "appfactory_webbuilder");
} }
}
// https://www15.appfactory.studio/portal/admin/services/builder/
// window.open(app.extra.config.managed_domain.Address2 + "/portal/admin/services/builder/web", "appfactory_webbuilder");
}); });
} }

View File

@@ -127,9 +127,8 @@
}); });
function displayImageEditor(app){ function displayImageEditor(url,app){
// Image editor // Image editor
let url = app.extra.instances.documents.getDocumentUrl(app.extra.current.documents.document.obj, app.extra.config.managed_domain);
var imageEditor = new tui.ImageEditor('#tui-image-editor-container2', { var imageEditor = new tui.ImageEditor('#tui-image-editor-container2', {
includeUI: { includeUI: {
loadImage: { loadImage: {
@@ -150,18 +149,20 @@
$(".tui-image-editor-header-logo").remove(); $(".tui-image-editor-header-logo").remove();
} }
function displayPdfEditor(app){ function displayPdfEditor(url,app){
} }
// console.log(app.extra.current.documents); // console.log(app.extra.current.documents);
if(app.utils.imageExists(app.extra.current.documents.document.obj.url)){ let url = app.extra.instances.documents.getDocumentUrl(app.extra.current.documents.document.obj, app.extra.config.managed_domain);
console.log(url);
if(app.utils.imageExists(url)){
if(app.utils.isFileType("image",app.extra.current.documents.document.obj.generated_name)){ if(app.utils.isFileType("image",app.extra.current.documents.document.obj.generated_name)){
// console.log(imageExists(app.extra.current.documents.document.obj.url)); // console.log(imageExists(app.extra.current.documents.document.obj.url));
displayImageEditor(app); displayImageEditor(url,app);
} }
if(app.utils.isFileType("pdf",app.extra.current.documents.document.obj.generated_name)){ if(app.utils.isFileType("pdf",app.extra.current.documents.document.obj.generated_name)){
displayPdfEditor(app); displayPdfEditor(url,app);
} }
}else{ }else{
$("#document_status_message").text("File missing!"); $("#document_status_message").text("File missing!");

View File

@@ -8895,7 +8895,7 @@ function PublishWebsite($base,$rootDir,$project,$project_config,$member,$setting
for ($n=0; $n < count($value["styles"]); $n++) { for ($n=0; $n < count($value["styles"]); $n++) {
$link_styles .= "<link rel=\"stylesheet\" href=\"".$value["styles"][$n]."\">"; $link_styles .= "<link rel=\"stylesheet\" href=\"".$value["styles"][$n]."\">";
} }
if($key=="home"){ if($key=="home" || $key=="index"){
$html = str_replace("\${contents}", $value["html"], $contents); $html = str_replace("\${contents}", $value["html"], $contents);
$html = str_replace("\${favicon}", $favicon, $html); $html = str_replace("\${favicon}", $favicon, $html);
$html = str_replace("\${title}", $title, $html); $html = str_replace("\${title}", $title, $html);
@@ -8904,8 +8904,9 @@ function PublishWebsite($base,$rootDir,$project,$project_config,$member,$setting
$html = str_replace("\${scripts}", $value["js"], $html); $html = str_replace("\${scripts}", $value["js"], $html);
$html = str_replace("\${styles}", $value["css"], $html); $html = str_replace("\${styles}", $value["css"], $html);
mkdir("$base/$rootDir/index", 0777, true); // mkdir("$base/$rootDir/index", 0777, true);
$file = "$base/$rootDir/index/index.php"; // $base = /home/user/websites/www
$file = "$base/index.php";
$myfile = fopen($file, "w"); $myfile = fopen($file, "w");
fwrite($myfile, $html); fwrite($myfile, $html);
fclose($myfile); fclose($myfile);
@@ -8930,13 +8931,15 @@ function PublishWebsite($base,$rootDir,$project,$project_config,$member,$setting
"path_dir" => dirname( __DIR__ ) . "/pages_template.php", "path_dir" => dirname( __DIR__ ) . "/pages_template.php",
"contents" => $contents, "contents" => $contents,
"make" => $make, "make" => $make,
"directory_base" => $base,
"directory" => "$base/$rootDir", "directory" => "$base/$rootDir",
"settings" => $settings, "settings" => $settings,
"project" => $project, "project" => $project,
"managed_domain" => $managed_domain, "managed_domain" => $managed_domain,
"member" => $member, "member" => $member,
"project_config" => $project_config, "project_config" => $project_config,
"run_command" => $result "run_command" => $result,
"website" => $website
]); ]);
@@ -8967,9 +8970,9 @@ function webbuilder_publish(){
$txt = "{}"; $txt = "{}";
fwrite($myfile, $txt); fwrite($myfile, $txt);
fclose($myfile); fclose($myfile);
EchoJsonResponse("$base/$rootDir/descriptor.json"); // EchoJsonResponse("$base/$rootDir/descriptor.json");
} }
EchoJsonResponse("$base/$rootDir/descriptor.json"); // EchoJsonResponse("$base/$rootDir/descriptor.json");
if(file_exists("$base/$rootDir/descriptor.json")){ if(file_exists("$base/$rootDir/descriptor.json")){
$descriptor = json_decode(file_get_contents("$base/$rootDir/descriptor.json"), true); $descriptor = json_decode(file_get_contents("$base/$rootDir/descriptor.json"), true);
if($descriptor["custom"]==true){ if($descriptor["custom"]==true){

View File

@@ -133,7 +133,7 @@ CREATE TABLE IF NOT EXISTS documents (
date TIMESTAMP DEFAULT CURRENT_TIMESTAMP() date TIMESTAMP DEFAULT CURRENT_TIMESTAMP()
); );
-- ALTER TABLE documents CREATE COLUMN url2 VARCHAR(255) NULL; -- ALTER TABLE documents ADD COLUMN url2 VARCHAR(255) NULL;
-- Forms -- Forms

View File

@@ -1048,9 +1048,9 @@ if [ "$action" = "--brain-start-remote-server-monitor" ]; then
echo "" &>> $logfile # echo "" &>> $logfile
echo "[Appfactory]${now}: ========================================" &>> $logfile # echo "[Appfactory]${now}: ========================================" &>> $logfile
expect /home/${systemuser}/websites/${subdomain}/portal/admin/core/scripts/commands.expect "brain_start_remote_server_monitor" $systemuser $subdomain $member_ref $member_username $server_ip $username $password # expect /home/${systemuser}/websites/${subdomain}/portal/admin/core/scripts/commands.expect "brain_start_remote_server_monitor" $systemuser $subdomain $member_ref $member_username $server_ip $username $password

View File

@@ -167,15 +167,8 @@ function run_http_domain_server()
sed -i "s/\${user}/${subdomain}/g" ${base_nginx}/${systemuser}-${subdomain}.conf &>> $LOG_FILE sed -i "s/\${user}/${subdomain}/g" ${base_nginx}/${systemuser}-${subdomain}.conf &>> $LOG_FILE
sed -i "s/\${domain}/${member_domain}/g" ${base_nginx}/${systemuser}-${subdomain}.conf &>> $LOG_FILE sed -i "s/\${domain}/${member_domain}/g" ${base_nginx}/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# ln -s /mnt/node1/${server_systemuser}/server_configurations/nginx/${systemuser}-${subdomain}.conf /etc/nginx/conf.d/ &>> $LOG_FILE mv /mnt/node1/${systemuser}/server_configurations/nginx/${systemuser}-${subdomain}.conf /etc/nginx/conf.d/ &>> $LOG_FILE
ln -s /mnt/node1/${systemuser}/server_configurations/nginx/${systemuser}-${subdomain}.conf /etc/nginx/conf.d/ &>> $LOG_FILE
# touch /etc/nginx/conf.d/${systemuser}-${subdomain}.conf
# cp -rf $MAIN_DIR/nginx_zone_template.conf /etc/nginx/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s/\${domain1}/${domain1}/g" /etc/nginx/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s/\${domain2}/${domain2}/g" /etc/nginx/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s#\${proxy_pass}#${domain1}#g" /etc/nginx/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s/\${user}/${subdomain}/g" /etc/nginx/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
else else
echo "-----------------------------------------------------" &>> $LOG_FILE echo "-----------------------------------------------------" &>> $LOG_FILE
echo "Skipping nginx config already exist" &>> $LOG_FILE echo "Skipping nginx config already exist" &>> $LOG_FILE
@@ -192,32 +185,13 @@ function run_http_domain_server()
sed -i "s#\${serveralias2}#${domain2}#g" ${base_http}/${systemuser}-${subdomain}.conf &>> $LOG_FILE sed -i "s#\${serveralias2}#${domain2}#g" ${base_http}/${systemuser}-${subdomain}.conf &>> $LOG_FILE
sed -i "s/\${domain}/${member_domain}/g" ${base_http}/${systemuser}-${subdomain}.conf &>> $LOG_FILE sed -i "s/\${domain}/${member_domain}/g" ${base_http}/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# ln -s /mnt/node1/${server_systemuser}/server_configurations/httpd/${systemuser}-${subdomain}.conf /etc/httpd/conf.d/ mv /mnt/node1/${systemuser}/server_configurations/httpd/${systemuser}-${subdomain}.conf /etc/httpd/conf.d/
ln -s /mnt/node1/${systemuser}/server_configurations/httpd/${systemuser}-${subdomain}.conf /etc/httpd/conf.d/
ln -s /mnt/node1/xrnhy4h8dk4rvznmzwfmsiyy/server_configurations/httpd/xrnhy4h8dk4rvznmzwfmsiyy-www.conf /etc/httpd/conf.d/
# touch /etc/httpd/conf.d/${systemuser}-${subdomain}.conf
# cp -rf $MAIN_DIR/apache_zone_template.conf /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s/\${domain1}/${domain1}/g" /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s/\${domain2}/${domain2}/g" /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s#\${document_root}#/home/${systemuser}/websites/www#g" /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s#\${subdomain}#${systemuser}#g" /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# sed -i "s#\${serveralias2}#${domain2}#g" /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
# # sed -i "s#\${rewrite_url}#http://www.appfactory.studio#g" /etc/httpd/conf.d/${systemuser}-${subdomain}.conf &>> $LOG_FILE
else else
echo "-----------------------------------------------------" &>> $LOG_FILE echo "-----------------------------------------------------" &>> $LOG_FILE
echo "Skipping httpd config already exist" &>> $LOG_FILE echo "Skipping httpd config already exist" &>> $LOG_FILE
fi fi
if [ ! -f /etc/letsencrypt/live/${domain2}/privkey.pem ]; then if [ ! -f /etc/letsencrypt/live/${domain2}/privkey.pem ]; then
# TODO_1: Remove symbolic links that are broken so that nginx does
# not fail reloading and letsencrypt fails also if letsencypt fails
# for whatever else reason run some kind of fallback and notify of
# non active https
# TODO_1: I nolonger do sym links
# https://www.google.com/search?client=firefox-b-1-d&q=shell+script+loop+through+directory+and+remove+sys+links # https://www.google.com/search?client=firefox-b-1-d&q=shell+script+loop+through+directory+and+remove+sys+links
# Check if the directory exists # Check if the directory exists
if [ -d "/etc/nginx/conf.d/" ]; then if [ -d "/etc/nginx/conf.d/" ]; then
@@ -542,6 +516,21 @@ function make_storage_directories
mkdir -p /mnt/node1/$systemuser/temp &>> $LOG_FILE mkdir -p /mnt/node1/$systemuser/temp &>> $LOG_FILE
mkdir -p /mnt/node1/$systemuser/tmp &>> $LOG_FILE mkdir -p /mnt/node1/$systemuser/tmp &>> $LOG_FILE
chown apache.apache -R /mnt/node1/$systemuser/modules
chmod 777 -R /mnt/node1/$systemuser/modules
chown apache.apache -R /mnt/node1/$systemuser/services
chmod 777 -R /mnt/node1/$systemuser/services
chown vmail.vmail -R /mnt/node1/$systemuser/mailbox
chmod 777 -R /mnt/node1/$systemuser/mailbox
chown apache.apache -R /mnt/node1/$systemuser/temp
chmod 777 -R /mnt/node1/$systemuser/temp
chown apache.apache -R /mnt/node1/$systemuser/tmp
chmod 777 -R /mnt/node1/$systemuser/tmp
echo "==========================================================================" &>> $LOG_FILE echo "==========================================================================" &>> $LOG_FILE
echo "============= $systemuser" &>> $LOG_FILE echo "============= $systemuser" &>> $LOG_FILE
echo "============= $server_systemuser" &>> $LOG_FILE echo "============= $server_systemuser" &>> $LOG_FILE

View File

@@ -33,26 +33,26 @@ chown -R $systemuser.apache /home/${systemuser}/websites/$subdomain/portal/admin
### Initialize watcher service ### Initialize watcher service
systemctl stop afs-watcher-$systemuser-${subdomain}.service # systemctl stop afs-watcher-$systemuser-${subdomain}.service
systemctl disable afs-watcher-$systemuser-${subdomain}.service # systemctl disable afs-watcher-$systemuser-${subdomain}.service
BASE="/home/${systemuser}/websites/$subdomain/portal/admin/core/scripts" # BASE="/home/${systemuser}/websites/$subdomain/portal/admin/core/scripts"
systemdfile2="$BASE/afs-watcher-$systemuser-${subdomain}.service" # systemdfile2="$BASE/afs-watcher-$systemuser-${subdomain}.service"
if [ -e $systemdfile2 ]; then # if [ -e $systemdfile2 ]; then
rm -rf $systemdfile2 # rm -rf $systemdfile2
echo "file removed: $systemdfile2" # echo "file removed: $systemdfile2"
fi # fi
touch $systemdfile2 # touch $systemdfile2
cp -rf "$BASE/afs-watcher.service" $systemdfile2 # cp -rf "$BASE/afs-watcher.service" $systemdfile2
sed -i "s/{{systemuser}}/${systemuser}/g" $systemdfile2 # sed -i "s/{{systemuser}}/${systemuser}/g" $systemdfile2
sed -i "s/{{subdomain}}/$subdomain/g" $systemdfile2 # sed -i "s/{{subdomain}}/$subdomain/g" $systemdfile2
if [ -e "/etc/systemd/system/afs-watcher-$systemuser-${subdomain}.service" ]; then # if [ -e "/etc/systemd/system/afs-watcher-$systemuser-${subdomain}.service" ]; then
rm -rf /etc/systemd/system/afs-watcher-$systemuser-${subdomain}.service # rm -rf /etc/systemd/system/afs-watcher-$systemuser-${subdomain}.service
echo "file removed: afs-watcher-$systemuser-${subdomain}.service" # echo "file removed: afs-watcher-$systemuser-${subdomain}.service"
fi # fi
cp -rf $systemdfile2 /etc/systemd/system/ # cp -rf $systemdfile2 /etc/systemd/system/
systemctl daemon-reload systemctl daemon-reload
systemctl enable afs-watcher-$systemuser-${subdomain}.service systemctl enable afs-watcher-$systemuser-${subdomain}.service

View File

@@ -92,26 +92,6 @@ function html($title,$dir){
<script src="/portal/admin/core/api/js/libs/zonefile.min.js"></script> <script src="/portal/admin/core/api/js/libs/zonefile.min.js"></script>
<script src="/portal/admin/core/api/js/libs/tinymce/js/tinymce/tinymce.min.js"></script> <script src="/portal/admin/core/api/js/libs/tinymce/js/tinymce/tinymce.min.js"></script>
<!-- <script src="/portal/admin/core/api/js/libs/fetch-jsonp.js"></script>
<script src="/portal/admin/core/api/js/appfactory/appfactory3.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsform.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsplugin.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afscard.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afssponsorship.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afspayments.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsnotificationmanager.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsspinner.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsdonations.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsanalytics.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afssubscriber.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsevents.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsextras.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsemail.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsdocuments.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsaccount.js"></script>
<script src="/portal/admin/core/api/js/appfactory/afsnotifications.js"></script>
<script src="/portal/admin/core/api/js/default_schema.js"></script> -->
<link rel="stylesheet" href="./css/main.css"> <link rel="stylesheet" href="./css/main.css">
<link rel="stylesheet" href="./css/styles.css"> <link rel="stylesheet" href="./css/styles.css">
<link rel="stylesheet" href="./css/global.css"> <link rel="stylesheet" href="./css/global.css">

View File

@@ -205,54 +205,6 @@
}); });
// Promise.all(promises).then((m) =>{
// let app = new ApplicationContextManager();
// app.extra.url = URL;
// app.extra.config = {};
// app.extra.current = {};
// app.extra.views = {};
// app.extra.extras = afsextras;
// app.extra.instances = {};
// app.extra.account = {};
// app.extra.config.configurations = AFS_SCHEMA_DESCRIPTION_INTEGRATION(app.extra.config.configurations);
// let payments_config_array = app.extra.config.configurations.processors;
// let client = new app.extra.extras.SystemClientMemberManager(payments_config_array, app);
// // client.setupNewMember(app.extra.root.member.access_nameid,"access",app,function(access){});
// let domain_settings = app.extra.config.configurations.domain_settings;
// let domain_user_settings = app.extra.config.configurations.domain_user_settings;
// let managed_domain = app.extra.config.managed_domain;
// let member = new afsextras.SystemAccountMemberManager(app.extra.root.member, app.extra.root.access, managed_domain, client, app);
// app.extra.domain = new afsextras.SystemAccountDomainManager(
// app.extra.root.user,
// app.extra.root.access,
// domain_settings,
// domain_user_settings,
// managed_domain,
// member,
// client,
// app);
// requirejs.config({ baseUrl: 'js/pages' });
// let routes = ["index"];
// require(routes, function(route_func){
// FullPageLoader(false);
// route_func(app);
// });
// });
})(); })();

View File

@@ -1,7 +1,6 @@
define(['main'], function(main) { define(['main'], function(main) {
function func_logout_event(app){ function func_logout_event(app){
$('.log_out_link').on('click',function(e){ $('.log_out_link').on('click',function(e){
e.preventDefault(); e.preventDefault();