Why Nostr? What is Njump?
2024-07-03 00:54:48

npub1tt…cvarn on Nostr: commit e95f06d72e9aba0f561878ccb866ad910589f856 Author: randymcmillan ...

commit e95f06d72e9aba0f561878ccb866ad910589f856
Author: randymcmillan <[email protected]>
Date: Mon Sep 18 16:40:52 2023 -0400

web:remove

diff --git a/web/CMakeLists.txt b/web/CMakeLists.txt
deleted file mode 100644
index 64156ae73..000000000
--- a/web/CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-# This file is part of 'Nostr_client_relay'
-# Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-# See file LICENSE for full license details.
-
-message(STATUS "WT_INCLUDE: " ${WT_INCLUDE})
-message(STATUS "WT_CONFIG_H: " ${WT_CONFIG_H})
-message(STATUS "Source directory is " ${CMAKE_SOURCE_DIR})
-message(STATUS "Build directory is " ${CMAKE_CURRENT_BINARY_DIR})
-
-include_directories(${WT_INCLUDE})
-include_directories(${WT_CONFIG_H})
-
-#//////////////////////////
-# common sources library
-#//////////////////////////
-
-set(web ${web})
-set(web ${web} feed.hh)
-set(web ${web} feed.cc)
-set(web ${web} home.hh)
-set(web ${web} home.cc)
-set(web ${web} follows.hh)
-set(web ${web} follows.cc)
-
-add_executable(wostro web.cc web.hh ${web})
-
-#//////////////////////////
-#link with libraries
-#LIB_DEP contains a cascade definition of all the libraries needed to link
-#//////////////////////////
-
-set(lib_web ${lib_web})
-
-if (MSVC)
- set(lib_web ${lib_web} ${CMAKE_SOURCE_DIR}/ext/wt-4.10.0/build/src/Debug/wtd.lib)
- set(lib_web ${lib_web} ${CMAKE_SOURCE_DIR}/ext/wt-4.10.0/build/src/http/Debug/wthttpd.lib)
- set (BOOST_LIB_DIRS ${CMAKE_SOURCE_DIR}/ext/boost_1_82_0/lib/)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_filesystem-vc143-mt-gd-x64-1_82.lib)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_thread-vc143-mt-gd-x64-1_82.lib)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_program_options-vc143-mt-gd-x64-1_82.lib)
-endif()
-
-if(APPLE)
- set(lib_web ${lib_web} $ENV{HOME}/wt_install/lib/libwt.dylib)
- set(lib_web ${lib_web} $ENV{HOME}/wt_install/lib/libwthttp.dylib)
- set(BOOST_LIB_DIRS $ENV{HOME}/git/nostr_client_relay/ext/boost_1_82_0/stage/lib)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_filesystem.a)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_thread.a)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_program_options.a)
-endif()
-
-if (LINUX)
- set(lib_web ${lib_web} $ENV{HOME}/wt_install/lib/libwt.so)
- set(lib_web ${lib_web} $ENV{HOME}/wt_install/lib/libwthttp.so)
- set(BOOST_LIB_DIRS $ENV{HOME}/git/nostr_client_relay/ext/boost_1_82_0/stage/lib)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_filesystem.so)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_thread.so)
- set(lib_web ${lib_web} ${BOOST_LIB_DIRS}/libboost_program_options.so)
-endif()
-
-set(lib_web ${lib_web} ${lib_dep})
-target_link_libraries (wostro ${lib_web})
-
-message(STATUS "Copying data files to: ${CMAKE_BINARY_DIR}/web")
-file(COPY "${CMAKE_SOURCE_DIR}/web/nostro.css" DESTINATION ${CMAKE_BINARY_DIR}/web)
-add_custom_target(css SOURCES ${CMAKE_BINARY_DIR}/web/nostro.css)
diff --git a/web/Makefile b/web/Makefile
deleted file mode 100644
index 4098a52f3..000000000
--- a/web/Makefile
+++ /dev/null
@@ -1,278 +0,0 @@
-# CMAKE generated file: DO NOT EDIT!
-# Generated by "Unix Makefiles" Generator, CMake Version 3.26
-
-# Default target executed when no arguments are given to make.
-default_target: all
-.PHONY : default_target
-
-# Allow only one "make -f Makefile2" at a time, but pass parallelism.
-.NOTPARALLEL:
-
-#=============================================================================
-# Special targets provided by cmake.
-
-# Disable implicit rules so canonical targets will work.
-.SUFFIXES:
-
-# Disable VCS-based implicit rules.
-% : %,v
-
-# Disable VCS-based implicit rules.
-% : RCS/%
-
-# Disable VCS-based implicit rules.
-% : RCS/%,v
-
-# Disable VCS-based implicit rules.
-% : SCCS/s.%
-
-# Disable VCS-based implicit rules.
-% : s.%
-
-.SUFFIXES: .hpux_make_needs_suffix_list
-
-# Command-line flag to silence nested $(MAKE).
-$(VERBOSE)MAKESILENT = -s
-
-#Suppress display of executed commands.
-$(VERBOSE).SILENT:
-
-# A target that is always out of date.
-cmake_force:
-.PHONY : cmake_force
-
-#=============================================================================
-# Set environment variables for the build.
-
-# The shell in which to execute make rules.
-SHELL = /bin/sh
-
-# The CMake executable.
-CMAKE_COMMAND = /Applications/CMake.app/Contents/bin/cmake
-
-# The command to remove a file.
-RM = /Applications/CMake.app/Contents/bin/cmake -E rm -f
-
-# Escaping for special characters.
-EQUALS = =
-
-# The top-level source directory on which CMake was run.
-CMAKE_SOURCE_DIR = /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay
-
-# The top-level build directory on which CMake was run.
-CMAKE_BINARY_DIR = /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay
-
-#=============================================================================
-# Targets provided globally by CMake.
-
-# Special rule for the target edit_cache
-edit_cache:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
- /Applications/CMake.app/Contents/bin/ccmake -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
-.PHONY : edit_cache
-
-# Special rule for the target edit_cache
-edit_cache/fast: edit_cache
-.PHONY : edit_cache/fast
-
-# Special rule for the target rebuild_cache
-rebuild_cache:
- @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
- /Applications/CMake.app/Contents/bin/cmake --regenerate-during-build -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
-.PHONY : rebuild_cache
-
-# Special rule for the target rebuild_cache
-rebuild_cache/fast: rebuild_cache
-.PHONY : rebuild_cache/fast
-
-# The main all target
-all: cmake_check_build_system
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(CMAKE_COMMAND) -E cmake_progress_start /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay/CMakeFiles /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay/web//CMakeFiles/progress.marks
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 web/all
- $(CMAKE_COMMAND) -E cmake_progress_start /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay/CMakeFiles 0
-.PHONY : all
-
-# The main clean target
-clean:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 web/clean
-.PHONY : clean
-
-# The main clean target
-clean/fast: clean
-.PHONY : clean/fast
-
-# Prepare targets for installation.
-preinstall: all
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 web/preinstall
-.PHONY : preinstall
-
-# Prepare targets for installation.
-preinstall/fast:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 web/preinstall
-.PHONY : preinstall/fast
-
-# clear depends
-depend:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
-.PHONY : depend
-
-# Convenience name for target.
-web/CMakeFiles/wostro.dir/rule:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 web/CMakeFiles/wostro.dir/rule
-.PHONY : web/CMakeFiles/wostro.dir/rule
-
-# Convenience name for target.
-wostro: web/CMakeFiles/wostro.dir/rule
-.PHONY : wostro
-
-# fast build rule for target.
-wostro/fast:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/build
-.PHONY : wostro/fast
-
-# Convenience name for target.
-web/CMakeFiles/css.dir/rule:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 web/CMakeFiles/css.dir/rule
-.PHONY : web/CMakeFiles/css.dir/rule
-
-# Convenience name for target.
-css: web/CMakeFiles/css.dir/rule
-.PHONY : css
-
-# fast build rule for target.
-css/fast:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/css.dir/build.make web/CMakeFiles/css.dir/build
-.PHONY : css/fast
-
-feed.o: feed.cc.o
-.PHONY : feed.o
-
-# target to build an object file
-feed.cc.o:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/feed.cc.o
-.PHONY : feed.cc.o
-
-feed.i: feed.cc.i
-.PHONY : feed.i
-
-# target to preprocess a source file
-feed.cc.i:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/feed.cc.i
-.PHONY : feed.cc.i
-
-feed.s: feed.cc.s
-.PHONY : feed.s
-
-# target to generate assembly for a file
-feed.cc.s:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/feed.cc.s
-.PHONY : feed.cc.s
-
-follows.o: follows.cc.o
-.PHONY : follows.o
-
-# target to build an object file
-follows.cc.o:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/follows.cc.o
-.PHONY : follows.cc.o
-
-follows.i: follows.cc.i
-.PHONY : follows.i
-
-# target to preprocess a source file
-follows.cc.i:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/follows.cc.i
-.PHONY : follows.cc.i
-
-follows.s: follows.cc.s
-.PHONY : follows.s
-
-# target to generate assembly for a file
-follows.cc.s:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/follows.cc.s
-.PHONY : follows.cc.s
-
-home.o: home.cc.o
-.PHONY : home.o
-
-# target to build an object file
-home.cc.o:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/home.cc.o
-.PHONY : home.cc.o
-
-home.i: home.cc.i
-.PHONY : home.i
-
-# target to preprocess a source file
-home.cc.i:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/home.cc.i
-.PHONY : home.cc.i
-
-home.s: home.cc.s
-.PHONY : home.s
-
-# target to generate assembly for a file
-home.cc.s:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/home.cc.s
-.PHONY : home.cc.s
-
-web.o: web.cc.o
-.PHONY : web.o
-
-# target to build an object file
-web.cc.o:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/web.cc.o
-.PHONY : web.cc.o
-
-web.i: web.cc.i
-.PHONY : web.i
-
-# target to preprocess a source file
-web.cc.i:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/web.cc.i
-.PHONY : web.cc.i
-
-web.s: web.cc.s
-.PHONY : web.s
-
-# target to generate assembly for a file
-web.cc.s:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(MAKE) $(MAKESILENT) -f web/CMakeFiles/wostro.dir/build.make web/CMakeFiles/wostro.dir/web.cc.s
-.PHONY : web.cc.s
-
-# Help Target
-help:
- @echo "The following are some of the valid targets for this Makefile:"
- @echo "... all (the default if no target is provided)"
- @echo "... clean"
- @echo "... depend"
- @echo "... edit_cache"
- @echo "... rebuild_cache"
- @echo "... css"
- @echo "... wostro"
- @echo "... feed.o"
- @echo "... feed.i"
- @echo "... feed.s"
- @echo "... follows.o"
- @echo "... follows.i"
- @echo "... follows.s"
- @echo "... home.o"
- @echo "... home.i"
- @echo "... home.s"
- @echo "... web.o"
- @echo "... web.i"
- @echo "... web.s"
-.PHONY : help
-
-
-
-#=============================================================================
-# Special targets to cleanup operation of make.
-
-# Special rule to run CMake to check the build system integrity.
-# No rule that depends on this can have commands that come from listfiles
-# because they might be regenerated.
-cmake_check_build_system:
- cd /Users/Shared/gnostr.org/gnostr/deps/gnostr-relay && $(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
-.PHONY : cmake_check_build_system
-
diff --git a/web/feed.cc b/web/feed.cc
deleted file mode 100644
index 4e1dd8354..000000000
--- a/web/feed.cc
+++ /dev/null
@@ -1,144 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#include "feed.hh"
-
-extern std::string pubkey;
-extern std::vector<std::string> relays;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFeed
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ContainerFeed::ContainerFeed()
-{
- this->setStyleClass("blue-box");
-
- auto container = std::make_unique<Wt::WContainerWidget>();
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // options for table
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- m_check_raw = container->addNew<Wt::WCheckBox>("Raw message");
- m_check_raw->setChecked(true);
-
- auto button_follows = container->addWidget(std::make_unique<Wt::WPushButton>("Get Feed"));
- button_follows->setInline(false);
- button_follows->clicked().connect(this, &ContainerFeed::get_feed);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // table for events
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- m_table_messages = container->addWidget(std::make_unique<Wt::WTable>());
- m_table_messages->setStyleClass("table_messages");
-
- this->addWidget(std::move(container));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFeed::get_feed
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerFeed::get_feed()
-{
- m_table_messages->clear();
-
- std::string uri = relays.at(1);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // get follows returns an array of pubkeys
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- std::vector<std::string> pubkeys;
- if (nostr::get_follows(uri, pubkey, pubkeys) < 0)
- {
- }
-
- comm::to_file("pubkeys.txt", pubkeys);
-
- int row = 0;
- for (int idx_key = 0; idx_key < pubkeys.size(); idx_key++)
- {
- std::string pubkey = pubkeys.at(idx_key);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // get feed returns an array of JSON events
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- std::vector<std::string> events;
- if (nostr::get_feed(uri, pubkey, events) < 0)
- {
- }
-
- for (int idx_eve = 0; idx_eve < events.size(); idx_eve++)
- {
- std::string message = events.at(idx_eve);
- try
- {
- nlohmann::json js = nlohmann::json::parse(message);
- std::string type = js.at(0);
- if (type.compare("EVENT") == 0)
- {
- nostr::event_t ev;
- from_json(js.at(2), ev);
- std::string json = js.dump(1);
- std::stringstream s;
- s << "follow." << row + 1 << ".json";
- comm::json_to_file(s.str(), json);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // add complete JSON formatted message to HTML table or just contents
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- Wt::WText* wtext;
- if (m_check_raw->isChecked() == true)
- {
- wtext = m_table_messages->elementAt(row, 0)->addNew<Wt::WText>(json);
- }
- else
- {
- std::string content = ev.content;
- wtext = m_table_messages->elementAt(row, 0)->addNew<Wt::WText>(pubkey);
- wtext = m_table_messages->elementAt(row, 1)->addNew<Wt::WText>(content);
- }
-
-
- wtext->setHeight(100);
- wtext->clicked().connect([=]()
- {
- row_text(wtext->text());
- });
- row++;
- }
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
- } //events
- } //pubkeys
-
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFeed::row_text
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerFeed::row_text(const Wt::WString& s)
-{
- std::string message = s.toUTF8();
- try
- {
- nlohmann::json js = nlohmann::json::parse(message);
- std::string json = js.dump(1);
- comm::json_to_file("row_text.json", json);
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
-}
-
diff --git a/web/feed.hh b/web/feed.hh
deleted file mode 100644
index c1e454c08..000000000
--- a/web/feed.hh
+++ /dev/null
@@ -1,24 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#ifndef NOSTRO_WEB_FEED_HH
-#define NOSTRO_WEB_FEED_HH
-
-#include "web.hh"
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFeed
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class ContainerFeed : public Wt::WContainerWidget
-{
-public:
- ContainerFeed();
- Wt::WCheckBox* m_check_raw;
- Wt::WTable* m_table_messages;
- void row_text(const Wt::WString& s);
- void get_feed();
-};
-
-#endif
\ No newline at end of file
diff --git a/web/follows.cc b/web/follows.cc
deleted file mode 100644
index 637e52df0..000000000
--- a/web/follows.cc
+++ /dev/null
@@ -1,150 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#include "follows.hh"
-
-extern std::string pubkey;
-extern std::vector<std::string> relays;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFollows
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ContainerFollows::ContainerFollows()
-{
- this->setStyleClass("blue-box");
-
- auto container = std::make_unique<Wt::WContainerWidget>();
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // options for table
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- m_check_raw = container->addNew<Wt::WCheckBox>("Raw message");
- m_check_raw->setChecked(true);
- m_check_raw->clicked().connect(this, &ContainerFollows::get_follows);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // table for events
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- m_table_messages = container->addWidget(std::make_unique<Wt::WTable>());
- m_table_messages->setStyleClass("table_messages");
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // get_follows
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- get_follows();
-
- this->addWidget(std::move(container));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFollows::get_follows
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerFollows::get_follows()
-{
- m_table_messages->clear();
-
- std::string uri = relays.at(1);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // get follows returns an array of pubkeys
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- std::vector<std::string> pubkeys;
- if (nostr::get_follows(uri, pubkey, pubkeys) < 0)
- {
- }
-
- comm::to_file("pubkeys.txt", pubkeys);
-
- int row = 0;
- for (int idx_key = 0; idx_key < pubkeys.size(); idx_key++)
- {
- std::string pubkey = pubkeys.at(idx_key);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // get metadata returns an array of JSON events
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- std::vector<std::string> events;
- if (nostr::get_metadata(uri, pubkey, events) < 0)
- {
- }
-
- for (int idx_eve = 0; idx_eve < events.size(); idx_eve++)
- {
- std::string message = events.at(idx_eve);
- try
- {
- nlohmann::json js = nlohmann::json::parse(message);
- std::string type = js.at(0);
- if (type.compare("EVENT") == 0)
- {
- nostr::event_t ev;
- from_json(js.at(2), ev);
- std::string json = js.dump(1);
- std::stringstream ss;
- ss << "follow." << row + 1 << ".json";
- comm::json_to_file(ss.str(), json);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // add complete JSON formatted message to HTML table or just contents
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- Wt::WText* wtext;
- if (m_check_raw->isChecked() == true)
- {
- wtext = m_table_messages->elementAt(row, 0)->addNew<Wt::WText>(json);
- }
- else
- {
- std::string content = ev.content;
- wtext = m_table_messages->elementAt(row, 0)->addNew<Wt::WText>(pubkey);
- wtext = m_table_messages->elementAt(row, 1)->addNew<Wt::WText>(content);
-
- std::stringstream s;
- s << "content." << row + 1 << ".json";
- comm::json_to_file(s.str(), content);
- }
-
-
- wtext->setHeight(100);
- wtext->clicked().connect([=]()
- {
- row_text(wtext->text());
- });
- row++;
- }
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
- } //events
- } //pubkeys
-
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFollows::row_text
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerFollows::row_text(const Wt::WString& s)
-{
- std::string message = s.toUTF8();
- try
- {
- nlohmann::json js = nlohmann::json::parse(message);
- std::string json = js.dump(1);
- comm::json_to_file("row_text.json", json);
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
-}
\ No newline at end of file
diff --git a/web/follows.hh b/web/follows.hh
deleted file mode 100644
index e70407571..000000000
--- a/web/follows.hh
+++ /dev/null
@@ -1,24 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#ifndef WOSTRO_FOLLOWS_HH
-#define WOSTRO_FOLLOWS_HH
-
-#include "web.hh"
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerFollows
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class ContainerFollows : public Wt::WContainerWidget
-{
-public:
- ContainerFollows();
- Wt::WCheckBox* m_check_raw;
- Wt::WTable* m_table_messages;
- void row_text(const Wt::WString& s);
- void get_follows();
-};
-
-#endif
\ No newline at end of file
diff --git a/web/home.cc b/web/home.cc
deleted file mode 100644
index c8808f774..000000000
--- a/web/home.cc
+++ /dev/null
@@ -1,426 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#include "home.hh"
-
-extern std::string pubkey;
-extern std::vector<std::string> relays;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerHome
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-ContainerHome::ContainerHome() : m_row(0)
-{
- this->setStyleClass("blue-box");
-
- //first Nostr event to "nostr.pleb.network"
- const std::string event_id("d75d56b2141b12be96421fc5c913092cda06904208ef798b51a28f1c906bbab7");
- const std::string def_pubkey("4ea843d54a8fdab39aa45f61f19f3ff79cc19385370f6a272dda81fade0a052b");
-
- std::string uri = relays.at(1);
- pubkey = def_pubkey;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //top container input
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto container_top = std::make_unique<Wt::WContainerWidget>();
-
- container_top->addWidget(std::make_unique<Wt::WText>("Relay wss://"));
- m_edit_uri = container_top->addWidget(std::make_unique<Wt::WLineEdit>());
- m_edit_uri->setText(uri);
- m_edit_uri->setWidth(200);
- m_edit_uri->setMargin(10, Wt::Side::Top | Wt::Side::Bottom | Wt::Side::Right);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //radion buttons, select EVENT or REQ
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- m_button_message = std::make_shared<Wt::WButtonGroup>();
- Wt::WRadioButton* button;
- button = container_top->addWidget(std::make_unique<Wt::WRadioButton>("Event"));
- m_button_message->addButton(button);
- button = container_top->addWidget(std::make_unique<Wt::WRadioButton>("Request"));
- m_button_message->addButton(button);
- m_button_message->setSelectedButtonIndex(1);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //seckey
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- Wt::WText* wtext_seckey = container_top->addWidget(std::make_unique<Wt::WText>("Private Key"));
- wtext_seckey->setMargin(20, Wt::Side::Left);
- wtext_seckey->setMargin(10, Wt::Side::Right);
- m_edit_seckey = container_top->addWidget(std::make_unique<Wt::WLineEdit>());
- m_edit_seckey->setWidth(400);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //pubkey
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- Wt::WText* wtext_pubkey = container_top->addWidget(std::make_unique<Wt::WText>("Public Key"));
- wtext_pubkey->setMargin(20, Wt::Side::Left);
- wtext_pubkey->setMargin(10, Wt::Side::Right);
- m_edit_pubkey = container_top->addWidget(std::make_unique<Wt::WLineEdit>());
- m_edit_pubkey->setWidth(500);
- m_edit_pubkey->setText(pubkey);
- m_edit_pubkey->changed().connect([=]
- {
- pubkey = m_edit_pubkey->text().toUTF8();
- });
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //containers for EVENT and REQ
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto container_row = std::make_unique<Wt::WContainerWidget>();
- auto box_row = container_row->setLayout(std::make_unique<Wt::WHBoxLayout>());
- auto box_left = box_row->addLayout(std::make_unique<Wt::WVBoxLayout>());
- auto box_right = box_row->addLayout(std::make_unique<Wt::WVBoxLayout>());
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //EVENT
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto group_event = box_left->addWidget(std::make_unique<Wt::WGroupBox>("Event"));
- group_event->setStyleClass("col");
- group_event->addWidget(std::make_unique<Wt::WText>("Content"));
- group_event->addWidget(std::make_unique<Wt::WBreak>());
-
- m_area_content = group_event->addWidget(std::make_unique<Wt::WTextArea>());
- m_area_content->setColumns(80);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //REQ
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto group_request = box_right->addWidget(std::make_unique<Wt::WGroupBox>("Request"));
- group_request->setStyleClass("col");
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // kind
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- Wt::WText* wtext_kind = group_request->addWidget(std::make_unique<Wt::WText>("Kind"));
- wtext_kind->setMargin(10, Wt::Side::Right);
- m_combo_kind = group_request->addNew<Wt::WComboBox>();
- m_combo_kind->addItem("1 Short Text Note");
- m_combo_kind->addItem("3 Contacts");
- m_combo_kind->setCurrentIndex(0);
- m_combo_kind->setMargin(10, Wt::Side::Bottom);
- m_combo_kind->changed().connect([=]
- {
- //1 Short Text Note 1
- //3 Contacts 2
- int index = m_combo_kind->currentIndex();
- if (index == 1)
- {
- m_edit_author->setText(m_edit_pubkey->text());
- }
- });
-
- group_request->addWidget(std::make_unique<Wt::WBreak>());
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // event id
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- group_request->addWidget(std::make_unique<Wt::WText>("Event id"));
- group_request->addWidget(std::make_unique<Wt::WBreak>());
- m_edit_event_id = group_request->addWidget(std::make_unique<Wt::WLineEdit>());
- m_edit_event_id->setWidth(500);
- m_edit_event_id->setInline(false);
- m_edit_event_id->setMargin(10, Wt::Side::Bottom);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // author
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- group_request->addWidget(std::make_unique<Wt::WText>("Author"));
- group_request->addWidget(std::make_unique<Wt::WBreak>());
- m_edit_author = group_request->addWidget(std::make_unique<Wt::WLineEdit>());
- m_edit_author->setWidth(500);
- m_edit_author->setMargin(10, Wt::Side::Bottom);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //generated message
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto container_message = std::make_unique<Wt::WContainerWidget>();
- container_message->addWidget(std::make_unique<Wt::WText>("Message"));
- m_area_message = container_message->addWidget(std::make_unique<Wt::WTextArea>());
- m_area_message->setInline(false);
- m_area_message->setColumns(150);
- m_area_message->setHeight(200);
- container_message->addWidget(std::make_unique<Wt::WBreak>());
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //buttons
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto button_gen = container_message->addWidget(std::make_unique<Wt::WPushButton>("Generate message"));
- auto button_send = container_message->addWidget(std::make_unique<Wt::WPushButton>("Send message"));
- m_check_raw = container_message->addNew<Wt::WCheckBox>("Raw message");
- m_check_raw->setChecked(true);
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //message received
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- m_table_messages = container_message->addWidget(std::make_unique<Wt::WTable>());
- m_table_messages->setStyleClass("table_messages");
-
- button_send->clicked().connect(this, &ContainerHome::send_message);
- button_gen->clicked().connect(this, &ContainerHome::make_message);
-
- auto container = std::make_unique<Wt::WContainerWidget>();
- container->addWidget(std::move(container_top));
- container->addWidget(std::move(container_row));
- container->addWidget(std::move(container_message));
- this->addWidget(std::move(container));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerHome::send_message
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerHome::send_message()
-{
- Wt::WString uri = m_edit_uri->text();
- WssClient client(uri.toUTF8(), false);
- std::vector<std::string> store;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // on_message
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- client.on_message = [&](std::shared_ptr<WssClient::Connection> connection, std::shared_ptr<WssClient::InMessage> in_message)
- {
- std::stringstream ss;
- std::string str = in_message->string();
- ss << "Received: " << str;
- comm::log(ss.str());
- store.push_back(str);
-
- try
- {
- nlohmann::json js_message = nlohmann::json::parse(str);
- std::string json = js_message.dump();
- comm::json_to_file("on_message.json", json);
-
- //Relays can send 3 types of messages, which must also be JSON arrays, according to the following patterns:
- //["EVENT", <subscription_id>, <event JSON as defined above>], used to send events requested by clients.
- //["EOSE", <subscription_id>], used to indicate the end of stored events and the beginning of events newly received in real - time.
- //["NOTICE", <message>], used to send human - readable error messages or other things to clients.
-
- std::string message_type = js_message.at(0);
- if (message_type.compare("EVENT") == 0)
- {
- nostr::event_t ev;
- from_json(js_message.at(2), ev);
- comm::log("event received: " + ev.content);
- if (m_check_raw->isChecked() == false)
- {
- str = ev.content;
- }
- }
- else
- {
- connection->send_close(1000);
- }
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
-
- Wt::WText* wtext = m_table_messages->elementAt(m_row, 0)->addNew<Wt::WText>(str);
- wtext->clicked().connect([=]()
- {
- row_text(wtext->text());
- });
- m_row++;
-
- };
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //on_open
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- client.on_open = [&](std::shared_ptr<WssClient::Connection> connection)
- {
- std::stringstream ss;
- ss << "Opened connection: HTTP " << connection.get()->http_version << " , code " << connection.get()->status_code;
- comm::log(ss.str());
-
- std::string message = m_area_message->text().toUTF8();
-
- ss.str(std::string());
- ss.clear();
- ss << "Sending: " << message;
- comm::log(ss.str());
- comm::json_to_file("on_open_message.json", message);
-
- m_table_messages->clear();
- m_row = 0;
-
- connection->send(message);
- };
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // on_close
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- client.on_close = [](std::shared_ptr<WssClient::Connection>, int status, const std::string&)
- {
- std::stringstream ss;
- ss << "Closed: " << status;
- comm::log(ss.str());
- };
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // on_error
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- client.on_error = [](std::shared_ptr<WssClient::Connection>, const SimpleWeb::error_code& ec)
- {
- std::stringstream ss;
- ss << "Error: " << ec << " : " << ec.message();
- comm::log(ss.str());
- };
-
-
- client.start();
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- // messages received
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- std::stringstream ss;
- ss << "Received " << store.size() << " messages: ";
- comm::log(ss.str());
-
- for (int idx = 0; idx < store.size(); idx++)
- {
- comm::log(store.at(idx));
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerHome::make_message
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerHome::make_message()
-{
- struct args args = { 0 };
- struct nostr_event ev = { 0 };
- char* buf = (char*)malloc(102400);
- std::string json_message;
-
- //request or event
- int is_req = m_button_message->checkedId();
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //REQ
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- if (is_req)
- {
- int index = m_combo_kind->currentIndex();
- int kind = 0;
- if (index == 0) kind = 1;
- else if (index == 1) kind = 3;
-
- //get event id
- std::string event_id = m_edit_event_id->text().toUTF8();
-
- //get author
- std::string author = m_edit_author->text().toUTF8();
-
- //get pubkey
- std::string pubkey = m_edit_pubkey->text().toUTF8();
-
- std::string subscription_id = uuid::generate_uuid_v4();
-
- if (event_id.size())
- {
- subscription_id = event_id;
- }
-
- nostr::filter_t filter;
- filter.kinds.push_back(kind);
- if (kind == nostr::kind_3) //contacts
- {
- filter.authors.push_back(pubkey);
- filter.limit = 1;
- }
- else if (kind == nostr::kind_1)
- {
- if (author.size()) filter.authors.push_back(author);
- filter.limit = 50;
- }
-
- json_message = nostr::make_request(subscription_id, filter);
- }
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //EVENT
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- else
- {
- //get content
- Wt::WString content = m_area_content->text();
- args.content = strdup(content.toUTF8().c_str());
-
- //get seckey
- Wt::WString sec = m_edit_seckey->text();
- if (sec.toUTF8().size())
- {
- args.sec = strdup(sec.toUTF8().c_str());
- }
-
- //nostril generated JSON
- if (::make_message(&args, &ev, &buf) < 0)
- {
- }
-
- json_message = buf;
- }
-
- //format JSON to display
- try
- {
- nlohmann::json js_message = nlohmann::json::parse(json_message);
- std::string json_indent = js_message.dump(1);
- m_area_message->setText(json_indent);
- comm::json_to_file("send_message.json", json_indent);
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
-
- free(buf);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerHome::row_text
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void ContainerHome::row_text(const Wt::WString& s)
-{
- std::string message = s.toUTF8();
- try
- {
- nlohmann::json js = nlohmann::json::parse(message);
- std::string json = js.dump(1);
- comm::json_to_file("row_text.json", json);
- }
- catch (const std::exception& e)
- {
- comm::log(e.what());
- }
-}
diff --git a/web/home.hh b/web/home.hh
deleted file mode 100644
index fe3a6b370..000000000
--- a/web/home.hh
+++ /dev/null
@@ -1,38 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#ifndef NOSTRO_WEB_HOME_HH
-#define NOSTRO_WEB_HOME_HH
-
-#include "web.hh"
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//ContainerHome
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class ContainerHome : public Wt::WContainerWidget
-{
-public:
- ContainerHome();
-
-private:
- Wt::WTextArea* m_area_content;
- Wt::WTextArea* m_area_message;
- Wt::WLineEdit* m_edit_uri;
- Wt::WLineEdit* m_edit_seckey;
- Wt::WLineEdit* m_edit_pubkey;
- Wt::WLineEdit* m_edit_event_id;
- Wt::WLineEdit* m_edit_author;
- Wt::WComboBox* m_combo_kind;
- Wt::WCheckBox* m_check_raw;
- std::shared_ptr<Wt::WButtonGroup> m_button_message;
- Wt::WTable* m_table_messages;
- int m_row;
- void send_message();
- void make_message();
- void row_text(const Wt::WString& s);
-};
-
-
-#endif
\ No newline at end of file
diff --git a/web/nostro.css b/web/nostro.css
deleted file mode 100644
index 10e22f5d0..000000000
--- a/web/nostro.css
+++ /dev/null
@@ -1,53 +0,0 @@
-.yellow-box {
- background-color: #FFE4C4;
- border: 1px solid black;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-.green-box {
- background-color: #c4ffb4;
- max-height: 100px;
- text-align: left;
- border: 1px solid black;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-.blue-box {
- background-color: #65dae8;
- border: 1px solid black;
- margin-top: 1ex;
- margin-bottom: 1ex;
-}
-
-.table_messages td, .table_messages th {
- border: 1px solid #ddd;
- padding: 8px;
- white-space: pre;
-}
-
-.table_messages tr:nth-child(even) {
- background-color: #f2f2f2;
-}
-
-.table_messages tr:hover {
- background-color: #ddd;
-}
-
-table {
- table-layout: fixed;
- width: 100%;
- border-collapse: collapse;
- border: 2px solid purple;
-}
-
-.row {
- display: grid;
- grid-auto-flow: column;
-}
-
-.col {
- border: solid;
- background-color: lightgrey;
-}
diff --git a/web/web.cc b/web/web.cc
deleted file mode 100644
index a8f8b963b..000000000
--- a/web/web.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#include "web.hh"
-#include "home.hh"
-#include "feed.hh"
-#include "follows.hh"
-
-std::string log_program_name("wostro");
-
-std::string pubkey;
-
-std::vector<std::string> relays = { "eden.nostr.land",
-"nos.lol",
-"relay.snort.social",
-"relay.damus.io",
-"nostr.wine",
-};
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//main
-// --docroot=. --http-port=80 --http-address=0.0.0.0
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-std::unique_ptr<Wt::WApplication> create_application(const Wt::WEnvironment& env)
-{
- return std::make_unique<NostroApplication>(env);
-}
-
-int main(int argc, char** argv)
-{
- try
- {
- comm::start_log();
- Wt::WServer server(argc, argv);
- server.addEntryPoint(Wt::EntryPointType::Application, create_application);
- server.run();
- }
- catch (std::exception& e)
- {
- comm::log(e.what());
- }
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//NostroApplication
-// CSS layout: by default, the widget corresponds to a <div> tag.
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-NostroApplication::NostroApplication(const Wt::WEnvironment& env)
- : WApplication(env)
-{
- useStyleSheet("nostro.css");
- setTitle("Nostro");
- root()->setStyleClass("yellow-box");
-
- auto container = std::make_unique<Wt::WContainerWidget>();
- m_layout = container->setLayout(std::make_unique<Wt::WHBoxLayout>());
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //menu
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto container_menu = std::make_unique<Wt::WContainerWidget>();
- m_menu = container_menu->addNew<Wt::WMenu>();
- m_menu->setStyleClass("green-box");
- m_menu->setWidth(100);
- m_menu->addItem("Home", std::make_unique<Wt::WAnchor>(Wt::WLink(Wt::LinkType::InternalPath, "home")));
- m_menu->addItem("Feed", std::make_unique<Wt::WAnchor>(Wt::WLink(Wt::LinkType::InternalPath, "feed")));
- m_menu->addItem("Follows", std::make_unique<Wt::WAnchor>(Wt::WLink(Wt::LinkType::InternalPath, "follows")));
- m_menu->itemSelected().connect(this, &NostroApplication::selected);
- m_layout->addWidget(std::move(container_menu));
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////
- //home
- /////////////////////////////////////////////////////////////////////////////////////////////////////
-
- auto container_home = std::make_unique<ContainerHome>();
- m_layout->addWidget(std::move(container_home), 1);
-
- root()->addWidget(std::move(container));
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//selected
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-void NostroApplication::selected()
-{
- Wt::WLayoutItem* item = m_layout->itemAt(1);
- m_layout->removeItem(item);
- int index = m_menu->currentIndex();
- std::unique_ptr<Wt::WContainerWidget> container;
- switch (index)
- {
- case 0: container = std::make_unique<ContainerHome>(); break;
- case 1: container = std::make_unique<ContainerFeed>(); break;
- case 2: container = std::make_unique<ContainerFollows>(); break;
- }
- m_layout->addWidget(std::move(container), 1);
-}
-
diff --git a/web/web.hh b/web/web.hh
deleted file mode 100644
index ad161510b..000000000
--- a/web/web.hh
+++ /dev/null
@@ -1,56 +0,0 @@
-// This file is part of 'Nostr_client_relay'
-// Copyright (c) 2023, Space Research Software LLC, Pedro Vicente. All rights reserved.
-// See file LICENSE for full license details.
-
-#ifndef NOSTRO_WEB_HH
-#define NOSTRO_WEB_HH
-
-#include <Wt/WApplication.h>
-#include <Wt/WBreak.h>
-#include <Wt/WContainerWidget.h>
-#include <Wt/WLineEdit.h>
-#include <Wt/WPushButton.h>
-#include <Wt/WText.h>
-#include <Wt/WServer.h>
-#include <Wt/WTextArea.h>
-#include <Wt/WHBoxLayout.h>
-#include <Wt/WVBoxLayout.h>
-#include <Wt/WCheckBox.h>
-#include <Wt/WGroupBox.h>
-#include <Wt/WTable.h>
-#include <Wt/WButtonGroup.h>
-#include <Wt/WRadioButton.h>
-#include <Wt/WComboBox.h>
-#include <Wt/WMenu.h>
-#include <Wt/WAnchor.h>
-#include <Wt/WLink.h>
-
-#include <future>
-#include <fstream>
-#include <vector>
-#include <string>
-#include "client_wss.hpp"
-#include "nostri.h"
-#include "uuid.hh"
-#include "log.hh"
-#include "nostr.hh"
-#include "database.hh"
-
-using WssClient = SimpleWeb::SocketClient<SimpleWeb::WSS>;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-//NostroApplication
-/////////////////////////////////////////////////////////////////////////////////////////////////////
-
-class NostroApplication : public Wt::WApplication
-{
-public:
- NostroApplication(const Wt::WEnvironment& env);
-
- Wt::WMenu* m_menu;
- Wt::WHBoxLayout* m_layout;
-
- void selected();
-};
-
-#endif
\ No newline at end of file
diff --git a/web/wt_config.xml b/web/wt_config.xml
deleted file mode 100644
index 2a0bc6c52..000000000
--- a/web/wt_config.xml
+++ /dev/null
@@ -1,841 +0,0 @@
-<!--
- Wt Configuration File.
-
- The Wt configuration file manages, for every Wt application, settings
- for session management, debugging, directory for runtime information
- such as session sockets, and some security settings.
-
- Settings may be specified globally, or for a single application path.
-
- The path should be as configured in the Wt build process, where it
- defaults to /etc/wt/wt_config.xml. It can be overridden in the environment
- variable WT_CONFIG_XML, or with the -c startup option of wthttp.
-
- The values listed here are the default values, which are used when the
- declaration is missing or no configuration file is used.
- -->
-
-<server>
-
- <!-- Default application settings
-
- The special location "*" always matches. See below for an example
- of settings specific to a single application.
- -->
- <application-settings location="*">
-
- <!-- Session management. -->
- <session-management>
- <!-- Every session runs within a dedicated process.
-
- This mode guarantees kernel-level session privacy, but as every
- session requires a separate process, it is also an easy target
- for DoS attacks if not shielded by access control.
-
- Note: currently only supported by the wtfcgi and wthttp
- connectors.
-
- max-num-sessions determines the maximum number of sessions
-
- num-session-threads determines the number of threads for every
- session process. If not specified, the number of threads for every
- session process is the same as the number of threads for the parent
- process.
- -->
-
- <!--
- <dedicated-process>
- <max-num-sessions>100</max-num-sessions>
- <num-session-threads>10</num-session-threads>
- </dedicated-process>
- -->
-
- <!-- Multiple sessions within one process.
-
- This mode spawns a number of processes, and sessions are
- allocated randomly to one of these processes (you should not
- use this for dynamic FCGI servers, but only in conjunction
- with a fixed number of static FCGI servers.
-
- This requires careful programming, as memory corruption in one
- session will kill all of the sessions in the same process. You
- should debug extensively using valgrind. Also, it is your
- responsibility to keep session state not interfering and
- separated.
-
- On the other hand, sessions are inexpensive, and this mode
- suffers far less from DoS attacks than dedicated-process mode.
- Use it for non-critical and well-debugged web applications.
-
- Note: the wthttp connector will ignore the num-processes
- setting and use only process.
- -->
- <shared-process>
- <num-processes>1</num-processes>
- </shared-process>
-
- <!-- Session tracking strategy.
-
- Possible values:
- Auto: cookies if available, otherwise URL rewriting
- URL: only URL rewriting
- Combined: uses URL rewriting, with a multi-session cookie to
- prevent stealing of sessions through the URL. Will
- not fall back to URL rewriting if cookies are not
- available. This is the most secure strategy.
-
- It is recommended to stick to URL rewriting or Combined for session
- tracking as this is more secure (it avoids the risk of attacks
- like CSRF or BREACH), and also provides proper support for
- concurrent sessions in a single browser.
- -->
- <tracking>URL</tracking>
-
- <!-- How reload should be handled.
-
- When reload should (or rather, may) spawn a new session, then
- even in the case cookies are not used for session management,
- the URL will not be cluttered with a sessionid.
- However, WApplication::refresh() will never be called.
- -->
- <reload-is-new-session>true</reload-is-new-session>
-
- <!-- Session timeout (seconds).
-
- When a session remains inactive for this amount of time, it is
- cleaned up.
- -->
- <timeout>600</timeout>
-
- <!-- Idle timeout (seconds).
-
- When the user does not interact with the application for the set number of seconds,
- WApplication::idleTimeout() is called. By default, this
- method quits the application immediately, but it can be overridden
- if different behaviour is desired.
-
- This feature can be used to prevent others from taking over a session
- when the device that the Wt application is being used from is left behind,
- and is most effective in combination with a fairly short session timeout (<timeout>)
-
- When omitted, or left empty, this feature is disabled.
- -->
- <!--<idle-timeout>900</idle-timeout>-->
-
- <!-- Server push timeout (seconds).
-
- When using server-initiated updates, the client uses
- long-polling requests. Proxies (including reverse
- proxies) are notorious for silently closing idle
- requests; the client therefore cancels the request
- periodically and issues a new one. This timeout sets
- the frequency.
- -->
- <server-push-timeout>50</server-push-timeout>
- </session-management>
-
- <!-- Settings that apply only to the FastCGI connector.
-
- To configure the wthttp connector, use command line options, or
- configure default options in /etc/wt/wthttpd
- -->
- <connector-fcgi>
- <!-- Valgrind path
-
- If debugging is enabled and this path is not empty, then valgrind
- will be started for every shared process, or for every session
- which has ?debug appended to the command line.
-
- The variable is slighly misnamed. Not only a path can be set,
- but also options, like for example:
-
- /usr/bin/valgrind - -leak-check=full
- -->
- <valgrind-path></valgrind-path>
-
- <!-- Run directory
-
- Path used by Wt to do session management.
- -->
- <run-directory>/home/pvn/wt_install/var/run/wt</run-directory>
-
- </connector-fcgi>
-
- <!-- Settings that apply only to the MS IIS ISAPI connector.
-
- To configure the wthttp connector, use command line options, or
- configure default options in /etc/wt/wthttpd
- -->
- <connector-isapi>
-
- <!-- Maximum Request Size spooled in memory (KiB)
-
- Normally, Wt keeps incoming requests (POST data) in memory.
- However, malicious users could send a big POST and as such
- use up all memory of your HTTP server. With this parameter,
- you tune how big a request can be before Wt spools it in a
- file before processing it. Legitimate big POST messages may
- occur when users are expected to upload files.
-
- See also max-request-size.
-
- The default value is 128K, which is more than enough for
- any interactive Wt event.
- -->
- <max-memory-request-size>128</max-memory-request-size>
- </connector-isapi>
-
- <!-- Javascript debug options
-
- Values:
- - naked: JavaScript errors are not caught at all
- - false: JavaScript errors are caught and a simple error message
- is printed to indicate that something is terribly wrong
- - stack: equivalent to 'false'
- - true: JavaScript errors are rethrown after server-side logging
-
- Unless the value is 'naked',
- WApplication::handleJavaScriptError() is called which by
- default logs the error and terminates the session.
- -->
- <debug>false</debug>
-
- <!-- Log file
-
- When the log file is empty, or omitted, logging is done to
- stderr. This may end up in the web server error log file
- (e.g. for apache + fastcgi module), or on stderr (e.g. for
- the built-in httpd).
- -->
- <log-file>/home/pvn/git/nostr_client_relay/build/web/wt.log.txt</log-file>
-
- <!-- Logger configuration
-
- This configures the logger. With the default configuration,
- everything except for debugging messages are logged.
-
- The configuration is a string that defines rules for
- enabling or disabling certain logging. It is a white-space
- delimited list of rules, and each rule is of the form:
-
- [-]level : enables (or disables) logging of messages of
- the given level; '*' is a wild-card that matches all
- levels
-
- [-]level:scope : enables (or disables) logging of
- messages of the given level and scope; '*' is a wild-card
- that matches all levels or scopes. The default
- configuration is "* -debug", i.e. by default everything
- is logged, except for "debug" messages.
-
- Some other examples:
-
- "* -debug debug:wthttp": logs everything, including
- debugging messages of scope "wthttp", but no other
- debugging messages.
-
- "* -info -debug": disables logging of info messages
- in addition to debugging messages.
-
- Note debugging messages are only emitted when debugging
- has been enabled while building Wt.
- -->
- <log-config>* -debug</log-config>
-
- <!-- Maximum HTTP request size (KiB)
-
- Maximum size of an incoming POST request. This value must be
- increased when the user is allowed to upload files.
- -->
- <max-request-size>128</max-request-size>
-
- <!-- Maximum form data (KiB)
-
- Maximum size of the data in a POST request of type
- 'application/x-www-form-urlencoded' (used for Wt form-field values)
- Note that the maximum size is also limited by the value of
- 'max-request-size'.
- -->
- <max-formdata-size>5120</max-formdata-size>
-
- <!--- Maximum number of pending events
-
- Client-side events (user-interaction, WTimer, custom js signals) are
- queued if the server did not yet respond to a previous update.
- This allows you to configure the maximum number of events in the queue.
- When the maximum is exceeded, the session stops and an error is logged
- in the server.
- Setting it to zero will disable the limit.
- -->
- <max-pending-events>1000</max-pending-events>
-
- <!-- Number of threads per process
-
- You may want to change this value if you would like to
- support more reentrant event loops, where you block one
- event loop using WDialog::exec() or related static
- methods. Everytime you enter such an event loop, one
- thread is blocked, and therefore the total number of
- sessions that reliably can do this is limited to the
- number of thread you have (minus one to unblock).
-
- You may also want to increase this number if your Wt
- application is regularly waiting for IO (databases, network,
- files, ...). If this number is too low, all threads could
- be waiting for IO operations to complete while your CPU
- is idle. Increasing the number of threads may help.
-
- Computing intensive applications may also increase this number,
- even though it is better to offload computations to a helper
- thread and user server push or a WTimer to check for
- completion of the task in order to keep your GUI responsive
- during the computations.
-
- When using the MS IIS ISAPI connector, this configures the
- number of threads that will be used to handle Wt requests.
- The IIS internal threads are never used to do any
- processing; all requests are forwarded to be handled in
- this threadpool. Rather than to configure a so-called
- 'web-garden' in IIS, increase this number. The ISAPI
- connector will not work correctly when a web-garden is
- configured.
-
- The default value is 10.
- -->
- <num-threads>10</num-threads>
-
- <!-- Session id length (number of characters) -->
- <session-id-length>16</session-id-length>
-
- <!-- DoS prevention: limit plain HTML sessions
-
- This is a simple measure which avoids Denial-of-Service
- attacks on plain HTML sessions, which are easy to mount in
- particular in the case of progressive bootstrap mode.
-
- This setting may be used to keep the ratio of plain HTML
- versus Ajax sessions under a certain ratio. Typically, most
- of your sessions will be Ajax sessions, and only a tiny
- fraction (e.g. less than 5%) will be plain HTML
- sessions. This ratio is only enforced when more than 20 sessions
- have been created.
-
- The default is 1 (= 100%), which means that 100% of all sessions
- may be plain HTML sessions, effectively disabling this feature. If
- you set it to 0.5 for example, that means that 50% of all sessions
- may be plain HTML sessions.
- -->
- <plain-ajax-sessions-ratio-limit>1</plain-ajax-sessions-ratio-limit>
-
- <!-- DoS prevention: adds a puzzle to validate Ajax sessions
-
- This is a simple measure which avoids Denial-of-Service
- attacks on Ajax sessions.
-
- When enabled, a puzzle needs to be solved in the first Ajax
- request which eliminates agents that do not build a proper
- DOM tree.
- -->
- <ajax-puzzle>false</ajax-puzzle>
-
- <!-- Do strict serialization of events.
-
- By default events are queued at the client-side, and
- transmitted to the server so that at any time only one
- request/response is pending. This scheme has a quality that
- resembles TCP: on a low-latency link you allow the
- transmission of many smaller requests, while on a high
- latency link, events will be propagated less often, but in
- batches.
-
- In any case, this scheme does not drop events, no matter
- how quickly they are generated.
-
- In rare cases, the scheme may result in unwanted behaviour,
- because the client-side is allowed to be slighly out of
- sync at the time an event is recorded with the server-side
- (and more so on high-latency links). The drastic
- alternative is to discard events while a response is
- pending, and can be configured by setting this option to
- true.
- -->
- <strict-event-serialization>false</strict-event-serialization>
-
- <!-- Enables web socket.
-
- By default Ajax and long polling are used to communicate
- between server and browser.
-
- By enabling web socket support, if the browser supports
- WebSockets, then WebSocket is the protocol used for
- communication between client and server. WebSockets are
- currently only supported by the built-in httpd Connector,
- which acts as both an HTTP and WebSocket server. The WebSocket
- protocol is intentionally not compatible with HTTP, through
- a special hand-shake mechanism, and requires
- that all (reverse) proxy servers also have explicit support
- for this protocol.
- -->
- <web-sockets>false</web-sockets>
-
- <!-- Enables the detection of webgl-capabilites.
-
- When this is enabled, the browser will try to create a
- webgl-context when loading to verify that it is possible. This
- is necessary when using WGLWidget.
-
- This can take up some load time. When your application does not
- use WGLWidget, this option can be set to false. It will improve
- the initial loading time of the web application.
- -->
- <webgl-detection>true</webgl-detection>
-
- <!-- Redirect message shown for browsers without JavaScript support
-
- By default, Wt will use an automatic redirect to start the
- application when the browser does not support
- JavaScript. However, browsers are not required to follow
- the redirection, and in some situations (when using XHTML),
- such automatic redirection is not supported.
-
- This configures the text that is shown in the anchor which
- the user may click to be redirected to a basic HTML version
- of your application.
- -->
- <redirect-message>Load basic HTML</redirect-message>
-
- <!-- Whether we are sitting behind a reverse proxy
-
- When deployed behind a reverse proxy (such as Apache or Squid),
- the server location is not read from the "Host" header,
- but from the X-Forwarded-For header, if present.
-
- This option is required to make e.g. clientAddress() return the
- correct address.
-
- Deprecated: use trusted-proxy-config instead. If this option is
- set to true, Wt will take the first non-local IP address from the
- Client-IP and X-Forwarded-For headers to determine the clientAddress().
- -->
- <!--<behind-reverse-proxy>false</behind-reverse-proxy>-->
-
- <!-- The following configuration options can be used when Wt is behind a reverse proxy.
- -->
- <trusted-proxy-config>
- <!-- Which header to use to get the real client IP address when behind a reverse proxy.
-
- This could be X-Forwarded-For (default), CF-Connecting-IP for Cloudflare,
- True-Client-IP, Fastly-Client-IP,...
-
- This will influence the IP address returned by WEnvironment::clientAddress() and
- Http::Request::clientAddress().
- -->
- <original-ip-header>X-Forwarded-For</original-ip-header>
-
- <!-- Which proxy servers are trusted
-
- You can use single IP addresses or subnets in CIDR notation.
-
- By default, no proxy servers are trusted and any proxy headers are ignored, e.g.
- X-Forwarded-For, X-Forwarded-Proto, etc.
- -->
- <trusted-proxies>
- <!-- loopback -->
- <!--
- <proxy>127.0.0.1/8</proxy>
- <proxy>::1/128</proxy>
- -->
- <!-- link local -->
- <!--
- <proxy>169.254.0.0/16</proxy>
- <proxy>fe80::/10</proxy>
- -->
- <!-- local -->
- <!--
- <proxy>10.0.0.0/8</proxy>
- <proxy>172.16.0.0/12</proxy>
- <proxy>192.168.0.0/16</proxy>
- <proxy>fc00::/7</proxy>
- -->
- </trusted-proxies>
- </trusted-proxy-config>
-
- <!-- Whether inline CSS is allowed.
-
- Some Wt widgets will insert CSS rules in the the inline
- stylesheet when first used. This can be disabled using this
- configuration option.
-
- Note: some widgets, such as WTreeView and WTableView,
- dynamically manipulate rules in this stylesheet, and will
- no longer work properly when inline-css is disabled.
- -->
- <inline-css>true</inline-css>
-
- <!-- The timeout before showing the loading indicator.
-
- The value is specified in ms.
- -->
- <indicator-timeout>500</indicator-timeout>
-
- <!-- The timeout for processing a double click event.
-
- The value is specified in ms.
- -->
- <double-click-timeout>200</double-click-timeout>
-
- <!-- Ajax user agent list
-
- Wt considers three types of sessions:
- - Ajax sessions: use Ajax and JavaScript
- - plain HTML sessions: use plain old server GETs and POSTs
- - bots: have clean internal paths and no persistent sessions
-
- By default, Wt does a browser detection to distinguish between
- the first two: if a browser supports JavaScript (and has it
- enabled), and has an Ajax DOM API, then Ajax sessions are chosen,
- otherwise plain HTML sessions.
-
- Here, you may indicate which user agents should or should
- not receive an Ajax session regardless of what they report as
- capabilities.
-
- Possible values for 'mode' are "white-list" or "black-list". A
- white-list will only treat the listed agents as supporting Ajax,
- all other agents will be served plain HTML sessions. A black-list
- will always server plain HTML sessions to listed agents and
- otherwise rely on browser capability detection.
-
- Each <user-agent> is a regular expression.
- -->
- <user-agents type="ajax" mode="black-list">
- <!-- <user-agent>.*Crappy browser.*</user-agent> -->
- </user-agents>
-
- <!-- Bot user agent list
-
- Here, you can specify user agents that should be should be
- treated as bots.
-
- Each <user-agent> is a regular expression.
- -->
- <user-agents type="bot">
- <user-agent>.*Googlebot.*</user-agent>
- <user-agent>.*msnbot.*</user-agent>
- <user-agent>.*Slurp.*</user-agent>
- <user-agent>.*Crawler.*</user-agent>
- <user-agent>.*Bot.*</user-agent>
- <user-agent>.*ia_archiver.*</user-agent>
- <user-agent>.*Twiceler.*</user-agent>
- <user-agent>.*Yandex.*</user-agent>
- <user-agent>.*Nutch.*</user-agent>
- <user-agent>.*MJ12bot.*</user-agent>
- <user-agent>.*Baiduspider.*</user-agent>
- <user-agent>.*Ezooms.*</user-agent>
- <user-agent>.*Sogou web spider.*</user-agent>
- <user-agent>.*AhrefsBot.*</user-agent>
- </user-agents>
-
- <!-- Configures different rendering engines for certain browsers.
-
- Currently this is only used to select IE7 compatible rendering
- engine for IE8, which solves problems of unreliable and slow
- rendering performance for VML which Microsoft broke in IE8.
-
- Before 3.3.0, the default value was IE8=IE7, but since 3.3.0
- this has been changed to an empty string (i.e. let IE8 use the
- standard IE8 rendering engine) to take advantage of IE8's
- improved CSS support. If you make heavy use of VML, you may need
- to revert to IE8=IE7.
- -->
- <UA-Compatible></UA-Compatible>
-
- <!-- Configures whether the progressive bootstrap method is used.
-
- The default bootstrap method first senses whether there is Ajax
- support, and only then creates the application.
-
- The progressive bootstrap method first renders a plain HTML
- version and later upgrades to an Ajax version.
-
- (Not to be confused with the Twitter Bootstrap theme)
- -->
- <progressive-bootstrap>false</progressive-bootstrap>
-
- <!-- Set session-ID cookie
-
- In its default (and recommended) configuration, Wt does not
- rely on cookies for session tracking.
-
- Wt has several mechanisms in place to prevent session ID stealing:
- - for an Ajax session, the session ID is not shown in the URL,
- avoiding session ID stealing through a referer attack.
- - in case the session ID is present in the URL (e.g. for a plain
- HTML session), Wt will redirect links to images or external
- anchors through an intermediate page that censors the session ID
-
- In case of the loss of a session ID, the impact is minimized:
- - a full page refresh is not supported if the client IP address
- changes or the user-agent changes
- - an Ajax update is protected by other state which is not exposed
- in the URL
-
- To still enable a full page refresh when the client IP address
- changes, an additional cookie may be set which is used only
- for this purpose, and can be enabled using this setting.
- -->
- <session-id-cookie>false</session-id-cookie>
-
- <!-- Configure cookie checks
-
- By default, Wt will test for cookie support using JavaScript.
- Because cookie manipulation from JavaScript is a common security
- risk vector, some prefer to disable these checks.
-
- -->
- <cookie-checks>true</cookie-checks>
-
- <!-- Configure meta headers
-
- The user-agent allows optional filtering based on the
- user-agent, using a regular expression. You can have multiple
- set-meta-headers definitions.
-
- Deprecated: use <head-matter> instead.
-
- <meta-headers user-agent=".*MSIE.*">
- <meta name="robots" content="noindex" />
- </meta-headers>
- -->
-
- <!-- Configure <head> matter
-
- The user-agent allows optional filtering based on the
- user-agent, using a regular expression. You can have multiple
- head-matter definitions.
-
- All contents will be inserted into the <head> tag
- verbatim. This could be useful for setting <meta> tags or
- <link> tags that are global for the entire application.
- -->
- <head-matter user-agent=".*MSIE.*">
- <meta name="robots" content="noindex" />
- </head-matter>
-
- <!-- Configure allowed origins for CORS (only for WidgetSet entry points)
-
- Since Wt 3.3.8, cross-origin requests are disallowed by default.
-
- <allowed-origins> allows to selectively allow cross-origin requests
- for WidgetSet entry points (cross-origin requests are always disallowed
- for normal applications).
-
- Use <allowed-origins> to determine which origins should be allowed.
- Wt will only allow requests with an Origin header if it is an exact
- match for one of the origins in the list.
-
- "null" can be included in the list of allowed origins. In that case,
- Wt responds with "Access-Control-Allow-Origin: *".
-
- If <allowed-origins> is omitted or empty, no origins are allowed.
-
- If <allowed-origins> contains * (the asterisk character),
- all origins are allowed.
- -->
- <allowed-origins>
- <!-- Leave empty to disallow all origins. -->
-
- <!-- To allow any origin: -->
- <!-- * -->
-
- <!-- To allow only http://example.com and http://example.org: -->
- <!-- http://example.com,http://example.org -->
- </allowed-origins>
-
- <!-- Runtime Properties
-
- These properties may be used to adapt applications to their
- deployment environment. Typical use is for paths to resources
- that may or may not be shared between several applications.
- -->
- <properties>
- <!-- baseURL property
-
- The absolute URL at which the application is deployed
- (known to the user). This is needed only in two scenarios.
-
- a) use of relative URLs in included XHTML
-
- When you use relative URLs for images, etc... in
- literal XHTML fragments (e.g. in WTemplate), which need
- to resolve against the deployment path of the
- application. This will not work as expected in the
- presence of an internal application path. This URL is
- set as base URL in the HTML, against which relative
- URLs are resolved so that these work correctly
- regardless of the internal path. It is also used
- explicitly in any URL generated by the library.
-
- b) widgetset mode deployments
-
- Another situation in which you need to define the baseURL is
- when deploying a widgetset mode application behind a reverse
- proxy. A widgetset mode application uses only absolute URLs
- because it may be hosted in a web page from an entirely
- different domain.
-
- By default, no baseURL is specified, in which case Wt will
- avoid using absolute URLs. Relative URLs passed in API calls
- will be "fixed" so that they resolve against the location of the
- application deploy path, even in the presence of an
- internal path.
- -->
- <!-- <property name="baseURL">"http://mysite.com/app</property>; -->
-
- <!-- resourcesURL property
-
- The URL at which the resources/ folder is deployed that
- comes distributed with Wt and contains auxiliary files
- used to primarily for styles and themes.
-
- The default value is 'resources/'
- -->
- <property name="resourcesURL">resources/</property>
-
- <!-- favicon property
-
- By default, a browser will try to fetch a /favicon.ico icon
- from the root of your web server which is used as an icon
- for your application. You can specify an alternative location
- by setting this property, or for an individual application
- entry point by passing a location to WServer::addEntryPoint().
- -->
- <!-- <property name="favicon">images/favicon.ico</property> -->
-
- <!-- leafletJSURL and leafletCSSURL properties
-
- This is required if you want to use WLeafletMap, since leaflet itself is not bundled with Wt.
- leafletJSURL should be a valid URL leading to the leaflet JavaScript, and leafletCSSURL to the leaflet CSS.
- -->
- <!-- <property name="leafletJSURL">https://unpkg.com/[email protected]/dist/leaflet.js</property>; -->
- <!-- <property name="leafletCSSURL">https://unpkg.com/[email protected]/dist/leaflet.css</property>; -->
-
- <!-- google_api_key property
-
- The Google API key to be used with WGoogleMap.
- -->
- <!-- <property name="google_api_key"></property> -->
-
- <!-- Mail properties
-
- These properties can be used to change the default settings used by Wt::Mail::Client.
-
- - smtp-host: the hostname (or IP address) of the SMTP server to connect to (defaults to "localhost")
- - smtp-port: the port of the SMTP server to connect to (defaults to 25)
- - smtp-self-host: the hostname that the mail client uses to identify itself (defaults to "localhost")
- - smtp-transport-encryption: the encryption method to use in the mail client. This can be "none", "starttls", or "tls".
- The default is "none" for no encryption.
- - smtp-auth-method: the method to use for authentication. This can be "none", "plain", or "login".
- The default is "none" for no authentication.
- - smtp-auth-username: the username to use for authentication (defaults to empty)
- - smtp-auth-password: the password to use for authentication (defaults to empty)
- -->
- <!-- <property name="smtp-host">localhost</property> -->
- <!-- <property name="smtp-port">25</property> -->
- <!-- <property name="smtp-self-host">localhost</property> -->
- <!-- <property name="smtp-transport-encryption>none</property> -->
- <!-- <property name="smtp-auth-method">none</property> -->
- <!-- <property name="smtp-auth-username"></property> -->
- <!-- <property name="smtp-auth-password"></property> -->
-
- <!-- AuthService properties
-
- These properties are used to configure AuthService.
-
- - auth-mail-sender-name: the sender name when AuthService sends emails, defaults to "Wt Auth module"
- - auth-mail-sender-address: the sender address when AuthService sends emails, defaults to "[email protected]"
- -->
- <!-- <property name="auth-mail-sender-name">Wt Auth module</property> -->
- <!-- <property name="auth-mail-sender-address">[email protected]</property> -->
-
- <!-- OAuthService properties
-
- These properties are used to configure OAuthService.
-
- - oauth2-secret: the secret used to create the OAuth2 'state' hash. By default,
- this is randomly generated, which is sufficient for single-process
- deployments, but for multi-process deployments the same value must
- be used in all processes and thus needs to be pre-configured.
- - oauth2-redirect-timeout: a timeout (in seconds) for when single-sign-on is used
- without popup. If a user takes longer than this to login,
- the application will be destroyed. The default is 10 minutes.
- -->
- <!-- <property name="oauth2-secret"></property> -->
- <!-- <property name="oauth2-redirect-timeout">600</property> -->
-
- <!-- SAML properties
-
- These properties are used to configure Saml::Service.
-
- - saml-secret: the secret used to create the SAML 'RelayState'. By default,
- this is randomly generated, which is sufficient for single-process
- deployments, but for multi-process deployments the same value must
- be used in all processes and thus needs to be pre-configured.
- - saml-redirect-timeout: a timeout (in seconds) for when single-sign-on is used
- without popup. If a user takes longer than this to login,
- the application will be destroyed. The default is 10 minutes.
- -->
- <!-- <property name="saml-secret"></property> -->
- <!-- <property name="saml-redirect-timeout">600</property> -->
-
- <!-- PayPal properties
-
- These properties can be used to configure Wt::Payment::PayPalService,
- by calling configureFromProperties().
-
- - paypal-user: the PayPal API username
- - paypal-password: the PayPal API password
- - paypal-signature: the PayPal API signature
- - paypal-api-server-url: the URL of the PayPal API server
- - paypal-pay-server-url: the URL of the server where the user is redirected for the payment
- - paypal-version: the PayPal API version
- -->
- <!-- <property name="paypal-user"></property>
- <property name="paypal-password"></property>
- <property name="paypal-signature"></property>
- <property name="paypal-api-server-url"></property>
- <property name="paypal-pay-server-url"></property>
- <property name="paypal-version"></property> -->
-
- <!-- TinyMCE properties
-
- These properties are used to configure TinyMCE for WTextEdit.
-
- - tinyMCEVersion: the version of TinyMCE to use, currently version 3.x and 4.x are supported
- - tinyMCEURL: the URL to the main TinyMCE script file
- - tinyMCEBaseURL: the base URL where TinyMCE is deployed.
- The default is resourcesURL/tiny_mce for TinyMCE 3,
- and resourcesURL/tinymce for TinyMCE 4 or later.
- Note: resourcesURL refers to the resourcesURL property, which itself defaults to "resources/"
- -->
- <!-- <property name="tinyMCEVersion">3</property> -->
- <!-- <property name="tinyMCEURL"></property> -->
- <!-- <property name="tinyMCEBaseURL">resources/tiny_mce</property> -->
- </properties>
-
- </application-settings>
-
-
- <!-- Override settings for specific applications.
-
- Location refers to physical filesystem location of the
- application. The application prints this location (which
- corresponds to argv[0]) to the log file on startup, and this
- should match exactly.
- -->
- <!--
- <application-settings
- location="/var/www/localhost/wt-examples/hello.wt">
- </application-settings>
- -->
-</server>
Author Public Key
npub1tth85ueuje56ezjqyux2pjhrlwcttajr2gj7ttdauks8t4xpn25s3cvarn