*Unofficial* IServ Go library and CLI

  • By alexcoder04
  • Last update: Feb 21, 2023
  • Comments: 7

iserv2go

License Go Version Lines Release Stars Contributors

An unofficial Go library and CLI for IServ.

Disclaimer 1: I am not affiliated with the IServ GmbH in any way.

Disclaimer 2: This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

Disclaimer 3: Use it at YOUR OWN RISK!

Use as CLI

iserv2go [options] command [arguments...]

List of options

Option Description
-enable-email enables the email functionality
-enable-files enables the files functionality
-enable-web enables other functions (notifications, exercises, etc)
-info shows program info
-interactive starts interactive console where you can type commands instead of passing them as arguments
-save-sessions saves login cookies on the hard drive for subsequent logins

List of commands

Command Arguments Description
email.list_mailboxes none get a list of mailboxes
email.read_mailbox mailbox path get last 50 messages from mailbox
email.send_mail recipient address, subject, body send email
files.cat filename print contents of file
files.download iserv path, local path download file from IServ
files.ls directory list of files in directory
files.upload local path, iserv path upload file to IServ
web.get_badges none get badges (for modules on the nav bar left)
web.get_current_exercises none list of current exercises
web.get_notifications none get unread notifications
web.get_past_exercises none list of past exercises
web.get_upcoming_events none list of upcoming events

Use as Library

Install

# in your project directory
go get github.com/alexcoder04/iserv2go/iserv

Example usage

package main

import (
    "fmt"

    "github.com/alexcoder04/iserv2go/iserv"
    "github.com/alexcoder04/iserv2go/iserv/types"
)

func main(){
    // create new client instance
    client := iserv.Client{}

    // login your client
    err := client.Login(&types.ClientConfig{
        IServHost: os.Getenv("ISERV_HOST"),
        Username:  os.Getenv("ISERV_USERNAME"),
        Password:  os.Getenv("ISERV_PASSWORD"),

        EnableModules: map[string]bool{
            "email": true,
            "files": false,
            "web":   false,
        },
        SaveSessions: true,
    })
    if err != nil {
        fmt.Println("failed to login")
        return
    }

    // don't forget to logout
    defer client.Logout()

    // get 10 last mails in INBOX
    messages, err := client.Email.ReadMailbox("INBOX", 10)
    if err != nil {
        return
    }
    // print them
    for _, m := range messages {
        fmt.Printf(" = '%s' from %s\n", m.Envelope.Subject, m.Envelope.Sender[0].Address())
    }
}

Project Structure

The iserv folder contains the Go Library, the subfolders email, files, web are modules, which can be (de-)activated separately. They contain each user.go files, which include all the functions meant to be used by end-user.

Contributing

Contributions are always welcome, there are a lot of things that wait to be implemented, see the issues. I am also looking for co-maintainers and someone to test the project extensively :)

Credits

Contributors

Libraries

Download

iserv2go.zip

Comments(7)

  • 1

    Bump golang.org/x/net from 0.6.0 to 0.7.0

    Bumps golang.org/x/net from 0.6.0 to 0.7.0.

    Commits
    • 8e2b117 http2/hpack: avoid quadratic complexity in hpack decoding
    • 547e7ed http2: avoid referencing ResponseWrite.Write parameter after returning
    • 39940ad html: parse comments per HTML spec
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) You can disable automated security fix PRs for this repo from the Security Alerts page.
  • 2

    Bump github.com/PuerkitoBio/goquery from 1.8.0 to 1.8.1

    Bumps github.com/PuerkitoBio/goquery from 1.8.0 to 1.8.1.

    Release notes

    Sourced from github.com/PuerkitoBio/goquery's releases.

    v1.8.1

    Update go.mod, CI.

    Commits
    • 39fb6d4 Prepare for patch release
    • 33955be Merge pull request #439 from PuerkitoBio/dependabot/go_modules/golang.org/x/n...
    • 015f32a Bump golang.org/x/net from 0.2.0 to 0.7.0
    • 3b7929a Merge pull request #434 from PuerkitoBio/update-go
    • 53d8b4d Update Go versions used in CI
    • b103c0e Merge remote-tracking branch 'refs/remotes/origin/master'
    • 36e9563 Update goquery dependencies
    • 156fa4f Merge pull request #416 from davemolk/readme-add-goGetJS
    • c76525c add goGetJS to readme
    • 3920ccc Merge pull request #415 from jakopako/add-goskyr-to-related-projects
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 3

    Bump golang.org/x/net from 0.5.0 to 0.6.0

    Bumps golang.org/x/net from 0.5.0 to 0.6.0.

    Commits
    • 87ce33e go.mod: update golang.org/x dependencies
    • 415cb6d all: fix some comments
    • 7e3c19c all: correct typos in comments
    • 296f09a http2: case insensitive handling for 100-continue
    • f8411da nettest: fix tests on dragonfly and js/wasm
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 4

    Bump github.com/joho/godotenv from 1.4.0 to 1.5.1

    Bumps github.com/joho/godotenv from 1.4.0 to 1.5.1.

    Release notes

    Sourced from github.com/joho/godotenv's releases.

    Fix parser regressions from multiline support

    Version 1.5 came with a whole new parser, and with a new parser comes new bugs.

    Things that were broken in 1.5 that are now fixed:

    • unquoted variables with interior whitespace no longer split on the first space (and then break the following line if you have one)
    • inline comments now work again for both quoted and unquoted variables
    • export statement filtering was made more robust and matched earlier versions behaviour
    • FOO.BAR key names are permitted again (i have no idea why you'd do it, but it's explicitly supported in ruby dotenv files)

    There's one breaking change: earlier versions of this library would allow unterminated quoted variables in some instances and return a value (ie FOO="bar would set env of FOO: '"bar'), this now returns an error.

    What's Changed

    Full Changelog: https://github.com/joho/godotenv/compare/v1.5.0...v1.5.1

    v1.5.0 - multiline variables

    The big news this release is that godotenv finally, after much procrastination in review, supports multiline variables (fixes #64). Big shoutout to @​x1unix for the bulk of the work on the original PR and also to @​coolaj86 and @​austinsasko for some very helpful review and tweaks.

    Also added a -o overload flag (thanks @​2tef)

    What's Changed

    New Contributors

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 5

    Bump golang.org/x/net from 0.4.0 to 0.5.0

    Bumps golang.org/x/net from 0.4.0 to 0.5.0.

    Commits
    • 8e0e7d8 go.mod: update golang.org/x dependencies
    • 7805fdc http2: rewrite inbound flow control tracking
    • 2aa8215 nettest: use RoutedInterface for probing network stack capability
    • ad92d3d websocket: don't recommend Gorilla
    • e1ec361 http2: fix race in TestCanonicalHeaderCacheGrowth
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 6

    Bump golang.org/x/net from 0.2.0 to 0.4.0

    Bumps golang.org/x/net from 0.2.0 to 0.4.0.

    Commits
    • 1e63c2f http2: limit canonical header cache by bytes, not entries
    • 3247b5b go.mod: update golang.org/x dependencies
    • ecf7fda http2: deflake TestTransportMaxFrameReadSize
    • 0833b63 publicsuffix: embed table data
    • ecf091a publicsuffix: update table to latest list from publicsuffix.org
    • 2f8c3d1 http2: add Transport.MaxReadFrameSize configuration setting
    • 0e478a2 http2: add SETTINGS_HEADER_TABLE_SIZE support
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • 7

    TODOs

    • [x] send emails via smtp
    • [ ] calendar module via caldav
    • [x] exercises integration in web module
    • [ ] submit solutions for exercises
    • [ ] news integration in web module
    • [ ] texts integration
    • [x] get full name from username
    • [x] sending emails: proper encoding
    • [x] iserv script for cli
    • [x] save sessions
    • [x] IServ time format parsing and encoding
    • [ ] auto-enable modules that are used