Compare commits
1 Commits
main
...
inactivity
| Author | SHA1 | Date | |
|---|---|---|---|
| 35c705222b |
44
.drone.yml
44
.drone.yml
@@ -1,32 +1,27 @@
|
|||||||
kind: pipeline
|
kind: pipeline
|
||||||
name: verify
|
name: default
|
||||||
platform:
|
platform:
|
||||||
os: linux
|
os: linux
|
||||||
arch: arm64
|
arch: arm64
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- push
|
|
||||||
- pull_request
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
# test if it compiles correctly
|
# test if it compiles correctly
|
||||||
- name: build
|
- name: build
|
||||||
image: maven:3-eclipse-temurin-21
|
image: maven:3-eclipse-temurin-17
|
||||||
commands:
|
commands:
|
||||||
- mvn verify --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
- mvn verify --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V
|
||||||
|
|
||||||
# run unit tests
|
# run unit tests
|
||||||
- name: test
|
- name: test
|
||||||
image: maven:3-eclipse-temurin-21
|
image: maven:3-eclipse-temurin-17
|
||||||
commands:
|
commands:
|
||||||
- mvn test --no-transfer-progress -B -V
|
- mvn test --no-transfer-progress -B -V
|
||||||
|
|
||||||
# run code analysis
|
# run code analysis
|
||||||
- name: code-analysis
|
- name: code-analysis
|
||||||
image: maven:3-eclipse-temurin-21
|
image: maven:3-eclipse-temurin-17
|
||||||
commands:
|
commands:
|
||||||
- mvn sonar:sonar --no-transfer-progress -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.token=$SONAR_LOGIN_KEY -B -V
|
- mvn sonar:sonar --no-transfer-progress -Dsonar.projectKey=$SONAR_PROJECT_KEY -Dsonar.host.url=$SONAR_INSTANCE_URL -Dsonar.login=$SONAR_LOGIN_KEY -B -V
|
||||||
environment:
|
environment:
|
||||||
SONAR_PROJECT_KEY:
|
SONAR_PROJECT_KEY:
|
||||||
from_secret: sonar_project_key
|
from_secret: sonar_project_key
|
||||||
@@ -34,32 +29,3 @@ steps:
|
|||||||
from_secret: sonar_instance_url
|
from_secret: sonar_instance_url
|
||||||
SONAR_LOGIN_KEY:
|
SONAR_LOGIN_KEY:
|
||||||
from_secret: sonar_login_key
|
from_secret: sonar_login_key
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
kind: pipeline
|
|
||||||
name: deploy
|
|
||||||
type: docker
|
|
||||||
platform:
|
|
||||||
os: linux
|
|
||||||
arch: arm64
|
|
||||||
|
|
||||||
trigger:
|
|
||||||
event:
|
|
||||||
- promote
|
|
||||||
target:
|
|
||||||
- production
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# skip all previous steps because they were already ran in the "build" phase; we don't need to re-analyze the code.
|
|
||||||
|
|
||||||
# upload to maven repository
|
|
||||||
- name: maven-deploy
|
|
||||||
image: maven:3-eclipse-temurin-21
|
|
||||||
commands:
|
|
||||||
- mvn deploy --no-transfer-progress -DskipTests=true -Dmaven.javadoc.skip=true -B -V -gs settings.xml -Dmaven.repo.username=$MAVEN_REPO_USERNAME -Dmaven.repo.password=$MAVEN_REPO_PASSWORD
|
|
||||||
environment:
|
|
||||||
MAVEN_REPO_USERNAME:
|
|
||||||
from_secret: maven_repo_username
|
|
||||||
MAVEN_REPO_PASSWORD:
|
|
||||||
from_secret: maven_repo_password
|
|
||||||
|
|||||||
30
pom.xml
30
pom.xml
@@ -9,8 +9,8 @@
|
|||||||
<version>0.0.5-SNAPSHOT</version>
|
<version>0.0.5-SNAPSHOT</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>21</maven.compiler.source>
|
<maven.compiler.source>17</maven.compiler.source>
|
||||||
<maven.compiler.target>21</maven.compiler.target>
|
<maven.compiler.target>17</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-api</artifactId>
|
<artifactId>log4j-api</artifactId>
|
||||||
<version>2.24.3</version>
|
<version>2.23.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-core</artifactId>
|
<artifactId>log4j-core</artifactId>
|
||||||
<version>2.24.3</version>
|
<version>2.23.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -34,26 +34,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>nexus-releases</id>
|
|
||||||
<name>Nexus Releases Repository</name>
|
|
||||||
<url>https://nexus.beatrice.wtf/repository/maven-releases/</url>
|
|
||||||
</repository>
|
|
||||||
<snapshotRepository>
|
|
||||||
<id>nexus-snapshots</id>
|
|
||||||
<name>Nexus Snapshots Repository</name>
|
|
||||||
<url>https://nexus.beatrice.wtf/repository/maven-snapshots/</url>
|
|
||||||
</snapshotRepository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.sonarsource.scanner.maven</groupId>
|
|
||||||
<artifactId>sonar-maven-plugin</artifactId>
|
|
||||||
<version>5.0.0.4389</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
@@ -86,8 +68,8 @@
|
|||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>sonatype-nexus-releases</id>
|
<id>sonatype-nexus-snapshots</id>
|
||||||
<url>https://oss.sonatype.org/content/repositories/releases</url>
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
## supported systems
|
## supported systems
|
||||||
| system | support |
|
| system | support |
|
||||||
|-----------|------------|
|
|-----------|------------|
|
||||||
| macOS | ✅ complete |
|
| macOS | ✅ **full** |
|
||||||
| GNU/Linux | ⏳ planned |
|
| Windows | 🟠 limited |
|
||||||
| Windows | ⏳ planned |
|
| GNU/Linux | 🟠 limited |
|
||||||
|
|
||||||
## building
|
## building
|
||||||
**required tools**
|
**required tools**
|
||||||
- java 21 sdk
|
- java 17 sdk
|
||||||
- git
|
- git
|
||||||
- maven
|
- maven
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"$schema": "https://docs.renovatebot.com/renovate-schema.json"
|
|
||||||
}
|
|
||||||
20
settings.xml
20
settings.xml
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
|
|
||||||
|
|
||||||
<servers>
|
|
||||||
<server>
|
|
||||||
<id>nexus-snapshots</id>
|
|
||||||
<username>${maven.repo.username}</username>
|
|
||||||
<password>${maven.repo.password}</password>
|
|
||||||
</server>
|
|
||||||
<server>
|
|
||||||
<id>nexus-releases</id>
|
|
||||||
<username>${maven.repo.username}</username>
|
|
||||||
<password>${maven.repo.password}</password>
|
|
||||||
</server>
|
|
||||||
</servers>
|
|
||||||
|
|
||||||
</settings>
|
|
||||||
|
|
||||||
@@ -4,9 +4,12 @@ import com.github.kwhat.jnativehook.GlobalScreen;
|
|||||||
import com.github.kwhat.jnativehook.NativeHookException;
|
import com.github.kwhat.jnativehook.NativeHookException;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import wtf.beatrice.autosqueal.listener.CursorMoveListener;
|
||||||
import wtf.beatrice.autosqueal.listener.KeyPressListener;
|
import wtf.beatrice.autosqueal.listener.KeyPressListener;
|
||||||
import wtf.beatrice.autosqueal.ui.MainWindow;
|
import wtf.beatrice.autosqueal.ui.MainWindow;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(Main.class);
|
private static final Logger LOGGER = LogManager.getLogger(Main.class);
|
||||||
@@ -17,6 +20,10 @@ public class Main {
|
|||||||
|
|
||||||
registerJNativeHook();
|
registerJNativeHook();
|
||||||
mainWindow.init();
|
mainWindow.init();
|
||||||
|
|
||||||
|
Timer timerRunner = new Timer();
|
||||||
|
CursorMoveListener cursorMoveListener = new CursorMoveListener();
|
||||||
|
timerRunner.schedule(cursorMoveListener, 0L, 1000L);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void registerJNativeHook() {
|
private static void registerJNativeHook() {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class CursorMover extends TimerTask
|
|||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(CursorMover.class);
|
private static final Logger LOGGER = LogManager.getLogger(CursorMover.class);
|
||||||
private final Random random;
|
private final Random random;
|
||||||
|
private SingleStepMovementTask singleStepMovementTask;
|
||||||
|
|
||||||
private static final int LOOPS_BEFORE_CLICK = 5;
|
private static final int LOOPS_BEFORE_CLICK = 5;
|
||||||
|
|
||||||
@@ -22,6 +23,7 @@ public class CursorMover extends TimerTask
|
|||||||
|
|
||||||
public CursorMover() {
|
public CursorMover() {
|
||||||
random = new SecureRandom();
|
random = new SecureRandom();
|
||||||
|
singleStepMovementTask = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -35,8 +37,6 @@ public class CursorMover extends TimerTask
|
|||||||
int destX;
|
int destX;
|
||||||
int destY;
|
int destY;
|
||||||
|
|
||||||
SingleStepMovementTask singleStepMovementTask;
|
|
||||||
|
|
||||||
if (iteration == LOOPS_BEFORE_CLICK) {
|
if (iteration == LOOPS_BEFORE_CLICK) {
|
||||||
destX = RunnerUtil.SCREEN_WIDTH - 5;
|
destX = RunnerUtil.SCREEN_WIDTH - 5;
|
||||||
destY = 5;
|
destY = 5;
|
||||||
@@ -67,6 +67,11 @@ public class CursorMover extends TimerTask
|
|||||||
|
|
||||||
Timer timer = new Timer();
|
Timer timer = new Timer();
|
||||||
timer.schedule(singleStepMovementTask, 0L, 2L);
|
timer.schedule(singleStepMovementTask, 0L, 2L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRunning() {
|
||||||
|
if (singleStepMovementTask == null) return false;
|
||||||
|
|
||||||
|
return singleStepMovementTask.isRunning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ public class SingleStepMovementTask extends TimerTask {
|
|||||||
|
|
||||||
float stepX = 1;
|
float stepX = 1;
|
||||||
float stepY = 1;
|
float stepY = 1;
|
||||||
boolean isRunning = true;
|
private boolean isRunning = true;
|
||||||
boolean click;
|
boolean click;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ package wtf.beatrice.autosqueal.listener;
|
|||||||
|
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import wtf.beatrice.autosqueal.Main;
|
||||||
|
import wtf.beatrice.autosqueal.util.RunnerUtil;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
@@ -25,6 +27,8 @@ public class CursorMoveListener extends TimerTask {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if(RunnerUtil.isSquealing()) return;
|
||||||
|
|
||||||
int newX = MouseInfo.getPointerInfo().getLocation().x;
|
int newX = MouseInfo.getPointerInfo().getLocation().x;
|
||||||
int newY = MouseInfo.getPointerInfo().getLocation().y;
|
int newY = MouseInfo.getPointerInfo().getLocation().y;
|
||||||
|
|
||||||
@@ -33,14 +37,15 @@ public class CursorMoveListener extends TimerTask {
|
|||||||
loops = 0;
|
loops = 0;
|
||||||
LOGGER.info("User is no longer away!");
|
LOGGER.info("User is no longer away!");
|
||||||
} else {
|
} else {
|
||||||
if (loops < 30) {
|
if (loops < 10) {
|
||||||
loops++;
|
loops++;
|
||||||
} else {
|
} else {
|
||||||
LOGGER.info("User is away!");
|
LOGGER.info("User is away!");
|
||||||
|
Main.getMainWindow().toggleRunning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isUserAway = loops >= 30;
|
isUserAway = loops >= 10;
|
||||||
|
|
||||||
oldX = newX;
|
oldX = newX;
|
||||||
oldY = newY;
|
oldY = newY;
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ public class KeyPressListener implements NativeKeyListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nativeKeyPressed(NativeKeyEvent e) {
|
public void nativeKeyPressed(NativeKeyEvent e) {
|
||||||
String key = NativeKeyEvent.getKeyText(e.getKeyCode());
|
LOGGER.info("Key Pressed: {}", NativeKeyEvent.getKeyText(e.getKeyCode()));
|
||||||
LOGGER.info("Key Pressed: {}", key);
|
|
||||||
|
|
||||||
if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
|
if (e.getKeyCode() == NativeKeyEvent.VC_ESCAPE) {
|
||||||
try {
|
try {
|
||||||
@@ -36,8 +35,7 @@ public class KeyPressListener implements NativeKeyListener
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void nativeKeyReleased(NativeKeyEvent e) {
|
public void nativeKeyReleased(NativeKeyEvent e) {
|
||||||
String key = NativeKeyEvent.getKeyText(e.getKeyCode());
|
LOGGER.info("Key Released: {}", NativeKeyEvent.getKeyText(e.getKeyCode()));
|
||||||
LOGGER.info("Key Released: {}", key);
|
|
||||||
|
|
||||||
pressedKeysIds.remove((Integer) e.getKeyCode());
|
pressedKeysIds.remove((Integer) e.getKeyCode());
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ public class MainWindow
|
|||||||
timestampLabel.setBounds(new Rectangle(bordersPx, bordersPx + rescaleHeight + bordersPx, 100, 30));
|
timestampLabel.setBounds(new Rectangle(bordersPx, bordersPx + rescaleHeight + bordersPx, 100, 30));
|
||||||
frame.add(timestampLabel);
|
frame.add(timestampLabel);
|
||||||
|
|
||||||
|
|
||||||
frame.setLayout(null);
|
frame.setLayout(null);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
@@ -106,8 +105,6 @@ public class MainWindow
|
|||||||
|
|
||||||
if (cursorMover == null) {
|
if (cursorMover == null) {
|
||||||
timerRunner = new Timer();
|
timerRunner = new Timer();
|
||||||
CursorMoveListener cursorMoveListener = new CursorMoveListener();
|
|
||||||
timerRunner.schedule(cursorMoveListener, 0L, 1000L);
|
|
||||||
|
|
||||||
cursorMover = new CursorMover();
|
cursorMover = new CursorMover();
|
||||||
timerRunner.schedule(cursorMover, 1000L, RunnerUtil.SECONDS_BETWEEN_MOVES * 1000L);
|
timerRunner.schedule(cursorMover, 1000L, RunnerUtil.SECONDS_BETWEEN_MOVES * 1000L);
|
||||||
@@ -134,4 +131,12 @@ public class MainWindow
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
|
public boolean isRunning() {
|
||||||
|
if (cursorMover == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return cursorMover.isRunning();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package wtf.beatrice.autosqueal.util;
|
package wtf.beatrice.autosqueal.util;
|
||||||
|
|
||||||
|
import wtf.beatrice.autosqueal.Main;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class RunnerUtil {
|
public class RunnerUtil {
|
||||||
@@ -13,4 +15,8 @@ public class RunnerUtil {
|
|||||||
public static final int SCREEN_HEIGHT = Toolkit.getDefaultToolkit().getScreenSize().height;
|
public static final int SCREEN_HEIGHT = Toolkit.getDefaultToolkit().getScreenSize().height;
|
||||||
public static final int SCREEN_WIDTH = Toolkit.getDefaultToolkit().getScreenSize().width;
|
public static final int SCREEN_WIDTH = Toolkit.getDefaultToolkit().getScreenSize().width;
|
||||||
|
|
||||||
|
public static boolean isSquealing() {
|
||||||
|
return Main.getMainWindow().isRunning();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
<Console name="ConsoleAppender" target="SYSTEM_OUT">
|
<Console name="ConsoleAppender" target="SYSTEM_OUT">
|
||||||
<PatternLayout pattern="[%d{HH:mm:ss.SSS}] [%t] %-4level | %logger{36} - %msg%n" />
|
<PatternLayout pattern="[%d{HH:mm:ss.SSS}] [%t] %-4level | %logger{36} - %msg%n" />
|
||||||
</Console>
|
</Console>
|
||||||
|
<File name="FileAppender" fileName="application-${date:yyyyMMdd}.log" immediateFlush="false" append="true">
|
||||||
|
<PatternLayout pattern="[%d{yyy-MM-dd HH:mm:ss.SSS}] [%t] %-4level | %logger{36} - %msg%n"/>
|
||||||
|
</File>
|
||||||
</Appenders>
|
</Appenders>
|
||||||
<Loggers>
|
<Loggers>
|
||||||
<Root level="debug">
|
<Root level="debug">
|
||||||
|
|||||||
Reference in New Issue
Block a user