automated terminal push

This commit is contained in:
Software Shinobi
2025-03-10 09:39:38 -04:00
parent 22c4507400
commit eaabff1d30
28 changed files with 230 additions and 774 deletions

View File

@@ -1,11 +0,0 @@
volumes/
.git
.pristine
.trash
.recycle
.backup

15
.legacy/.gitignore vendored
View File

@@ -1,15 +0,0 @@
# ---> Linux
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*

View File

@@ -1,17 +0,0 @@
FROM maven:3.8.7-openjdk-18-slim AS mavenBuild
WORKDIR /
COPY . .
RUN mvn install -DskipTests
FROM eclipse-temurin:18-jre-alpine
COPY --from=mavenBuild /target/yankee-gnome-twitch-api-1.0.jar /yankee-gnome-twitch-api.jar
COPY --from=mavenBuild /src/main/resources/application.properties /application.properties
COPY --from=mavenBuild /src/main/resources/eighteen.stub.html /eighteen.stub.html
CMD ["java", "-jar", "/yankee-gnome-twitch-api.jar"]

View File

@@ -1,3 +0,0 @@
# yankee-gnome-twitch-api
yankee-gnome-twitch-api!!!!

View File

@@ -1,32 +0,0 @@
#!/bin/bash
##
set -e
set -x
##
reset
clear
##
echo
echo "STARTED / yankee / twitchtracker / channel rankings"
echo
##
docker compose down --remove-orphans
#git pull
docker compose up --build -d
echo
echo "RUNNING / yankee / twitchtracker / channel rankings"
echo

View File

@@ -1,91 +0,0 @@
services:
yankee-gnome-twitch-api:
container_name: yankee-gnome-twitch-api
image: valorantdigital/yankee-gnome-twitch-api
build:
context: .
dockerfile: Dockerfile
restart: unless-stopped
ports:
- 8888:8888
environment:
DB_HOST: yankee-database-server
DB_PORT: 3306
DB_NAME: yankee
DB_USER: yankee
DB_PASS: yankee
VIRTUAL_PORT: 8888
VIRTUAL_HOST: apis.yankee.embanet.online
LETSENCRYPT_HOST: apis.yankee.embanet.online
##########################################
##
## veneno / relational data
##
##########################################
veneno-database:
container_name: veneno-database
image: mariadb:latest
restart: unless-stopped
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: aggiepride
MYSQL_DATABASE: yankee_gnome_twitch
MYSQL_USER: yankee_gnome_twitch
MYSQL_PASSWORD: yankee_gnome_twitch
volumes:
- /yankee/volumes/database:/var/lib/mysql
veneno-phpmyadmin:
container_name: veneno-phpmyadmin
image: beeyev/phpmyadmin-lightweight
depends_on:
- veneno-database
links:
- veneno-database
environment:
PMA_HOST: veneno-database
VIRTUAL_HOST: database.yankee.embanet.online
LETSENCRYPT_HOST: database.yankee.embanet.online

View File

@@ -1,14 +0,0 @@
# API
http://localhost:8888/twitch/channel/truncate
## load the top 1000
go get 50x rankings, 20 times. truncates before all operations.
localhost:8888/twitchtracker.com/channel/load/
##
http://localhost:8888/twitchtracker.com/channel/load/2
load page two of the rankings

View File

@@ -1,65 +0,0 @@
# TwitchTrackerStubController API Documentation
This document outlines the functionalities provided by the `TwitchTrackerStubController` class.
**Note:** This API provides stubbed data, meaning it simulates real data from `twitchtracker.com` but doesn't interact with the actual website.
**Base URL:** `http://localhost:8888/twitchtracker.com/channel/stub`
**CORS:** Enabled
### Endpoints
#### 1. GET /rankings
* **Description:** This endpoint retrieves a single page (50 channels) of stubbed Twitch channel rankings data.
* **Response:** String containing HTML data representing the rankings table.
**Example Usage:**
```
GET http://localhost:8888/twitchtracker.com/channel/stub/rankings
```
#### 2. GET /load/
* **Description:** This endpoint fetches and returns a list of 1000 stubbed Twitch channels with their rankings.
* **Response:** List of `TwitchChannel` objects containing channel information.
**Example Usage:**
```
GET http://localhost:8888/twitchtracker.com/channel/stub/load/
```
**Implementation Details:**
* This endpoint calculates the number of pages required to retrieve 1000 channels based on the `channelsPerTwitchTrackerPage` constant (default 50).
* It then iterates through each page number and calls the `loadSingleTwitchTrackerPageByNumber` endpoint to retrieve the data.
* Finally, it combines all retrieved channels into a single list and returns it.
#### 3. GET /load/{pageNumber}
* **Description:** This endpoint retrieves a single page (50 channels) of stubbed Twitch channel rankings data based on the provided page number.
* **Path Variable:** `pageNumber` (integer) - Specifies the desired page number.
* **Response:** List of `TwitchChannel` objects containing channel information for the requested page.
**Example Usage:**
```
GET http://localhost:8888/twitchtracker.com/channel/stub/load/2
```
**Implementation Details:**
* This endpoint fetches a single page of stubbed HTML data representing the rankings table.
* It then parses the HTML and converts it into a list of `TwitchChannel` objects using the `twitchTrackerService.convert_html_list_twitch_channels` method.
* Finally, it saves each retrieved channel to the database using the `twitchChannelService.save` method. (This behavior might be specific to your application's use case.)
**Additional Notes:**
* The `sleepRandomly` method introduces a random delay between page fetches to simulate realistic network behavior.
* This documentation assumes familiarity with Spring annotations like `@GetMapping`, `@PathVariable`, and `@Autowired`.

View File

@@ -1,40 +0,0 @@
1. log in to linux server
2. clone repository
```
https://code.softwareshinobi.digital/yankee/twitchtracker-channel-rankings.git
``
3. go into directory
4.
docker compose.bash
it is assumed you already have docker installerd.
so then run
```
sudo bash provision.bash
```
## load the fake data to spec first
http://aventador.embanet.softwareshinobi.digital:48888/twitchtracker.com/channel/stub/load/
## populate the sql query to load the view
## database loging
phpmyadmin, lets you manage shit inside the db.
url :
user:
pass:

View File

@@ -1,17 +0,0 @@
# Welcome to MkDocs
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
## Commands
* `mkdocs new [dir-name]` - Create a new project.
* `mkdocs serve` - Start the live-reloading docs server.
* `mkdocs build` - Build the documentation site.
* `mkdocs -h` - Print help message and exit.
## Project layout
mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.

View File

@@ -1,9 +0,0 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,25 +0,0 @@
# the view for custom reporting
## Create the View
```
## Drop the view
DROP VIEW IF EXISTS report_twitchdata_top_1500_channels;
CREATE VIEW report_twitchdata_top_1500_channels AS
SELECT
`tag` "username",`url`,`logo` "logo_url", `all_time_peak_viewers`, `avg_viewers` "average_viewers", `followers_gained`, `hours_streamed`, `hours_watched`, `rank`, `total_followers`,
CASE
WHEN total_views = -1 THEN 'null'
ELSE total_views
END AS total_views
from twitch_channel;
-- Select data from the view
SELECT * FROM report_twitchdata_top_1500_channels;
```

View File

@@ -1,98 +0,0 @@
package com.example.filedownload.model;
import jakarta.persistence.*;
import java.time.LocalDateTime;
@Entity
@Table(name = "file_downloads")
public class FileDownload {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
private String url;
@Column(nullable = false)
private String hostIp;
@Column(nullable = false)
private LocalDateTime dateTime;
// Constructors, getters and setters
}
package com.example.filedownload.service;
import com.example.filedownload.model.FileDownload;
import com.example.filedownload.repository.FileDownloadRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Service
public class FileDownloadService {
@Autowired
private FileDownloadRepository fileDownloadRepository;
public FileDownload save(String url, String hostIp) {
FileDownload fileDownload = new FileDownload();
fileDownload.setUrl(url);
fileDownload.setHostIp(hostIp);
fileDownload.setDateTime(LocalDateTime.now());
return fileDownloadRepository.save(fileDownload);
}
}
package com.example.filedownload.service;
import com.example.filedownload.model.FileDownload;
import com.example.filedownload.repository.FileDownloadRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
@Service
public class FileDownloadService {
@Autowired
private FileDownloadRepository fileDownloadRepository;
public FileDownload save(String url, String hostIp) {
FileDownload fileDownload = new FileDownload();
fileDownload.setUrl(url);
fileDownload.setHostIp(hostIp);
fileDownload.setDateTime(LocalDateTime.now());
return fileDownloadRepository.save(fileDownload);
}
}
package com.example.filedownload.controller;
import com.example.filedownload.model.FileDownload;
import com.example.filedownload.service.FileDownloadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class FileDownloadController {
@Autowired
private FileDownloadService fileDownloadService;
@GetMapping("/doesexist/{url}")
public boolean doesExist(@PathVariable String url) {
String fullUrl = "google.com/" + url; // Assuming "google.com" is the base URL
return fileDownloadService.existsByUrl(fullUrl);
}
}

View File

@@ -1,55 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-DDB_HOST=aventador.embanet.online -DDB_PORT=3306 -DDB_NAME=aventador -DDB_USER=aventador -DDB_PASS=aventador</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>edu.gsyoung.twitch.TwitchDataAcquisition</exec.mainClass>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-DDB_HOST=aventador.embanet.online -DDB_PORT=3306 -DDB_NAME=aventador -DDB_USER=aventador -DDB_PASS=aventador -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>edu.gsyoung.twitch.TwitchDataAcquisition</exec.mainClass>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-DDB_HOST=aventador.embanet.online -DDB_PORT=3306 -DDB_NAME=aventador -DDB_USER=aventador -DDB_PASS=aventador</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.mainClass>edu.gsyoung.twitch.TwitchDataAcquisition</exec.mainClass>
<exec.executable>java</exec.executable>
<exec.appArgs></exec.appArgs>
</properties>
</action>
</actions>

View File

@@ -1,99 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.0</version>
<relativePath/>
</parent>
<groupId>edu.gsyoung</groupId>
<artifactId>yankee-twitch-data-api</artifactId>
<name>yankee-twitch-data-api</name>
<description>yankee-twitch-data-api</description>
<version>1.0</version>
<properties>
<java.version>17</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.13.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -1,16 +0,0 @@
# twitch saas!
## sit rep
[DONE] the monthly stats data is loading but the repositories are all broken.
[NOW] now we need to enrich the html so that the js and the css load and properly render the page and render the table data
## later
fix all the repos
create the click page for the phase one activities
add a menu to the click page

View File

@@ -1,49 +0,0 @@
reset
clear
set -e
#set -x
##
echo
echo "##"
echo "##"
echo "##"
echo
##
curl -X GET http://localhost:8888/channel/monthly/games/failure/
sleep 4
echo
echo "##"
echo "##"
echo "##"
echo
curl -X GET \
http://localhost:8888/channel/monthly/games/failure/exists \
-H 'Content-Type: application/json' \
-d '{
"url": "https://links.embanet.com/talisman.txt"
}'
sleep 4
echo
echo "##"
echo "##"
echo "##"
echo
curl -X GET \
http://localhost:8888/channel/monthly/games/failure/exists \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.garudanet.com/talisman.txt"
}'

View File

@@ -1,24 +0,0 @@
#!/bin/bash
##
reset
clear
##
set -e
set -x
##
echo "##"
echo "## creating new [failure] record in the database"
echo "##"
curl -X POST \
http://localhost:8888/channel/monthly/games/failure/add \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.garudanet.com/talisman.txt","hostIP":"falcon"}'

View File

@@ -1,19 +0,0 @@
echo "##"
echo "##"
echo "##"
curl -X GET https://osiris.yankee.valorantdigital.com/channel/monthly/games/success/
curl -X GET \
https://osiris.yankee.valorantdigital.com/channel/monthly/games/success/exists \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.embanet.com/talisman.txt"
}'
curl -X GET \
https://osiris.yankee.valorantdigital.com/channel/monthly/games/success/exists \
-H 'Content-Type: application/json' \
-d '{
"url": "https://www.embanet.com/talisman.md"
}'

View File

@@ -1,24 +0,0 @@
#!/bin/bash
##
reset
clear
##
set -e
set -x
##
echo "##"
echo "## creating new [success] record in the database"
echo "##"
curl -X POST \
https://osiris.yankee.valorantdigital.com/channel/monthly/games/success/add \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.embanet.com/talisman.txt","hostIP":"asdf"}'

0
Jenkinsfile vendored Executable file → Normal file
View File

View File

@@ -16,7 +16,7 @@ services:
ports:
- 8888:8888
- 18888:8888
environment:
@@ -58,15 +58,16 @@ services:
MYSQL_ROOT_PASSWORD: aggiepride
MYSQL_DATABASE: yankee_gnome_twitch
MYSQL_DATABASE: veneno
MYSQL_USER: yankee_gnome_twitch
MYSQL_USER: veneno
MYSQL_PASSWORD: yankee_gnome_twitch
MYSQL_PASSWORD: veneno
volumes:
- /yankee/volumes/database:/var/lib/mysql
## volumes:
##
## - /tmp/yankee/volumes/database:/var/lib/mysql
##
veneno-phpmyadmin:
@@ -82,6 +83,10 @@ services:
- veneno-database
ports:
- "3380:80"
environment:
PMA_HOST: veneno-database

View File

@@ -10,7 +10,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-DDB_HOST=aventador.embanet.online -DDB_PORT=3306 -DDB_NAME=aventador -DDB_USER=aventador -DDB_PASS=aventador</exec.vmArgs>
<exec.vmArgs>-DDB_HOST=localhost -DDB_PORT=3306 -DDB_NAME=veneno -DDB_USER=veneno -DDB_PASS=veneno</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>edu.gsyoung.twitch.TwitchDataAcquisition</exec.mainClass>
@@ -27,7 +27,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-DDB_HOST=aventador.embanet.online -DDB_PORT=3306 -DDB_NAME=aventador -DDB_USER=aventador -DDB_PASS=aventador -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.vmArgs>-DDB_HOST=localhost -DDB_PORT=3306 -DDB_NAME=veneno -DDB_USER=veneno -DDB_PASS=veneno -agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>edu.gsyoung.twitch.TwitchDataAcquisition</exec.mainClass>
@@ -45,7 +45,7 @@
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-DDB_HOST=aventador.embanet.online -DDB_PORT=3306 -DDB_NAME=aventador -DDB_USER=aventador -DDB_PASS=aventador</exec.vmArgs>
<exec.vmArgs>-DDB_HOST=localhost -DDB_PORT=3306 -DDB_NAME=veneno -DDB_USER=veneno -DDB_PASS=veneno</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.mainClass>edu.gsyoung.twitch.TwitchDataAcquisition</exec.mainClass>
<exec.executable>java</exec.executable>

View File

@@ -1,6 +1,7 @@
package edu.gsyoung.twitch.upstream.sullygnome.download.failure;
import jakarta.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "sully_download_failure")
@@ -10,12 +11,26 @@ public class SullyDownloadFailure {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
@Column(name = "download_url", nullable = false)
private String url;
@Column(nullable = false)
@Column(name = "reason", nullable = false)
private String reason;
@Column(name = "host_ip", nullable = false)
private String hostIP;
@Column(name = "host_name", nullable = false)
private String hostName;
@Column(name = "insert_date", nullable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Timestamp insertDate;
@Column(name = "update_date", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Timestamp updateDate;
public Long getId() {
return id;
@@ -52,23 +67,50 @@ public class SullyDownloadFailure {
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("SullyDownloadFailure{");
stringBuilder.append("id=").append(id);
stringBuilder.append(", url=").append(url);
stringBuilder.append(", hostIp=").append(hostIP);
stringBuilder.append('}');
return stringBuilder.toString();
public String getHostName() {
return hostName;
}
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
public Timestamp getInsertDate() {
return insertDate;
}
public void setInsertDate(Timestamp insertDate) {
this.insertDate = insertDate;
}
public Timestamp getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Timestamp updateDate) {
this.updateDate = updateDate;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("SullyDownloadFailure{");
sb.append("id=").append(id);
sb.append(", url=").append(url);
sb.append(", reason=").append(reason);
sb.append(", hostIP=").append(hostIP);
sb.append(", hostName=").append(hostName);
sb.append(", insertDate=").append(insertDate);
sb.append(", updateDate=").append(updateDate);
sb.append('}');
return sb.toString();
}
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
}

View File

@@ -1,6 +1,7 @@
package edu.gsyoung.twitch.upstream.sullygnome.download.success;
import jakarta.persistence.*;
import java.sql.Timestamp;
@Entity
@Table(name = "sully_download_success")
@@ -10,12 +11,23 @@ public class SullyDownloadSuccess {
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false)
@Column(name = "download_url", nullable = false)
private String url;
@Column(nullable = false)
@Column(name = "host_ip", nullable = false)
private String hostIP;
@Column(name = "host_name", nullable = false)
private String hostName;
@Column(name = "insert_date", nullable = false, updatable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Timestamp insertDate;
@Column(name = "update_date", nullable = false, columnDefinition = "TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP")
@Temporal(TemporalType.TIMESTAMP)
private Timestamp updateDate;
public Long getId() {
return id;
@@ -52,23 +64,42 @@ public class SullyDownloadSuccess {
}
public String getHostName() {
return hostName;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
public Timestamp getInsertDate() {
return insertDate;
}
public void setInsertDate(Timestamp insertDate) {
this.insertDate = insertDate;
}
public Timestamp getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Timestamp updateDate) {
this.updateDate = updateDate;
}
@Override
public String toString() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("SullyDownloadSuccess{");
stringBuilder.append("id=").append(id);
stringBuilder.append(", url=").append(url);
stringBuilder.append(", hostIp=").append(hostIP);
stringBuilder.append('}');
return stringBuilder.toString();
StringBuilder sb = new StringBuilder();
sb.append("SullyDownloadSuccess{");
sb.append("id=").append(id);
sb.append(", url=").append(url);
sb.append(", hostIP=").append(hostIP);
sb.append(", hostName=").append(hostName);
sb.append(", insertDate=").append(insertDate);
sb.append(", updateDate=").append(updateDate);
sb.append('}');
return sb.toString();
}
}

View File

@@ -0,0 +1,52 @@
import requests
import json
import socket
import netifaces # For getting external IP (install with: pip install netifaces)
def get_external_ip():
"""Gets the external IP address using a reliable service."""
try:
response = requests.get("https://api.ipify.org?format=json", timeout=5) # Use a reliable service
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
ip_data = response.json()
return ip_data["ip"]
except requests.exceptions.RequestException as e:
print(f"Error getting external IP: {e}")
return "0.0.0.0" # Or some other default value
def get_hostname():
"""Gets the local hostname."""
try:
return socket.gethostname()
except Exception as e:
print(f"Error getting hostname: {e}")
return "unknown_host"
def create_success_record(url):
"""Creates a new 'success' record in the database."""
external_ip = get_external_ip()
hostname = get_hostname()
data = {
"url": url,
"hostIP": external_ip,
"hostName": hostname
}
try:
response = requests.post(
"http://localhost:8888/channel/monthly/games/failure/add",
headers={'Content-Type': 'application/json'},
data=json.dumps(data) # Use json.dumps() to serialize the data
)
response.raise_for_status() # Check for HTTP errors
print("Successfully created record:", response.json()) # Print the response from the server
except requests.exceptions.RequestException as e:
print(f"Error creating record: {e}")
except json.JSONDecodeError as e:
print(f"Error decoding JSON response: {e}") # Handle potential JSON decode errors
if __name__ == "__main__":
url = "https://www.embanet.com/talisman.txt" # Replace with your actual URL
create_success_record(url)

View File

@@ -18,7 +18,4 @@ echo "##"
echo "## creating new [success] record in the database"
echo "##"
curl -X POST \
https://osiris.yankee.valorantdigital.com/channel/monthly/games/success/add \
-H 'Content-Type: application/json' \
-d '{"url": "https://www.embanet.com/talisman.txt","hostIP":"asdf"}'
curl -X POST http://localhost:8888/channel/monthly/games/success/add -H 'Content-Type: application/json' -d '{"url": "https://www.embanet.com/talisman.txt","hostIP":"asdf","hostName":"veneno"}'

View File

@@ -0,0 +1,52 @@
import requests
import json
import socket
import netifaces # For getting external IP (install with: pip install netifaces)
def get_external_ip():
"""Gets the external IP address using a reliable service."""
try:
response = requests.get("https://api.ipify.org?format=json", timeout=5) # Use a reliable service
response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
ip_data = response.json()
return ip_data["ip"]
except requests.exceptions.RequestException as e:
print(f"Error getting external IP: {e}")
return "0.0.0.0" # Or some other default value
def get_hostname():
"""Gets the local hostname."""
try:
return socket.gethostname()
except Exception as e:
print(f"Error getting hostname: {e}")
return "unknown_host"
def create_success_record(url):
"""Creates a new 'success' record in the database."""
external_ip = get_external_ip()
hostname = get_hostname()
data = {
"url": url,
"hostIP": external_ip,
"hostName": hostname
}
try:
response = requests.post(
"http://localhost:8888/channel/monthly/games/success/add",
headers={'Content-Type': 'application/json'},
data=json.dumps(data) # Use json.dumps() to serialize the data
)
response.raise_for_status() # Check for HTTP errors
print("Successfully created record:", response.json()) # Print the response from the server
except requests.exceptions.RequestException as e:
print(f"Error creating record: {e}")
except json.JSONDecodeError as e:
print(f"Error decoding JSON response: {e}") # Handle potential JSON decode errors
if __name__ == "__main__":
url = "https://www.embanet.com/talisman.txt" # Replace with your actual URL
create_success_record(url)