This commit is contained in:
Tour
2025-12-08 08:14:42 +01:00
parent 3cc0d40fa3
commit 35851c124c
3 changed files with 54 additions and 6 deletions

1
.env Normal file
View File

@@ -0,0 +1 @@
GMAIL_APP_PASSWORD=agrepolhlnvhipkv

33
scripts/BFG.ps1 Normal file
View File

@@ -0,0 +1,33 @@
# BFG.ps1 (run from C:\vibe\auctiora\scripts)
$ErrorActionPreference = "Stop"
# 1) Download BFG jar once, next to this script
$bfgJar = Join-Path $PSScriptRoot "bfg.jar"
if (-not (Test-Path $bfgJar)) {
Invoke-WebRequest `
"https://repo1.maven.org/maven2/com/madgag/bfg/1.14.0/bfg-1.14.0.jar" `
-OutFile $bfgJar
}
# 2) Clone bare mirror next to project root: C:\vibe\auctiora\auctiora.git
$rootDir = Join-Path $PSScriptRoot ".."
$mirrorPath = Join-Path $rootDir "auctiora.git"
if (Test-Path $mirrorPath) {
Remove-Item $mirrorPath -Recurse -Force
}
git clone --mirror "https://git.appmodel.nl/Tour/auctiora.git" $mirrorPath
# 3) Run BFG in mirror
Push-Location $mirrorPath
java -jar $bfgJar --strip-blobs-bigger-than 50M .
git reflog expire --expire=now --all
git gc --prune=now --aggressive
# 4) Force-push cleaned history
git push --force
Pop-Location

View File

@@ -52,32 +52,46 @@ public record NotificationService(Config cfg) {
var props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.starttls.required", "true");
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.port", "587");
props.put("mail.smtp.ssl.trust", "smtp.gmail.com");
props.put("mail.smtp.ssl.protocols", "TLSv1.2");
// Connection timeouts (10 seconds each)
props.put("mail.smtp.connectiontimeout", "10000");
props.put("mail.smtp.timeout", "10000");
props.put("mail.smtp.writetimeout", "10000");
var session = Session.getInstance(props, new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(cfg.smtpUsername(), cfg.smtpPassword());
}
});
// Enable debug mode for troubleshooting (can be disabled in production)
// session.setDebug(true);
var m = new MimeMessage(session);
m.setFrom(new InternetAddress(cfg.smtpUsername()));
m.setRecipients(Message.RecipientType.TO, InternetAddress.parse(cfg.toEmail()));
m.setSubject("[Troostwijk] " + title);
m.setText(msg);
m.setSentDate(new Date());
if (prio > 0) {
m.setHeader("X-Priority", "1");
m.setHeader("Importance", "High");
}
Transport.send(m);
log.info("Email notification: {}", title);
log.info("Email notification sent: {}", title);
} catch (javax.mail.AuthenticationFailedException e) {
log.warn("Email authentication failed - check Gmail App Password: {}", e.getMessage());
} catch (javax.mail.MessagingException e) {
log.warn("Email connection failed (network/firewall issue?): {}", e.getMessage());
} catch (Exception e) {
log.warn("Email failed: {}", e.getMessage());
}