Skip to content

Commit

Permalink
Merge pull request #10 from MrDrache333/api-alpha
Browse files Browse the repository at this point in the history
API based implementation, Code cleanup, New configuration, More customization
  • Loading branch information
MrDrache333 authored Oct 8, 2022
2 parents 4c31337 + c124ab4 commit ddd5ce1
Show file tree
Hide file tree
Showing 94 changed files with 3,763 additions and 2,402 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.DS-Store
19 changes: 19 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions .idea/libraries/commons_codec_1_10.xml

This file was deleted.

28 changes: 0 additions & 28 deletions .idea/libraries/htmlunit_2_33.xml

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/libraries/json_20190722.xml

This file was deleted.

30 changes: 30 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM ibmjava:8
WORKDIR /
ADD out/artifacts/StudIP_Telegram_jar/StudIP-Telegram.jar StudIP-Telegram.jar
RUN mkdir -p /StudIP/Files/
CMD java -jar StudIP-Telegram.jar
ADD target/StudIP-Telegram-1.0-SNAPSHOT.jar StudIP-Telegram.jar
RUN mkdir -p /data
CMD java -jar StudIP-Telegram.jar
76 changes: 19 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,76 +7,38 @@ Proof of Concept Java StudIP Telegram Bot

*What will this Bot do?*

- It will simply login to your StudIP-Account using your Credentials (Stored localy and secure)
- It will simply login to your StudIP-Account using your Credentials (Stored locally)
- It will grab your Accountinformations, Courses and Informations about the Courses
- It will verify that there are Updates avaiable (News or Files)
- It will download new Files and create a Filesturcture analog to StudIP (Easy to Sync to NAS for example)
- It will automatically format and push these Informations to a Telegram Chat using your own Bot
- It will verify that there are Updates avaiable (News or Files)
- It will download new Files and create a Filesturcture analog to StudIP (Easy to Sync to NAS for example)
- It will automatically format and push these Informations to a Telegram Chat using your own Bot

### FAQ

### FAQ
Comming soon

*Our StudI-Api is not activated. Will it still work?*

Yes. This Bot works using a virtual Browser instance to comunicate with StudIP. So no API is needet :)

*Can i use Webhooks too?*

Yes you can.

## Installation (without Docker)
## Installation without Docker

1. Download this Bot
2. Verify that Java 8 JRE is installed on your machine
3. Create a Telegram Bot (Simply create a Chat with [@BotFather](https://t.me/BotFather))
4. Copy the API-Key
5. Start the Bot via Terminal with `java -jar StudIP-Telegram.jar INIT`
6. Fill out your Credentials
7. ...
8. Profit?
5. Rename config-smple.yml to config.yml in data folder
6. Edit config.yml and add your credentials
7. Start the Bot via Terminal with `java -jar StudIP-Telegram.jar`
8. ...
9. Profit?

## Installation (with Docker)
## Installation with Docker

1. Make sure you've installed Docker on your machine
2. Create a Telegram Bot (Simply create a Chat with [@BotFather](https://t.me/BotFather))
3. Copy the API-Key
4. Download and start the container once for configuration

`
docker run -i --name=StudIP-Telegram mrdrache333/studip-telegram
`

5. Start the Container again evey time you want to ceck for Updates

`
docker start StudIP-Telegram
`

## WebHooks

You can use WebHooks/ HTTP-POST Requests with this Bot too. Simply edit the `modulelist.stud` File and change the
following Attributes:

`
moduleId.sendType:
1 = Only Telegram, 2 = Only WebHook, 3 = Both
`
`moduleId.webhook: WebHook-URL`

Data would be send as UTF-8 encoded json Object.

`{"content":"Content as Text"
}`
4. Download this repo
5. Rename config-smple.yml to config.yml in data folder
6. Edit config.yml and add your credentials
7. Start this Bot using `docker-compose -d up`

## Compatibility tested

- University of Oldenburg: 15.04.2021


## Roadmap

- More settings, customisation
- Better commandline Interface
- Optimise Code a Lot
- Add a Ton of Documentation etc.

MORE WILL FOLLOW
- University of Oldenburg: 07.10.2022
69 changes: 63 additions & 6 deletions StudIP-Telegram.iml
Original file line number Diff line number Diff line change
@@ -1,14 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="Spring" name="Spring">
<configuration />
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.idea/libraries" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/lib" />
<excludeFolder url="file://$MODULE_DIR$/data/Files" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="htmlunit-2.33" level="project" />
<orderEntry type="library" name="commons-codec-1.10" level="project" />
<orderEntry type="library" name="json-20190722" level="project" />
<orderEntry type="module-library" scope="TEST">
<library name="JUnit5.8.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library" scope="TEST">
<library name="JUnit5.8.1">
<CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter/5.8.1/junit-jupiter-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-api/5.8.1/junit-jupiter-api-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/opentest4j/opentest4j/1.2.0/opentest4j-1.2.0.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-commons/1.8.1/junit-platform-commons-1.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/apiguardian/apiguardian-api/1.1.2/apiguardian-api-1.1.2.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-params/5.8.1/junit-jupiter-params-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/jupiter/junit-jupiter-engine/5.8.1/junit-jupiter-engine-5.8.1.jar!/" />
<root url="jar://$MAVEN_REPOSITORY$/org/junit/platform/junit-platform-engine/1.8.1/junit-platform-engine-1.8.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="Spring-5.2.3.RELEASE" level="project" />
<orderEntry type="library" name="Maven: org.json:json:20220320" level="project" />
<orderEntry type="library" name="Maven: org.jsoup:jsoup:1.15.3" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.15" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-web:5.3.23" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-beans:5.3.23" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-core:5.3.23" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-jcl:5.3.23" level="project" />
<orderEntry type="library" name="Maven: org.yaml:snakeyaml:1.33" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.jupiter:junit-jupiter-api:5.8.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.opentest4j:opentest4j:1.2.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.junit.platform:junit-platform-commons:1.8.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.apiguardian:apiguardian-api:1.1.2" level="project" />
</component>
</module>
11 changes: 11 additions & 0 deletions data/config-smple.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
api_endpoint: https://deineuni.de/api.php
api_password: "password"
api_username: "user"
blacklist: [
]
courseConfigs: { }
downloadFolder: "Files"
startTime: 0
telegramConfig:
chatId: 1234
token: 1234:1234
5 changes: 5 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
services:
studipBot:
image: mrdrache333/studip-telegram:api-alpha
volumes:
- ./data:/data
Binary file removed lib/commons-codec-1.10.jar
Binary file not shown.
Binary file removed lib/commons-io-2.6.jar
Binary file not shown.
Binary file removed lib/commons-lang3-3.8.jar
Binary file not shown.
Binary file removed lib/commons-logging-1.2.jar
Binary file not shown.
Binary file removed lib/commons-net-3.6.jar
Binary file not shown.
Binary file removed lib/commons-text-1.4.jar
Binary file not shown.
Binary file removed lib/htmlunit-2.33.jar
Binary file not shown.
Binary file removed lib/htmlunit-core-js-2.33.jar
Binary file not shown.
Binary file removed lib/htmlunit-cssparser-1.2.0.jar
Binary file not shown.
Binary file removed lib/httpclient-4.5.6.jar
Binary file not shown.
Binary file removed lib/httpcore-4.4.10.jar
Binary file not shown.
Binary file removed lib/httpmime-4.5.6.jar
Binary file not shown.
Binary file removed lib/jetty-client-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/jetty-http-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/jetty-io-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/jetty-util-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/jetty-xml-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/json-20190722.jar
Binary file not shown.
Binary file removed lib/jsoup-1.11.3.jar
Binary file not shown.
Binary file removed lib/neko-htmlunit-2.33.jar
Binary file not shown.
Binary file removed lib/serializer-2.7.2.jar
Binary file not shown.
Binary file removed lib/websocket-api-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/websocket-client-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/websocket-common-9.4.12.v20180830.jar
Binary file not shown.
Binary file removed lib/xalan-2.7.2.jar
Binary file not shown.
Binary file removed lib/xercesImpl-2.12.0.jar
Binary file not shown.
Binary file removed lib/xml-apis-1.4.01.jar
Binary file not shown.
Loading

0 comments on commit ddd5ce1

Please sign in to comment.