/rest-api

Spring Boot RESTful API for NightWolf download manager/scheduler

Primary LanguageJava

banner

NightWolf Download Manager RESTful API

Dependencies

  1. MySQL
  2. Maven (optional)

Configuration

  1. Clone the repository

  2. Create a mysql database for the project (ex : resttest)

  3. Open "dbScript.sql" and edit the default_paths in the following insert queries as the downloads will be mapped to these paths :

    Note : Provide absolute paths in your system for the default download paths

        INSERT INTO download_type (file_type, default_path) VALUES (
          "documents",
          "C:\\Users\\abc\\Desktop\\Downloads\\Documents"
        ),
        (
          "images",
          "C:\\Users\\abc\\Desktop\\Downloads\\Pictures"
        ),
        (
          "audios",
          "C:\\Users\\abc\\Desktop\\Downloads\\Audios"
        ),
        (
          "videos",
          "C:\\Users\\abc\\Desktop\\Downloads\\Videos"
        ),
        (
          "programs",
          "C:\\Users\\abc\\Desktop\\Downloads\\Programs"
        ),
        (
          "other",
          "C:\\Users\\abc\\Desktop\\Downloads\\Other"
        );
  4. Import database using "dbScript.sql"

  5. Navigate to src/main/resources/application.properties and edit the following configurations

    1. server.port (default is 8080)
    2. spring.datasource.url (as per the database)
    3. spring.datasource.username (mysql username)
    4. spring.datasource.password (mysql password)
    5. spring.mail.username (email account)
    6. spring.mail.password (email account password)
  6. Navigate to src/main/java/io/github/nightwolf/restapi/security/SecurityConstants.java and edit the following constants :

    1. SECRET (The secret key to encrypt JWT token)
    2. EXPIRATION_TIME (Token expiration time - default 10 days)
    3. FILE_DOWNLOAD_PATH (downloads will be saved in this path - give an absolute path)

Note : These configurations will be changed as the development goes on, thus not final

Executing the project

  • Execute using maven wrapper :
  1. Navigate to the source directory
  2. Open terminal/cmd and run the project using: ./mvnw spring-boot:run
  • Or build it from source using maven and execute the package jar file

Default user credentials :

| Email                 | Password  | Role  |
|:----------------------|:----------|:------|
| admin@nightwolf.com   | admin     | Admin |
| user@nightwolf.com    | user      | user  |

Note : passwords are hashed using bcrypt encoding

TODO :

  1. Implement repository search per client request alt alt
  2. Implement copy files from repository alt alt
  3. Implement stop downloading alt alt
  4. Implement automatically start/stop downloading in the given time frame alt alt
  5. Save added downloads in temp_download alt alt
  6. Fix setting download paths in a different property file alt alt
  7. Implement notifying after each download finishes alt alt
  8. Move the data to download table from temp_download after download finished alt alt
  9. Add repository check/clean scheduling alt alt
  10. Implement downloading to the proper directory based on the file type alt alt
  11. Test against incoming new download requests to the queue (while downloads has started) alt alt
  12. Test resuming paused downloads alt alt