This commit is contained in:
@@ -13,30 +13,37 @@
|
||||
AppId={{BD165823-1DEF-4D23-87DC-3D7A9BB73A00}
|
||||
AppName={#MyAppName}
|
||||
AppVersion={#MyAppVersion}
|
||||
;AppVerName={#MyAppName} {#MyAppVersion}
|
||||
AppPublisher={#MyAppPublisher}
|
||||
AppPublisherURL={#MyAppURL}
|
||||
AppSupportURL={#MyAppURL}
|
||||
AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={autopf}\{#MyAppName}
|
||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||
; "ArchitecturesAllowed=x64compatible" specifies that Setup cannot run
|
||||
; on anything but x64 and Windows 11 on Arm.
|
||||
ArchitecturesAllowed=x64compatible
|
||||
; "ArchitecturesInstallIn64BitMode=x64compatible" requests that the
|
||||
; install be done in "64-bit mode" on x64 or Windows 11 on Arm,
|
||||
; meaning it should use the native 64-bit Program Files directory and
|
||||
; the 64-bit view of the registry.
|
||||
ArchitecturesInstallIn64BitMode=x64compatible
|
||||
DefaultGroupName={#MyAppName}
|
||||
DisableProgramGroupPage=yes
|
||||
LicenseFile=repertory\LICENSE.md
|
||||
; Uncomment the following line to run in non administrative install mode (install for current user only).
|
||||
;PrivilegesRequired=lowest
|
||||
OutputBaseFilename=repertory_{#MyAppVersion}_windows_@PROJECT_MARCH@_setup
|
||||
SolidCompression=yes
|
||||
WizardStyle=modern
|
||||
|
||||
[code]
|
||||
function CheckAddPath(Param: string): boolean;
|
||||
var
|
||||
CurPath: string;
|
||||
begin
|
||||
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
|
||||
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
|
||||
'Path', CurPath)
|
||||
then begin
|
||||
Result := True;
|
||||
exit;
|
||||
end;
|
||||
|
||||
Result := Pos(';' + Param + ';', ';' + CurPath + ';') = 0;
|
||||
end;
|
||||
|
||||
[Languages]
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
@@ -47,10 +54,16 @@ Name: "winfsp"; Description: "WinFSP v@WINFSP_VERSION@"; Types: full custom
|
||||
[Files]
|
||||
Source: "repertory\*.*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; Components: main
|
||||
Source: "3rd_party\winfsp-@WINFSP_VERSION@.msi"; DestDir: "{app}"; Flags: ignoreversion; Components: winfsp
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
|
||||
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-ui --hidden"
|
||||
Name: "{commonstartup}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Parameters: "-ui --no-auto-open --hidden"
|
||||
|
||||
[Run]
|
||||
Filename: "msiexec.exe"; WorkingDir: "{app}"; Parameters: "/a winfsp-@WINFSP_VERSION@.msi /norestart"; Flags: 64bit waituntilterminated; Components: winfsp
|
||||
Filename: "msiexec.exe"; WorkingDir: "{app}"; Parameters: "/a winfsp-@WINFSP_VERSION@.msi /norestart"; \
|
||||
Flags: 64bit waituntilterminated; Components: winfsp
|
||||
|
||||
[Registry]
|
||||
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; \
|
||||
ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app};"; \
|
||||
Check: CheckAddPath('{app}')
|
||||
|
@@ -42,6 +42,7 @@ inline const option get_directory_items_option = {"-gdi",
|
||||
inline const option get_pinned_files_option = {"-gpf", "--get_pinned_files"};
|
||||
inline const option help_option = {"-h", "--help"};
|
||||
inline const option hidden_option = {"-hidden", "--hidden"};
|
||||
inline const option launch_only_option = {"-lo", "--launch_only"};
|
||||
inline const option open_files_option = {"-of", "--open_files"};
|
||||
inline const option pin_file_option = {"-pf", "--pin_file"};
|
||||
inline const option pinned_status_option = {"-ps", "--pinned_status"};
|
||||
@@ -71,6 +72,7 @@ inline const std::vector<option> option_list = {
|
||||
get_pinned_files_option,
|
||||
help_option,
|
||||
hidden_option,
|
||||
launch_only_option,
|
||||
open_files_option,
|
||||
password_option,
|
||||
pin_file_option,
|
||||
|
@@ -27,7 +27,11 @@
|
||||
namespace repertory::ui {
|
||||
class mgmt_app_config final {
|
||||
public:
|
||||
mgmt_app_config();
|
||||
mgmt_app_config(bool hidden, bool launch_only);
|
||||
|
||||
private:
|
||||
std::atomic<bool> hidden_{false};
|
||||
std::atomic<bool> launch_only_{false};
|
||||
|
||||
private:
|
||||
atomic<std::string> api_password_{"repertory"};
|
||||
@@ -52,6 +56,10 @@ public:
|
||||
|
||||
[[nodiscard]] auto get_api_user() const -> std::string { return api_user_; }
|
||||
|
||||
[[nodiscard]] auto get_hidden() const -> bool { return hidden_; }
|
||||
|
||||
[[nodiscard]] auto get_launch_only() const -> bool { return launch_only_; }
|
||||
|
||||
[[nodiscard]] auto get_mount_location(provider_type prov,
|
||||
std::string_view name) const
|
||||
-> std::string;
|
||||
@@ -62,6 +70,10 @@ public:
|
||||
|
||||
void set_api_user(std::string_view api_user);
|
||||
|
||||
void set_hidden(bool hidden);
|
||||
|
||||
void set_launch_only(bool launch_only);
|
||||
|
||||
void set_mount_location(provider_type prov, std::string_view name,
|
||||
std::string_view location);
|
||||
};
|
||||
|
@@ -55,7 +55,10 @@ auto main(int argc, char **argv) -> int {
|
||||
|
||||
int ret{0};
|
||||
if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
||||
ui::mgmt_app_config config{};
|
||||
ui::mgmt_app_config config{
|
||||
utils::cli::has_option(args, utils::cli::options::hidden_option),
|
||||
utils::cli::has_option(args, utils::cli::options::launch_only_option),
|
||||
};
|
||||
|
||||
std::string data;
|
||||
auto res = utils::cli::parse_string_option(
|
||||
|
@@ -113,6 +113,41 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
|
||||
server_(server) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
#if defined(_WIN32)
|
||||
if (config_->get_hidden()) {
|
||||
::ShowWindow(::GetConsoleWindow(), SW_HIDE);
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
if (not config_->get_launch_only()) {
|
||||
#if defined(_WIN32)
|
||||
system(
|
||||
fmt::format(
|
||||
R"(start "Repertory Management Portal" "http://127.0.0.1:{}/ui")",
|
||||
config_->get_api_port())
|
||||
.c_str());
|
||||
#elif defined(__linux__)
|
||||
system(fmt::format(R"(xdg-open "http://127.0.0.1:{}/ui")",
|
||||
config_->get_api_port())
|
||||
.c_str());
|
||||
#else // error
|
||||
build fails here
|
||||
#endif
|
||||
}
|
||||
|
||||
std::uint16_t port{};
|
||||
if (not utils::get_next_available_port(config_->get_api_port(), port)) {
|
||||
fmt::println("failed to detect if port is available|{}",
|
||||
config_->get_api_port());
|
||||
return;
|
||||
}
|
||||
|
||||
if (port != config_->get_api_port()) {
|
||||
fmt::println("failed to listen on port|{}|next available|{}",
|
||||
config_->get_api_port(), port);
|
||||
return;
|
||||
}
|
||||
|
||||
server_->set_socket_options([](auto &&sock) {
|
||||
#if defined(_WIN32)
|
||||
int enable{1};
|
||||
@@ -244,32 +279,6 @@ handlers::handlers(mgmt_app_config *config, httplib::Server *server)
|
||||
#endif // !defined(_WIN32)
|
||||
std::signal(SIGTERM, quit_handler);
|
||||
|
||||
#if defined(_WIN32)
|
||||
system(fmt::format(
|
||||
R"(start "Repertory Management Portal" "http://127.0.0.1:{}/ui")",
|
||||
config_->get_api_port())
|
||||
.c_str());
|
||||
#elif defined(__linux__)
|
||||
system(fmt::format(R"(xdg-open "http://127.0.0.1:{}/ui")",
|
||||
config_->get_api_port())
|
||||
.c_str());
|
||||
#else // error
|
||||
build fails here
|
||||
#endif
|
||||
|
||||
std::uint16_t port{};
|
||||
if (not utils::get_next_available_port(config_->get_api_port(), port)) {
|
||||
fmt::println("failed to detect if port is available|{}",
|
||||
config_->get_api_port());
|
||||
return;
|
||||
}
|
||||
|
||||
if (port != config_->get_api_port()) {
|
||||
fmt::println("failed to listen on port|{}|next available|{}",
|
||||
config_->get_api_port(), port);
|
||||
return;
|
||||
}
|
||||
|
||||
event_system::instance().start();
|
||||
|
||||
nonce_thread_ =
|
||||
|
@@ -72,7 +72,8 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
namespace repertory::ui {
|
||||
mgmt_app_config::mgmt_app_config() {
|
||||
mgmt_app_config::mgmt_app_config(bool hidden, bool launch_only)
|
||||
: hidden_(hidden), launch_only_(launch_only) {
|
||||
REPERTORY_USES_FUNCTION_NAME();
|
||||
|
||||
auto config_file =
|
||||
@@ -174,6 +175,12 @@ void mgmt_app_config::set_api_user(std::string_view api_user) {
|
||||
save();
|
||||
}
|
||||
|
||||
void mgmt_app_config::set_hidden(bool hidden) { hidden_ = hidden; }
|
||||
|
||||
void mgmt_app_config::set_launch_only(bool launch_only) {
|
||||
launch_only_ = launch_only;
|
||||
}
|
||||
|
||||
void mgmt_app_config::set_mount_location(provider_type prov,
|
||||
std::string_view name,
|
||||
std::string_view location) {
|
||||
|
Reference in New Issue
Block a user