simplyGits / MagisterJS

A JavaScript implementation of the Magister 6 API.
http://simplyGits.github.io/MagisterJS/
GNU Lesser General Public License v3.0
38 stars 13 forks source link

Looking for a new maintainer #76

Open lieuwex opened 7 years ago

lieuwex commented 7 years ago

I'm finished with high school and I don't really feel like continuing a project I can't use personally. It's also pretty hard for me to continue with Magister.js since I don't have a Magister account anymore.

So I'm looking for a new maintainer, Magister.js v2 still needs to be finished. I recommend going with that, since its codebase is way cleaner and sturdier.

So anybody who wants to take this project is free to do so, I recommend building a PR (for the new auth system #73, for example). To get a feel with the codebase, I will of course be happy to help if needed. :)

On the same note, simplyHomework development has also stopped, it's in my opinion a really cool project and it's open source. So you can host it freely and go further with the project, which I would really appreciate. It sucks my big project has to die in such a sad and abrupt manner.

Tell me if you're interested. I wanted to make announce this way earlier, but I was too lazy or smth.

lieuwex commented 7 years ago

It's worth nothing that there are several projects relying on Magister.js. So maintainers of those projects are good candidates.

gruijter commented 7 years ago

Hi @lieuwex Lieuwex. Well, it is good to see you finished school! Sad to see you have to let go of the magister project you worked on so hard all these years. A big thanks for all of this!!!

I am using magisterjs for an app on a home automation system ( https://apps.athom.com/app/com.gruijter.magister ). The app is used by 100+ families. I am worried about being able to maintain the app if magisterjs is not maintained. My programming skills don't even come close to yours, so I won't be able to be the main maintainer. But if a 'real' programmer wants to take up this challenge, I'm willing to assist where I can.

I have some questions that might help a new maintainer get up to speed.

Anyhow: I wish you all the best and hope you are willing to give a helping hand every now and then 🥇

ATDVIES commented 6 years ago

Hi @lieuwex I'm interested to take over your project as I want to develop an add-on application for Magister for my school. I'm a teacher but also have a background in ICT and programming and want to develop some add-on functionality to Magister.

maybe we can have a chat about it? best regards Age

lieuwex commented 6 years ago

Hey Age,

Nice to hear you're interested! What's a way to contact you? You can send an email to lieuwerooijakkers@gmail.com so we can figure out a way to talk.

Best regards, Lieuwe

On Tue, 8 May 2018, 08:46 ATDVIES, notifications@github.com wrote:

Hi @lieuwex https://github.com/lieuwex I'm interested to take over your project as I want to develop an add-on application for Magister for my school. I'm a teacher but also have a background in ICT and programming and want to develop some add-on functionality to Magister.

maybe we can have a chat about it? best regards Age

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/simplyGits/MagisterJS/issues/76#issuecomment-387301694, or mute the thread https://github.com/notifications/unsubscribe-auth/AFvYKTWQY6Nqkb4JJ3Vat8uhSH6E3p00ks5twT8ogaJpZM4OZBsF .

Wqrld commented 6 years ago

@ATDVIES Please do this! I really want to see this project continued. And i am happy to see that there still are teachers that understand and like ICT.

gruijter commented 6 years ago

@ATDVIES +1

gruijter commented 6 years ago

And I believe this is priority 1: https://www.magister.nl/nog-veiliger-inloggen-in-magister/

Wqrld commented 6 years ago

What has to be done to make v2 work? I'm not great with js but I might be able to maintain magisterjs.

@gruijter none of those changes seem breaking to me. Would be nice to integrate some of it though.

Wqrld commented 6 years ago

are the

        ###*
        # @property id
        # @final
        # @type Number
        ###

comments required or are they just for yuidoc because the codebase would be a lot better readable without them and yuidoc(to me) isn't helpful.

And would you suggest to continue on v1 of v2?

lieuwex commented 6 years ago

@Wqrld sorry for the late reply.

I would highly suggest continuing with v2, practically everything is nicer and well thought out. It also uses promises which and actually has correct error handling for ratelimits. Coffeescript is a dying language and the usage of promises allow to use modern javascript with stuff like await. I forgot all the differences between v1 and v2 but iirc v1 didn't even have 100% support for everything Magister has to offer. (v2 doesn't also but that's just because it's incomplete, instead of a design decision).

Basically all of the v2 code is just better since I practically couldn't code when I started v1. Typing this I remember I also have capability handling support in v2, which means that it doesn't fail hard when doing stuff a school doesn't support, like sending mails for example. Something which is really useful when developing applications to be deployed across schools.

About the yuidoc comments: with v2 the idea was to basically use jsdoc, which is more modern and leaner. You don't have to provide the property field anymore, it supports modern js features and the generated docs file is way nicer.

I don't really care about what documentation system is used, as long one is used. Otherwise you would have to write documentation for the users separate from the code -and believe me– you don't want to do that. The users need docs anyways.

Hope I cleared this up for you, if you have any more questions don't hesitate to ask!

gruijter commented 6 years ago

@lieuwex I tested with the npm package you made here: https://www.npmjs.com/package/magister.js/v/2.0.0-alpha.0

Besides that it doesn't install in the folder where I run install, I get problems with the new auth method. It fails in the login function in magister.js

First, getting the xsrf token from the header fails. After some tweaking I managed to get the xsrf. But then it fails in getting the access token: return res.headers.get('Location').split('&access_token=')[1].split('&')[0];

Actually, I don't get an access token in the response. I get this as response (headers.location):

'https://accounts.magister.net/account/login?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DM6-broklede.magister.net%26redirect_uri%3Dhttps%253A%252F%252Fbroklede.magister.net%252Foidc%252Fredirect_callback.html%26response_type%3Did_token%2520token%26scope%3Dopenid%2520profile%2520magister.ecs.legacy%2520magister.mdv.broker.read%2520magister.dnn.roles.read%26state%3D2930XXXXXXXXXXX33%26nonce%3D8XXXXXXXXX191%26acr_values%3Dtenant%253Abroklede.magister.net'
netlob commented 6 years ago

@lieuwex I tested with the npm package you made here: https://www.npmjs.com/package/magister.js/v/2.0.0-alpha.0

Besides that it doesn't install in the folder where I run install, I get problems with the new auth method. It fails in the login function in magister.js

First, getting the xsrf token from the header fails. After some tweaking I managed to get the xsrf. But then it fails in getting the access token: return res.headers.get('Location').split('&access_token=')[1].split('&')[0];

Actually, I don't get an access token in the response. I get this as response (headers.location):

'https://accounts.magister.net/account/login?returnUrl=%2Fconnect%2Fauthorize%2Fcallback%3Fclient_id%3DM6-broklede.magister.net%26redirect_uri%3Dhttps%253A%252F%252Fbroklede.magister.net%252Foidc%252Fredirect_callback.html%26response_type%3Did_token%2520token%26scope%3Dopenid%2520profile%2520magister.ecs.legacy%2520magister.mdv.broker.read%2520magister.dnn.roles.read%26state%3D2930XXXXXXXXXXX33%26nonce%3D8XXXXXXXXX191%26acr_values%3Dtenant%253Abroklede.magister.net'

So you cant login? Or do you just not get the response back? While testing yesterday I was able to login, but not able to get data, cause I got some stupid errors from my device, which are all client side and not facing to the api.

How did you tried to get the xrsf token?

Also, why cant we continue building the magister-api from idiidk? (https://github.com/idiidk/magister-api/). It works fantastic, and is easy to maintain & update, its not as extended as this one, but with a couple hours of work it will be.

gruijter commented 6 years ago

I get an error when trying to login, because in my response header there is no access token.

I havent tried idiidk's version, but I will do so. I hope it has all the functionality I need🙏. Is idiidk actively maintaining and extending his version?

netlob commented 6 years ago

Nope, hé switched to this project to help maintain and expend this one. It has the basic functions.

How did you try to test it?

gruijter commented 6 years ago

I ran a small test.js from my windows console (and changed the credentials in test.js to a valid one). It finds the right school, but it then crashes on the res.headers.get... functions in magister.js

'use strict';

// retrieving data via Magister API

const Magister = require('magister.js');

const schoolName = 'test lyceum';
const username = 'test';
const password = 'testing12';

async function test() {
    try {
        const schools = await Magister.getSchools(schoolName);
        console.log(schools);
        const sessionCredentials = {
            school: schools[0], // get first matching school
            username,
            password,
        };
        const magisterSession = await Magister.default(sessionCredentials);
        console.log(magisterSession);
    } catch (error) { console.log(error); }
}

test();
netlob commented 6 years ago

And when you install the alpha version, and put the quick start code in a index.js and then run it with node?

Aka just follow the instructions :)

gruijter commented 6 years ago

which instructions ? LOL

Edit: Ah, the instructions in the package description :)

I will try to do it like that.

netlob commented 6 years ago

First create a new npm project with the command: npm init

Then answer the asked questions

Then install magister.js at the alpha version 2.0 with the command: npm install --save magister.js@2.0.0-alpha.0

Then create an index.js file in your project folder, and put these contents in:

const { default: magister, getSchools } = require('magister.js');
// or with es6 modules:
// import magister, { getSchools } from 'magister.js'

// replace every '<thing>' with your credentials:

getSchools('<schoolname>') // get schools matching '<schoolname>'
    .then((schools) => schools[0]) // get the first school
    .then((school) => magister({ // login
        school,
        username: '<username>',
        password: '<password>',
    }))
    .then((m) => { // done logging in, say hi
        console.log(`Hey ${m.profileInfo.firstName}!`);
    }, (err) => { // something went wrong
        console.error('something went wrong:', err);
    });

Then run: node index.js

gruijter commented 6 years ago

OK, this works. 👍

I think I messed up with Magister.default in stead of just Magister. I will have to go through my own app that I built on top of magister.js v2 to see if these changes work. https://apps.athom.com/app/com.gruijter.magister

lieuwex commented 6 years ago

I've merged v2 to master, meaning that v2 is basically the 'official' version from now on. The v2 branch is deprecated, but I'm keeping it to not mess up URLs for now.