kopia lustrzana https://github.com/mate-dev/meshtastic-matrix-relay
Update mmrelay.iss
rodzic
7f7df24d68
commit
32672ca2b3
101
mmrelay.iss
101
mmrelay.iss
|
@ -4,7 +4,7 @@
|
||||||
//WizardSmallImageFile=smallwiz.bmp
|
//WizardSmallImageFile=smallwiz.bmp
|
||||||
|
|
||||||
AppName=Matrix <> Meshtastic Relay
|
AppName=Matrix <> Meshtastic Relay
|
||||||
AppVersion=1.0
|
AppVersion=0.3.3
|
||||||
DefaultDirName={userpf}\MM Relay
|
DefaultDirName={userpf}\MM Relay
|
||||||
DefaultGroupName=MM Relay
|
DefaultGroupName=MM Relay
|
||||||
UninstallFilesDir={app}
|
UninstallFilesDir={app}
|
||||||
|
@ -17,20 +17,32 @@ Source: "dist\mmrelay.exe"; DestDir: "{app}"; Flags: recursesubdirs createallsub
|
||||||
|
|
||||||
[Icons]
|
[Icons]
|
||||||
Name: "{group}\MM Relay"; Filename: "{app}\mmrelay.bat"
|
Name: "{group}\MM Relay"; Filename: "{app}\mmrelay.bat"
|
||||||
|
Name: "{group}\MM Relay Config"; Filename: "{app}\config.yaml"; IconFilename: "{sys}\notepad.exe"; WorkingDir: "{app}"; Parameters: "config.yaml";
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{app}\mmrelay.bat"; Description: "Launch MM Relay"; Flags: nowait postinstall
|
Filename: "{app}\mmrelay.bat"; Description: "Launch MM Relay"; Flags: nowait postinstall
|
||||||
|
|
||||||
[Code]
|
[Code]
|
||||||
var
|
var
|
||||||
|
TokenInfoLabel: TLabel;
|
||||||
|
TokenInfoLink: TNewStaticText;
|
||||||
MatrixPage : TInputQueryWizardPage;
|
MatrixPage : TInputQueryWizardPage;
|
||||||
OverwriteConfig: TInputOptionWizardPage;
|
OverwriteConfig: TInputOptionWizardPage;
|
||||||
MatrixMeshtasticPage : TInputQueryWizardPage;
|
MatrixMeshtasticPage : TInputQueryWizardPage;
|
||||||
MeshtasticConnectionPage: TInputOptionWizardPage;
|
|
||||||
MeshtasticPage : TInputQueryWizardPage;
|
MeshtasticPage : TInputQueryWizardPage;
|
||||||
OptionsPage : TInputOptionWizardPage;
|
OptionsPage : TInputOptionWizardPage;
|
||||||
Connection: string;
|
Connection: string;
|
||||||
|
|
||||||
|
procedure TokenInfoLinkClick(Sender: TObject);
|
||||||
|
var
|
||||||
|
ErrorCode: Integer;
|
||||||
|
begin
|
||||||
|
if not ShellExec('', 'open', TNewStaticText(Sender).Caption, '', SW_SHOWNORMAL, ewNoWait, ErrorCode) then
|
||||||
|
begin
|
||||||
|
// handle failure if necessary
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure InitializeWizard;
|
procedure InitializeWizard;
|
||||||
begin
|
begin
|
||||||
OverwriteConfig := CreateInputOptionPage(wpWelcome,
|
OverwriteConfig := CreateInputOptionPage(wpWelcome,
|
||||||
|
@ -39,10 +51,7 @@ begin
|
||||||
MatrixPage := CreateInputQueryPage(OverwriteConfig.ID,
|
MatrixPage := CreateInputQueryPage(OverwriteConfig.ID,
|
||||||
'Matrix Setup', 'Configure Matrix Settings',
|
'Matrix Setup', 'Configure Matrix Settings',
|
||||||
'Enter the settings for your Matrix server.');
|
'Enter the settings for your Matrix server.');
|
||||||
MeshtasticConnectionPage := CreateInputOptionPage(MatrixPage.ID,
|
MeshtasticPage := CreateInputQueryPage(MatrixPage.ID,
|
||||||
'Meshtastic Setup', 'Meshtastic Connection',
|
|
||||||
'Connect to Meshtastic Radio using Network or Serial connection.', False, True);
|
|
||||||
MeshtasticPage := CreateInputQueryPage(MeshtasticConnectionPage.ID,
|
|
||||||
'Meshtastic Setup', 'Configure Meshtastic Settings',
|
'Meshtastic Setup', 'Configure Meshtastic Settings',
|
||||||
'Enter the settings for connecting with your Meshtastic radio.');
|
'Enter the settings for connecting with your Meshtastic radio.');
|
||||||
MatrixMeshtasticPage := CreateInputQueryPage(MeshtasticPage.ID,
|
MatrixMeshtasticPage := CreateInputQueryPage(MeshtasticPage.ID,
|
||||||
|
@ -55,30 +64,50 @@ begin
|
||||||
OverwriteConfig.Add('Generate configuration (overwrite any current config files)');
|
OverwriteConfig.Add('Generate configuration (overwrite any current config files)');
|
||||||
OverwriteConfig.Values[0] := True;
|
OverwriteConfig.Values[0] := True;
|
||||||
|
|
||||||
MatrixPage.Add('Homeserver', False);
|
MatrixPage.Add('Homeserver: (example: https://matrix.org)', False);
|
||||||
MatrixPage.Add('Access token', False);
|
MatrixPage.Add('Bot User ID (example: @mybotuser:matrix.org)', False);
|
||||||
MatrixPage.Add('Bot User ID', False);
|
MatrixPage.Add('Access Token (example: syt_bWvzaGjvdD1_PwsXoZgGItImVxBIZbBK_1XZVW8)', False);
|
||||||
|
|
||||||
|
TokenInfoLabel := TLabel.Create(WizardForm);
|
||||||
|
TokenInfoLabel.Caption := 'For instructions on where to find your access token, visit:';
|
||||||
|
TokenInfoLabel.Parent := MatrixPage.Surface;
|
||||||
|
TokenInfoLabel.Left := 0;
|
||||||
|
TokenInfoLabel.Top := MatrixPage.Edits[2].Top + MatrixPage.Edits[2].Height + 8;
|
||||||
|
|
||||||
|
TokenInfoLink := TNewStaticText.Create(WizardForm);
|
||||||
|
TokenInfoLink.Caption := 'https://t2bot.io/docs/access_tokens/';
|
||||||
|
TokenInfoLink.Cursor := crHand;
|
||||||
|
TokenInfoLink.Font.Color := clBlue;
|
||||||
|
TokenInfoLink.Font.Style := [fsUnderline];
|
||||||
|
TokenInfoLink.OnClick := @TokenInfoLinkClick;
|
||||||
|
TokenInfoLink.Parent := MatrixPage.Surface;
|
||||||
|
TokenInfoLink.Left := TokenInfoLabel.Left;
|
||||||
|
TokenInfoLink.Top := TokenInfoLabel.Top + TokenInfoLabel.Height;
|
||||||
|
|
||||||
|
|
||||||
MatrixPage.Edits[0].Hint := 'https://example.matrix.org';
|
MatrixPage.Edits[0].Hint := 'https://example.matrix.org';
|
||||||
MatrixPage.Edits[1].Hint := 'reaalllllyloooooongsecretttttcodeeeeeeforrrrbot';
|
MatrixPage.Edits[1].Hint := '@botuser:example.matrix.org';
|
||||||
MatrixPage.Edits[2].Hint := '@botuser:example.matrix.org';
|
MatrixPage.Edits[2].Hint := 'reaalllllyloooooongsecretttttcodeeeeeeforrrrbot';
|
||||||
|
|
||||||
MeshtasticConnectionPage.Add('Serial');
|
MeshtasticPage.Add('Connection Type (network or serial)?', False);
|
||||||
MeshtasticConnectionPage.Add('Network');
|
MeshtasticPage.Add('Serial Port (if serial):', False);
|
||||||
|
MeshtasticPage.Add('Hostname/IP (If network):', False);
|
||||||
|
MeshtasticPage.Add('Meshnet Name:', False);
|
||||||
|
MeshtasticPage.Edits[0].Hint := 'serial or network';
|
||||||
|
MeshtasticPage.Edits[1].Hint := 'serial port (if serial)';
|
||||||
|
MeshtasticPage.Edits[2].Hint := 'hostname/IP (if network)';
|
||||||
|
MeshtasticPage.Edits[3].Hint := 'Name for radio Meshnet';
|
||||||
|
|
||||||
MeshtasticPage.Add('Network host/Serial port', False);
|
|
||||||
MeshtasticPage.Add('Meshnet Name', False);
|
|
||||||
MeshtasticPage.Edits[0].Hint := 'serial port or TCP host'
|
|
||||||
MeshtasticPage.Edits[1].Hint := 'Name for radio Meshnet'
|
|
||||||
|
|
||||||
MatrixMeshtasticPage.Add('Matrix Room ID', False);
|
MatrixMeshtasticPage.Add('Matrix Room ID/Alias (example: !someroomid:example.matrix.org)', False);
|
||||||
MatrixMeshtasticPage.Add('Meshtastic Channel', False);
|
MatrixMeshtasticPage.Add('Meshtastic Channel # (0 is Primary, 1-7 Secondary)', False);
|
||||||
MatrixMeshtasticPage.Edits[0].Hint := '!someroomid:example.matrix.org';
|
MatrixMeshtasticPage.Edits[0].Hint := '!someroomid:example.matrix.org';
|
||||||
MatrixMeshtasticPage.Edits[1].Hint := '0-10 (default 0)';
|
MatrixMeshtasticPage.Edits[1].Hint := '0-7 (default 0)';
|
||||||
|
|
||||||
OptionsPage.Add('Detailed logging');
|
OptionsPage.Add('Detailed logging');
|
||||||
OptionsPage.Add('Radio broadcasts enabled');
|
OptionsPage.Add('Radio broadcasts enabled');
|
||||||
OptionsPage.Values[0] := True
|
OptionsPage.Values[0] := True;
|
||||||
OptionsPage.Values[1] := False
|
OptionsPage.Values[1] := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function BoolToStr(Value : Boolean): String;
|
function BoolToStr(Value : Boolean): String;
|
||||||
|
@ -115,18 +144,11 @@ begin
|
||||||
RenameFile(sAppDir+'/config.yaml', sAppDir+'/config-old.yaml');
|
RenameFile(sAppDir+'/config.yaml', sAppDir+'/config-old.yaml');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if MeshtasticConnectionPage.Values[0] then
|
connection_type := MeshtasticPage.Values[0];
|
||||||
begin
|
serial_port := MeshtasticPage.Values[1];
|
||||||
connection_type := 'serial';
|
host := MeshtasticPage.Values[2];
|
||||||
serial_port := MeshtasticPage.Values[0]
|
|
||||||
end
|
|
||||||
else
|
|
||||||
begin
|
|
||||||
connection_type := 'network';
|
|
||||||
host := MeshtasticPage.Values[0]
|
|
||||||
end;
|
|
||||||
|
|
||||||
if OptionsPage.Values[1] then
|
if OptionsPage.Values[0] then
|
||||||
begin
|
begin
|
||||||
log_level := 'debug';
|
log_level := 'debug';
|
||||||
end
|
end
|
||||||
|
@ -137,8 +159,8 @@ begin
|
||||||
|
|
||||||
config := 'matrix:' + #13#10 +
|
config := 'matrix:' + #13#10 +
|
||||||
' homeserver: "' + MatrixPage.Values[0] + '"' + #13#10 +
|
' homeserver: "' + MatrixPage.Values[0] + '"' + #13#10 +
|
||||||
' access_token: "' + MatrixPage.Values[1] + '"' + #13#10 +
|
' bot_user_id: "' + MatrixPage.Values[1] + '"' + #13#10 +
|
||||||
' bot_user_id: "' + MatrixPage.Values[2] + '"' + #13#10 +
|
' access_token: "' + MatrixPage.Values[2] + '"' + #13#10 +
|
||||||
'matrix_rooms:' + #13#10 +
|
'matrix_rooms:' + #13#10 +
|
||||||
' - id: "' + MatrixMeshtasticPage.Values[0] + '"' + #13#10 +
|
' - id: "' + MatrixMeshtasticPage.Values[0] + '"' + #13#10 +
|
||||||
' meshtastic_channel: ' + MatrixMeshtasticPage.Values[1] + #13#10 +
|
' meshtastic_channel: ' + MatrixMeshtasticPage.Values[1] + #13#10 +
|
||||||
|
@ -146,7 +168,7 @@ begin
|
||||||
' connection_type: "' + connection_type + '"' + #13#10 +
|
' connection_type: "' + connection_type + '"' + #13#10 +
|
||||||
' serial_port: "' + serial_port + '"' + #13#10 +
|
' serial_port: "' + serial_port + '"' + #13#10 +
|
||||||
' host: "' + host + '"' + #13#10 +
|
' host: "' + host + '"' + #13#10 +
|
||||||
' meshnet_name: "' + MeshtasticPage.Values[1] + '"' + #13#10 +
|
' meshnet_name: "' + MeshtasticPage.Values[3] + '"' + #13#10 +
|
||||||
' broadcast_enabled: ' + BoolToStr(OptionsPage.Values[1]) + #13#10 +
|
' broadcast_enabled: ' + BoolToStr(OptionsPage.Values[1]) + #13#10 +
|
||||||
'logging:' + #13#10 +
|
'logging:' + #13#10 +
|
||||||
' level: "' + log_level + '"' + #13#10;
|
' level: "' + log_level + '"' + #13#10;
|
||||||
|
@ -156,12 +178,13 @@ begin
|
||||||
MsgBox('Could not create config file "config.yaml". Close any applications that may have it open and re-run setup', mbInformation, MB_OK);
|
MsgBox('Could not create config file "config.yaml". Close any applications that may have it open and re-run setup', mbInformation, MB_OK);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
batch_file := '"' + sAppDir+ '\mmrelay.exe" config.yaml ' + #13#10 +
|
batch_file := '"' + sAppDir+ '\mmrelay.exe" config.yaml ' + #13#10 +
|
||||||
'pause'
|
'pause';
|
||||||
|
|
||||||
if Not SaveStringToFile(sAppDir+'/mmrelay.bat', batch_file, false) then
|
if Not SaveStringToFile(sAppDir+'/mmrelay.bat', batch_file, false) then
|
||||||
begin
|
begin
|
||||||
MsgBox('Could not create batch file "relay.bat". Close any applications that may have it open and re-run setup', mbInformation, MB_OK);
|
MsgBox('Could not create batch file "relay.bat". Close any applications that may have it open and re-run setup', mbInformation, MB_OK);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
|
|
||||||
|
end;
|
Ładowanie…
Reference in New Issue