no message

This commit is contained in:
2023-10-14 00:43:39 +03:00
parent 7aeb531208
commit a2971e95da
7 changed files with 36 additions and 9 deletions

View File

@@ -25,6 +25,9 @@ public class Constants {
public final static String time_file = "total_time";
//-служебные разделы проекта.
public static final String data = "visualiser_data";
public static final String MailAddress = "sapfor.tracker@internet.ru";
// public static final String MailPassword = "3s4w9e5fs3c1a89AA"; основной пароль.
public static final String MailPassword = "knKn2PpfrC348ZxHtMnT"; //пароль для сапфора как внешнего приложения.
//--
//https://losst.ru/komandy-terminala-linux
public static String[] linux_system_commands = new String[]{

View File

@@ -34,9 +34,6 @@ public class Global {
//0 2 2,15 * * reboot &>/var/log/reboot.log
//https://unix.stackexchange.com/questions/117148/how-can-i-run-reboot-as-a-normal-user-without-needing-to-enter-a-password
public static final String ServerAddress = "alex-freenas.ddns.net";
public static final String MailAddress = "sapfor.tracker@internet.ru";
// public static final String MailPassword = "3s4w9e5fs3c1a89AA"; основной пароль.
public static final String MailPassword = "knKn2PpfrC348ZxHtMnT"; //пароль для сапфора как внешнего приложения.
public static final String dateNaN = "NaN";
//--------------------------------------------------
//текущая папка системы. в отличие от шарпа никогда не должна меняться.

View File

@@ -13,8 +13,23 @@ import java.awt.*;
public class TestingBar extends VisualiserMenuBar {
JButton autorefreshButton;
JSpinner sCheckTime;
JSpinner sKernels;
public TestingBar() {
addPasses(PassCode_2021.SynchronizeTestsTasks);
//--
add(new JLabel(" ядер ") {
{
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
}
});
add(sKernels = new JSpinner());
sKernels.setPreferredSize(new Dimension(60, 26));
sKernels.setMaximumSize(new Dimension(60, 26));
sKernels.setModel(new SpinnerNumberModel(TestingServer.kernels, 1, 16, 1));
UI.MakeSpinnerRapid(sKernels, e -> {
TestingServer.kernels = (int) sKernels.getValue();
});
//--
add(autorefreshButton = new MenuBarButton() {
{
setText("проверка раз в");
@@ -30,6 +45,7 @@ public class TestingBar extends VisualiserMenuBar {
setIcon(Utils.getIcon(TestingServer.checkTasks ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
//--
add(sCheckTime = new JSpinner());
sCheckTime.setPreferredSize(new Dimension(60, 26));
sCheckTime.setMaximumSize(new Dimension(60, 26));
@@ -38,7 +54,7 @@ public class TestingBar extends VisualiserMenuBar {
TestingServer.checkIntervalSecond = (int) sCheckTime.getValue();
if (TestingServer.checkTasks) TestingServer.ResetTimer();
});
add(new JLabel(" сек") {
add(new JLabel(" сек ") {
{
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
}

View File

@@ -1,4 +1,5 @@
package Repository;
import Common.Constants;
import Common.Database.DBObject;
import Common.Database.Database;
import Common.Database.rDBObject;
@@ -98,8 +99,11 @@ public abstract class RepositoryServer<D extends Database> {
Utils.unpackFile(message_in.files.get(aName), f);
innerFiles.put(aName, f);
}
Vector<String> targets_ = new Vector<>();
targets_.add(Constants.MailAddress); //себе.
targets_.addAll(message_in.targets);
//------------------------------
for (String target : message_in.targets) {
for (String target : targets_) {
System.out.println("target=" + target);
if (needsEmail(target)) {
System.out.println("needs email");
@@ -109,12 +113,12 @@ public abstract class RepositoryServer<D extends Database> {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(
Global.MailAddress,
Global.MailPassword);
Constants.MailAddress,
Constants.MailPassword);
}
});
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(Global.MailAddress));
message.setFrom(new InternetAddress(Constants.MailAddress));
message.setRecipients(Message.RecipientType.CC, InternetAddress.parse(target));
message.setSubject(message_in.subject);
Multipart multipart = new MimeMultipart();

View File

@@ -1,4 +1,5 @@
package Repository.Server;
import Common.Constants;
import Common.Database.DBObject;
import Common.Global;
import Common.Utils.Utils;
@@ -37,6 +38,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
public int getPort() {
return 7995;
}
/*
@Override
public boolean needsEmail(String email) {
if (db.subscribers.containsKey(email)) {
@@ -44,6 +46,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
}
return false;
}
*/
@Override
public void DeleteAction(DBObject object) throws Exception {
if (object instanceof BugReport) {
@@ -409,7 +412,7 @@ public class ComponentsServer extends RepositoryServer<BugReportsDatabase> {
//bonus backup
if (rightNow.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
Vector<String> targets = new Vector<>();
targets.add(Global.MailAddress);
targets.add(Constants.MailAddress);
targets.addAll(Arrays.asList(Global.admins_mails));
EmailMessage message = new EmailMessage(
"db backup",

View File

@@ -17,6 +17,7 @@ public class SapforTasksPackage extends nDBObject {
public long StartDate = 0; //дата начала выполнения
public long ChangeDate = 0;//дата окончания выполнения
//-
public int kernels=1; //количество потоков.д
@Description("DEFAULT 'Queued'")
public TasksPackageState state = TasksPackageState.Queued;
// допустимые состояния

View File

@@ -236,7 +236,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
else
TimerOff();
}
//----
public static int checkIntervalSecond = 10;
public static int kernels = 4;
//----
public static Timer checkTimer = null;
public static void TimerOn() {
checkTasks = true;