Skip to content

Commit 67e18cd

Browse files
committed
proxy mode
1 parent d123b78 commit 67e18cd

File tree

4 files changed

+111
-44
lines changed

4 files changed

+111
-44
lines changed

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,39 @@ god knew i'd be too powerful if I could solve captchas everyday so here we are
2121
first import the `WebPortal` class inside a `<script type="module">` tag:
2222

2323
```javascript
24-
import { WebPortal } from 'https://cdn.jsdelivr.net/npm/[email protected].23/dist/jsjiit.min.esm.js';
24+
import { WebPortal } from 'https://cdn.jsdelivr.net/npm/[email protected].24/dist/jsjiit.min.esm.js';
2525
```
2626

2727
> [!IMPORTANT]
2828
> if this version causes issues, use the latest version from the cdn (even if i forget to update these docs). use the [npm link](https://www.npmjs.com/package/jsjiit) to find the latest version number.
2929
30-
then let's speedrun this depression:
30+
### 🚨 CORS Issues? (for browser usage)
31+
32+
JIIT recently added CORS restrictions that block cross-origin requests. if you're using this in a browser and getting CORS errors, enable proxy mode:
33+
34+
```javascript
35+
// create portal with proxy mode enabled (to bypass CORS)
36+
const portal = new WebPortal({
37+
useProxy: true,
38+
proxyUrl: 'https://your-cors-proxy.com // REQUIRED when useProxy is true
39+
});
40+
```
41+
42+
> **why proxy mode?**
43+
> JIIT's backend now only allows same-origin requests. the proxy server receives your request, forwards it to JIIT (server-to-server, no CORS), and returns the response with proper CORS headers. your frontend → proxy → JIIT → proxy → your frontend.
44+
>
45+
> **note:** you need to deploy your own CORS proxy and pass the URL when creating the WebPortal instance. yeah, fuck jpoop.
46+
47+
if you're running from the same domain as JIIT (you're not), or outside of a browser environment, you can skip proxy mode:
3148

3249
```javascript
33-
// create your portal buddy (they won't leave you like she did)
50+
// direct mode (default, no proxy)
3451
const portal = new WebPortal();
52+
```
53+
54+
then let's speedrun this depression:
3555
56+
```javascript
3657
// login (fingers crossed bestie)
3758
await portal.student_login('your_username', 'your_password');
3859
```
@@ -53,6 +74,7 @@ const sem = meta.latest_semester();
5374
const header = meta.latest_header();
5475
const attendance = await portal.get_attendance(header, sem);
5576
```
77+
5678
```javascript
5779
// Get attendace for every class of a subject
5880
const subjectIndex = 1;
@@ -67,29 +89,34 @@ if (attendance["studentattendancelist"][subjectIndex][possibleComponentCode]) {
6789
}
6890
let subjectAttendance = await portal.get_subject_daily_attendance(sem, subjectid, individualsubjectcode, subjectcomponentids);
6991
```
92+
7093
```javascript
7194
// Check SGPA & CGPA
7295
const sgpaCgpa = await portal.get_sgpa_cgpa();
7396
```
97+
7498
```javascript
7599
// Download marks for a semester
76100
const marksSems = await portal.get_semesters_for_marks();
77101
const previousSem = marksSems[1];
78102
const marks = await portal.download_marks(previousSem);
79103
```
104+
80105
```javascript
81106
// Get registered subjects & faculties for a semester
82107
const registerdSems = await portal.get_registered_semesters();
83108
const latestSem = registerdSems[0];
84109
const registeredSubjects = await portal.get_registered_subjects_and_faculties(latestSem);
85110
```
111+
86112
```javascript
87113
// Get Exam Schedule & Venue
88114
const examSems = await portal.get_semesters_for_exam_events();
89115
const latestSem = examSems[0];
90116
const examEvents = await portal.get_exam_events(latestSem);
91117
const examSchedule = await portal.get_exam_schedule(examEvents[0]);
92118
```
119+
93120
```javascript
94121
// Get Personal info like name, address ...
95122
const personalInfo = await portal.get_personal_info();
@@ -104,10 +131,12 @@ if this wrapper helped you avoid a mental breakdown, consider starring the repo
104131
not liable for any emotional damage caused by viewing your attendance. that's between you and god fr
105132
106133
## special thanks
134+
107135
massive shoutout to [codelif](https://github.com/codelif/) for creating [pyjiit](https://pyjiit.codelif.in/introduction.html).\
108136
y'all should check out pyjiit, it's the original goat that made jsjiit possible.
109137
110138
## future
139+
111140
- me: be funny
112141
- repo: be funnier
113-
- both: we're so back
142+
- both: we're so back

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsjiit",
3-
"version": "0.0.23",
3+
"version": "0.0.24",
44
"description": "Browser-compatible API for interacting with JIIT (Jaypee Institute of Information Technology) WebPortal. Bypasses CAPTCHA :)",
55
"main": "src/index.js",
66
"module": "dist/jsjiit.esm.js",

0 commit comments

Comments
 (0)