Compare commits
4
Commits
c008c22e09
...
v1.6.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f0766ccbe | ||
|
|
b9020cb46f | ||
|
|
10574ba0c5 | ||
|
|
ace2e486fc |
@@ -104,6 +104,10 @@ jobs:
|
||||
windows:
|
||||
needs: tests
|
||||
runs-on: windows-latest
|
||||
# Reprises par le job `publish` (tag de la release, statut pre-release).
|
||||
outputs:
|
||||
tag: ${{ steps.ver.outputs.tag }}
|
||||
isbeta: ${{ steps.ver.outputs.isbeta }}
|
||||
steps:
|
||||
# En declenchement manuel, on checkout le TAG correspondant a la version
|
||||
# saisie (sinon checkout prendrait la branche par defaut). En push de tag,
|
||||
@@ -167,17 +171,14 @@ jobs:
|
||||
shell: pwsh
|
||||
run: .\installers\desktop\build-windows.ps1 -Version ${{ steps.ver.outputs.version }}
|
||||
|
||||
# Release GitHub publique avec le .msi ; une beta est publiee en pre-release.
|
||||
# tag_name explicite : en declenchement manuel, github.ref est une branche,
|
||||
# donc on cible le tag derive (la release est attachee au bon tag).
|
||||
- name: Publish installer to GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
# Le .msi est passe au job `publish`, seul a creer la release.
|
||||
- name: Keep installer for the release
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
tag_name: ${{ steps.ver.outputs.tag }}
|
||||
files: core/target/dist-out/*.msi
|
||||
fail_on_unmatched_files: true
|
||||
generate_release_notes: true
|
||||
prerelease: ${{ steps.ver.outputs.isbeta == 'true' }}
|
||||
name: installer-windows
|
||||
path: core/target/dist-out/*.msi
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
# LINUX : AppImage (1 fichier, toutes distros) attache a la MEME release.
|
||||
# Tourne sur ubuntu-latest (jpackage ne cross-compile pas -> build natif Linux).
|
||||
@@ -230,13 +231,40 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
run: bash ./installers/desktop/build-linux.sh --version ${{ steps.ver.outputs.version }}
|
||||
|
||||
# Attache l'AppImage a la release (meme tag que le .msi -> les deux
|
||||
# installeurs sur la meme release). prerelease aussi ici : le job qui cree
|
||||
# la release en premier fixe son statut.
|
||||
- name: Publish AppImage to GitHub Release
|
||||
# L'AppImage est passee au job `publish`, seul a creer la release.
|
||||
- name: Keep AppImage for the release
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: installer-linux
|
||||
path: core/target/dist-out/DM_Loremind*.AppImage
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
|
||||
# PUBLICATION : un seul job cree la release et y attache les deux installeurs.
|
||||
# Quand windows et linux publiaient chacun de leur cote, ils tournaient en
|
||||
# parallele et creaient DEUX releases pour le meme tag (une publiee, une en
|
||||
# brouillon), l'un echouant sur « already_exists ». Rien n'est publie si l'un
|
||||
# des deux builds echoue : une release a toujours ses deux installeurs.
|
||||
# Relancer le workflow pour une version deja publiee met la release a jour et
|
||||
# remplace les fichiers de meme nom (pas besoin de la supprimer).
|
||||
publish:
|
||||
needs: [windows, linux]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get installers
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
pattern: installer-*
|
||||
path: dist
|
||||
merge-multiple: true
|
||||
|
||||
# tag_name explicite : en declenchement manuel, github.ref est une branche.
|
||||
# Une beta est publiee en pre-release (ignoree par /releases/latest).
|
||||
- name: Publish GitHub Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ steps.ver.outputs.tag }}
|
||||
files: core/target/dist-out/DM_Loremind*.AppImage
|
||||
tag_name: ${{ needs.windows.outputs.tag }}
|
||||
files: dist/*
|
||||
fail_on_unmatched_files: true
|
||||
prerelease: ${{ steps.ver.outputs.isbeta == 'true' }}
|
||||
generate_release_notes: true
|
||||
prerelease: ${{ needs.windows.outputs.isbeta == 'true' }}
|
||||
|
||||
@@ -69,6 +69,17 @@ DM Loremind est **et restera gratuit en auto-hébergement**. Le développement a
|
||||
- **Canal bêta** — les nouveautés en avant-première, gratuites pour tous : bascule depuis les Paramètres (Docker) ou pré-version GitHub (bureau)
|
||||
- **[Discord](https://discord.gg/cPpFzCjEzQ)** — annonces, support, retours utilisateurs
|
||||
|
||||
## Politique de signature du code (Code signing policy)
|
||||
|
||||
Signature de code gratuite fournie par [SignPath.io](https://about.signpath.io), certificat de [SignPath Foundation](https://signpath.org).
|
||||
|
||||
- **Signé** : les installeurs Windows (`.msi`) et le lanceur `DM Loremind.exe`, construits par GitHub Actions à partir de ce dépôt.
|
||||
- **Auteurs et relecteurs** : [IGMLcreation](https://github.com/IGMLcreation)
|
||||
- **Approbateurs** : [IGMLcreation](https://github.com/IGMLcreation) — chaque demande de signature est approuvée manuellement.
|
||||
- **Confidentialité** : DM Loremind ne transmet aucune information à d'autres systèmes en réseau, sauf à la demande explicite de la personne qui l'utilise, l'installe ou l'exploite, et sauf la vérification des mises à jour, qui peut être désactivée. Voir la [politique de confidentialité](https://loremind-docs.igmlcreation.fr/docs/confidentialite).
|
||||
|
||||
Politique complète : [Politique de signature du code](https://loremind-docs.igmlcreation.fr/docs/signature-du-code).
|
||||
|
||||
## Licence
|
||||
|
||||
DM Loremind est distribué sous licence **[GNU AGPL v3](LICENSE)**.
|
||||
|
||||
@@ -69,6 +69,17 @@ DM Loremind is **and will remain free when self-hosted**. Development moves fast
|
||||
- **Beta channel** — new features ahead of time, free for everyone: switch from Settings (Docker) or install a GitHub pre-release (desktop)
|
||||
- **[Discord](https://discord.gg/cPpFzCjEzQ)** — announcements, support, user feedback
|
||||
|
||||
## Code signing policy
|
||||
|
||||
Free code signing provided by [SignPath.io](https://about.signpath.io), certificate by [SignPath Foundation](https://signpath.org).
|
||||
|
||||
- **Signed**: the Windows installers (`.msi`) and the `DM Loremind.exe` launcher, built by GitHub Actions from this repository.
|
||||
- **Committers and reviewers**: [IGMLcreation](https://github.com/IGMLcreation)
|
||||
- **Approvers**: [IGMLcreation](https://github.com/IGMLcreation) — each signing request is approved manually.
|
||||
- **Privacy**: DM Loremind does not transfer any information to other networked systems unless specifically requested by the person using, installing or operating it, except for the update check, which can be turned off. See the [privacy policy](https://loremind-docs.igmlcreation.fr/en/docs/confidentialite).
|
||||
|
||||
Full policy: [Code signing policy](https://loremind-docs.igmlcreation.fr/en/docs/signature-du-code).
|
||||
|
||||
## License
|
||||
|
||||
DM Loremind is distributed under the **[GNU AGPL v3](LICENSE)** license.
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ from app.infrastructure.ollama_model_installer import ensure_ollama_embedding_mo
|
||||
app = FastAPI(
|
||||
title="LoreMind Brain",
|
||||
description="Backend IA pour la génération de contenu narratif.",
|
||||
version="1.6.2-beta",
|
||||
version="1.6.2",
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
<groupId>com.loremind</groupId>
|
||||
<artifactId>loremind-core</artifactId>
|
||||
<version>1.6.2-beta</version>
|
||||
<version>1.6.2</version>
|
||||
<name>LoreMind Core</name>
|
||||
<description>Backend Core - Architecture Hexagonale</description>
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ package com.loremind.infrastructure.desktop;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.nio.channels.FileLock;
|
||||
import java.nio.file.Files;
|
||||
@@ -102,14 +104,20 @@ public final class DesktopSingleInstance {
|
||||
openUrl("http://localhost:" + DesktopUserConfig.runningPort() + "/");
|
||||
}
|
||||
|
||||
/** Ouvre le navigateur par defaut sur une URL quelconque (sans dependance AWT). */
|
||||
/**
|
||||
* Ouvre le navigateur par defaut sur une URL quelconque : API standard de Java
|
||||
* (ShellExecute sous Windows), sinon commande du systeme. Plus de {@code rundll32
|
||||
* url.dll} : outil Windows tres detourne par les logiciels malveillants, que des
|
||||
* antivirus signalaient (Avast « IDP.Generic ») quand un programme peu connu le lance.
|
||||
*/
|
||||
public static void openUrl(String url) {
|
||||
if (browseWithJava(url)) return;
|
||||
try {
|
||||
String os = System.getProperty(OS_NAME_PROPERTY, "").toLowerCase();
|
||||
ProcessBuilder pb;
|
||||
if (os.contains("win")) {
|
||||
// rundll32 : ouverture d'URL fiable sans dependance graphique Java.
|
||||
pb = new ProcessBuilder("rundll32", "url.dll,FileProtocolHandler", url);
|
||||
// « start » de cmd ; le "" est le titre de fenetre attendu avant l'URL.
|
||||
pb = new ProcessBuilder("cmd", "/c", "start", "", url);
|
||||
} else if (os.contains("mac")) {
|
||||
pb = new ProcessBuilder("open", url);
|
||||
} else {
|
||||
@@ -122,6 +130,20 @@ public final class DesktopSingleInstance {
|
||||
}
|
||||
}
|
||||
|
||||
/** {@link Desktop#browse} si disponible (jamais en headless) ; false = repli sur une commande. */
|
||||
private static boolean browseWithJava(String url) {
|
||||
try {
|
||||
if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
|
||||
return false;
|
||||
}
|
||||
Desktop.getDesktop().browse(URI.create(url));
|
||||
return true;
|
||||
} catch (IOException | RuntimeException e) {
|
||||
log.debug("[Desktop] Ouverture via Desktop.browse impossible ({}), repli sur une commande.", e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/** Ouvre un dossier dans le gestionnaire de fichiers du systeme. */
|
||||
public static void openFolder(Path dir) {
|
||||
try {
|
||||
|
||||
+43
-21
@@ -26,9 +26,16 @@ import java.util.concurrent.TimeUnit;
|
||||
* qu'aux réseaux PRIVÉS ; un Wi-Fi classé « Public » reste à basculer par l'utilisateur
|
||||
* (réglage système, jamais modifié par l'application).
|
||||
* <p>
|
||||
* Les scripts sont passés en {@code -EncodedCommand} (UTF-16LE base64) : aucun problème de
|
||||
* guillemets ni d'accents. Le seul paramètre variable est le chemin de l'exécutable,
|
||||
* fourni par le système (pas par l'utilisateur), et échappé pour une chaîne PowerShell.
|
||||
* Les scripts sont passés EN CLAIR ({@code -Command}, une ligne) : un script encodé
|
||||
* ({@code -EncodedCommand}) accompagné de {@code -ExecutionPolicy Bypass} est la signature
|
||||
* typique des logiciels malveillants, et faisait réagir des antivirus (Avast « IDP.Generic »).
|
||||
* La politique d'exécution ne concerne que les fichiers .ps1 : inutile de la contourner.
|
||||
* La ligne de commande Windows est en UTF-16 : accents et noms de réseau passent tels quels.
|
||||
* Seule exception : le script relancé EN ADMINISTRATEUR (bouton « Autoriser »), encodé car
|
||||
* {@code Start-Process -ArgumentList} ne sait pas transmettre un script avec espaces et
|
||||
* guillemets ; il ne s'exécute que sur clic de l'utilisateur, derrière la confirmation UAC.
|
||||
* Le seul paramètre variable est le chemin de l'exécutable, fourni par le système (pas par
|
||||
* l'utilisateur), et échappé pour une chaîne PowerShell.
|
||||
* <p>
|
||||
* Choisie au démarrage par {@code HostNetworkAccessConfig} sous Windows.
|
||||
*/
|
||||
@@ -69,14 +76,8 @@ public class WindowsHostNetworkAccess implements HostNetworkAccess {
|
||||
public FirewallFixOutcome allowThroughFirewall() {
|
||||
String program = currentProgram();
|
||||
if (!isWindows() || program == null) return FirewallFixOutcome.UNSUPPORTED;
|
||||
String outer = "try {\n"
|
||||
+ " $p = Start-Process -FilePath 'powershell.exe' -Verb RunAs -WindowStyle Hidden -Wait -PassThru "
|
||||
+ "-ArgumentList @('-NoProfile','-NonInteractive','-ExecutionPolicy','Bypass','-EncodedCommand','"
|
||||
+ encode(allowScript(program)) + "')\n"
|
||||
+ " exit $p.ExitCode\n"
|
||||
+ "} catch { exit " + EXIT_CANCELLED + " }\n";
|
||||
try {
|
||||
int exit = runPowerShell(outer, ELEVATION_TIMEOUT_S).exitCode();
|
||||
int exit = runPowerShell(elevationScript(program), ELEVATION_TIMEOUT_S).exitCode();
|
||||
FirewallFixOutcome outcome = exit == 0 ? FirewallFixOutcome.APPLIED
|
||||
: exit == EXIT_CANCELLED ? FirewallFixOutcome.CANCELLED : FirewallFixOutcome.FAILED;
|
||||
log.info("Accès distant : autorisation pare-feu → {}", outcome);
|
||||
@@ -103,24 +104,37 @@ public class WindowsHostNetworkAccess implements HostNetworkAccess {
|
||||
|
||||
// --- Scripts --------------------------------------------------------------------------
|
||||
|
||||
/** Réseaux connectés + règles entrantes visant ce programme (chemins avec %VARIABLES% compris). */
|
||||
/**
|
||||
* Réseaux connectés + règles entrantes visant ce programme (chemins avec %VARIABLES% compris).
|
||||
* Une seule ligne d'instructions séparées par « ; » : elle est passée telle quelle à {@code -Command}.
|
||||
*/
|
||||
static String inspectScript(String program) {
|
||||
return "$ErrorActionPreference = 'SilentlyContinue'\n"
|
||||
return "$ErrorActionPreference = 'SilentlyContinue'; "
|
||||
// Sortie en UTF-8 : sinon la page de codes de la console abîme les noms de réseau accentués.
|
||||
+ "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8\n"
|
||||
+ "$p = '" + psQuote(program) + "'\n"
|
||||
+ "$nets =@(Get-NetConnectionProfile | ForEach-Object { [pscustomobject]@{ name = $_.Name; "
|
||||
+ "alias = $_.InterfaceAlias; category = $_.NetworkCategory.ToString() } })\n"
|
||||
+ "[Console]::OutputEncoding = [System.Text.Encoding]::UTF8; "
|
||||
+ "$p = '" + psQuote(program) + "'; "
|
||||
+ "$nets = @(Get-NetConnectionProfile | ForEach-Object { [pscustomobject]@{ name = $_.Name; "
|
||||
+ "alias = $_.InterfaceAlias; category = $_.NetworkCategory.ToString() } }); "
|
||||
+ "$rules = @(Get-NetFirewallApplicationFilter | Where-Object { $_.Program -and "
|
||||
+ "([Environment]::ExpandEnvironmentVariables($_.Program) -ieq $p) } | Get-NetFirewallRule | "
|
||||
+ "Where-Object { $_.Direction.ToString() -eq 'Inbound' } | ForEach-Object { [pscustomobject]@{ "
|
||||
+ "action = $_.Action.ToString(); profile = $_.Profile.ToString(); enabled = $_.Enabled.ToString() } })\n"
|
||||
+ "action = $_.Action.ToString(); profile = $_.Profile.ToString(); enabled = $_.Enabled.ToString() } }); "
|
||||
// Pare-feu TIERS déclarés au Centre de sécurité (le pare-feu Windows n'y figure pas) :
|
||||
// ils filtrent en plus de Windows, avec des règles qu'on ne peut pas lire.
|
||||
+ "$fw = @(Get-CimInstance -Namespace root/SecurityCenter2 -ClassName FirewallProduct | "
|
||||
+ "ForEach-Object { $_.displayName } | Where-Object { $_ -and $_ -notmatch 'Windows' })\n"
|
||||
+ "ForEach-Object { $_.displayName } | Where-Object { $_ -and $_ -notmatch 'Windows' }); "
|
||||
+ "[pscustomobject]@{ networks = $nets; rules = $rules; thirdPartyFirewalls = $fw } | "
|
||||
+ "ConvertTo-Json -Depth 4 -Compress\n";
|
||||
+ "ConvertTo-Json -Depth 4 -Compress";
|
||||
}
|
||||
|
||||
/**
|
||||
* Relance PowerShell EN ADMINISTRATEUR (confirmation UAC) avec {@link #allowScript}, et
|
||||
* renvoie son code de sortie ; refus de l'UAC → {@value #EXIT_CANCELLED}. Une seule ligne.
|
||||
*/
|
||||
static String elevationScript(String program) {
|
||||
return "try { $p = Start-Process -FilePath 'powershell.exe' -Verb RunAs -WindowStyle Hidden -Wait -PassThru "
|
||||
+ "-ArgumentList @('-NoProfile','-NonInteractive','-EncodedCommand','"
|
||||
+ encode(allowScript(program)) + "'); exit $p.ExitCode } catch { exit " + EXIT_CANCELLED + " }";
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,9 +197,9 @@ public class WindowsHostNetworkAccess implements HostNetworkAccess {
|
||||
|
||||
private record Result(int exitCode, String output) {}
|
||||
|
||||
/** {@code script} : une ligne, sans guillemet double (chaînes PowerShell entre apostrophes). */
|
||||
private static Result runPowerShell(String script, long timeoutSeconds) throws IOException, InterruptedException {
|
||||
Process process = new ProcessBuilder("powershell.exe", "-NoProfile", "-NonInteractive",
|
||||
"-ExecutionPolicy", "Bypass", "-EncodedCommand", encode(script))
|
||||
Process process = new ProcessBuilder(command(script))
|
||||
.redirectError(ProcessBuilder.Redirect.DISCARD)
|
||||
.start();
|
||||
process.getOutputStream().close();
|
||||
@@ -204,6 +218,14 @@ public class WindowsHostNetworkAccess implements HostNetworkAccess {
|
||||
return new Result(process.exitValue(), output.join());
|
||||
}
|
||||
|
||||
/** Ligne de commande PowerShell : script en clair, ni encodage ni contournement de politique. */
|
||||
static List<String> command(String script) {
|
||||
if (script.indexOf('"') >= 0 || script.indexOf('\n') >= 0) {
|
||||
throw new IllegalArgumentException("Script PowerShell : une ligne, sans guillemet double");
|
||||
}
|
||||
return List.of("powershell.exe", "-NoProfile", "-NonInteractive", "-Command", script);
|
||||
}
|
||||
|
||||
private static boolean isWindows() {
|
||||
return System.getProperty("os.name", "").toLowerCase(Locale.ROOT).startsWith("windows");
|
||||
}
|
||||
|
||||
+32
@@ -8,6 +8,7 @@ import org.junit.jupiter.api.condition.OS;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@@ -70,6 +71,37 @@ class WindowsHostNetworkAccessTest {
|
||||
assertTrue(WindowsHostNetworkAccess.inspectScript(path).contains("SecurityCenter2"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void command_passesTheScriptInClear_withoutAntivirusRedFlags() {
|
||||
String script = WindowsHostNetworkAccess.inspectScript("C:\\Users\\Jérôme\\DM Loremind.exe");
|
||||
List<String> cmd = WindowsHostNetworkAccess.command(script);
|
||||
|
||||
assertEquals(List.of("powershell.exe", "-NoProfile", "-NonInteractive", "-Command", script), cmd);
|
||||
assertFalse(String.join(" ", cmd).contains("EncodedCommand"), "script lisible, pas encodé");
|
||||
assertFalse(String.join(" ", cmd).contains("Bypass"), "la politique d'exécution ne concerne que les .ps1");
|
||||
assertTrue(script.contains("'C:\\Users\\Jérôme\\DM Loremind.exe'"), "accents gardés tels quels (ligne de commande UTF-16)");
|
||||
}
|
||||
|
||||
@Test
|
||||
void command_refusesMultilineOrDoubleQuotedScripts() {
|
||||
assertThrows(IllegalArgumentException.class, () -> WindowsHostNetworkAccess.command("a\nb"));
|
||||
assertThrows(IllegalArgumentException.class, () -> WindowsHostNetworkAccess.command("Write-Host \"x\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
void elevation_runsTheAllowScriptAsAdmin_inOneLine() {
|
||||
String path = "C:\\Users\\l'MJ\\DM Loremind.exe";
|
||||
String elevation = WindowsHostNetworkAccess.elevationScript(path);
|
||||
|
||||
WindowsHostNetworkAccess.command(elevation); // une ligne, sans guillemet double
|
||||
assertTrue(elevation.contains("-Verb RunAs"));
|
||||
assertFalse(elevation.contains("Bypass"));
|
||||
assertTrue(elevation.contains("catch { exit 1223 }"), "refus de l'UAC = annulation");
|
||||
String encoded = elevation.replaceAll(".*'-EncodedCommand','([^']+)'.*", "$1");
|
||||
assertEquals(WindowsHostNetworkAccess.allowScript(path),
|
||||
new String(Base64.getDecoder().decode(encoded), StandardCharsets.UTF_16LE));
|
||||
}
|
||||
|
||||
@Test
|
||||
void encode_isUtf16LeBase64_asExpectedByEncodedCommand() {
|
||||
String encoded = WindowsHostNetworkAccess.encode("é");
|
||||
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "loremind-web",
|
||||
"version": "1.6.2-beta",
|
||||
"version": "1.6.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "loremind-web",
|
||||
"version": "1.6.2-beta",
|
||||
"version": "1.6.2",
|
||||
"dependencies": {
|
||||
"@angular/animations": "^21.2.17",
|
||||
"@angular/cdk": "^21.2.14",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "loremind-web",
|
||||
"version": "1.6.2-beta",
|
||||
"version": "1.6.2",
|
||||
"description": "LoreMind Frontend - Angular",
|
||||
"scripts": {
|
||||
"ng": "ng",
|
||||
|
||||
Reference in New Issue
Block a user