avorty / vulcan-api-js Goto Github PK
View Code? Open in Web Editor NEWUnoffical Vulcan UONET+ SDK for JavaScript / TypeScript
Home Page: https://avorty.github.io/vulcan-api-js/
License: MIT License
Unoffical Vulcan UONET+ SDK for JavaScript / TypeScript
Home Page: https://avorty.github.io/vulcan-api-js/
License: MIT License
You can't execute any of these functions.
It's an error code:
C:\Users\pewie\Documents\Muj Elektryk\node_modules\vulcan-api-js\lib\index.js:2486
query["unitId"] = student.unit.id;
^
TypeError: Cannot read properties of undefined (reading 'unit')
at ApiHelper.getList (C:\Users\pewie\Documents\Muj Elektryk\node_modules\vulcan-api-js\lib\index.js:2486:35)
at VulcanHebe.getLessons (C:\Users\pewie\Documents\Muj Elektryk\node_modules\vulcan-api-js\lib\index.js:3876:40)
at main (C:\Users\pewie\Documents\Muj Elektryk\index.js:14:18)
at Object.<anonymous> (C:\Users\pewie\Documents\Muj Elektryk\index.js:23:1)
at Module._compile (node:internal/modules/cjs/loader:1218:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
at Module.load (node:internal/modules/cjs/loader:1081:32)
at Module._load (node:internal/modules/cjs/loader:922:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.13.0
It would be nice if we had created and published a new version to npm.
yeah title
Create GitHub Pages documentation
nvm i found that grade.content have it
Tworzę projekt z użyciem tego modułu, jednak nie mogę wygenerować Keystore, gdyż request do wygenerowania tokenu Firebase na adres url: https://android.clients.google.com/c2dm/register3 powoduje błąd związany z CORS (nie zwraca Access-Control-Allow-Origin). Ten błąd uniemożliwia korzystanie z API. Co w tym wypadku zrobić?
Access to XMLHttpRequest at 'https://android.clients.google.com/c2dm/register3' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Dzień dobry,
Piszę projekt nestJS w TypeScripcie i korzystam z Państwa biblioteki. Niestety w trakcie kompilacji pojawił mi się błąd: SyntaxError: Unexpected end of input związany z tą biblioteką.
Oto mój kod korzystający z vulcan-api-js:
import { ForbiddenException, Injectable } from '@nestjs/common';
import { AuthDto } from './dto';
import { DbService } from '../db/db.service';
import bcrypt from 'bcrypt';
import {
AccountTools,
Keystore,
registerAccount,
VulcanHebe,
} from 'vulcan-api-js';
import { PrismaClientKnownRequestError } from '@prisma/client/runtime';
@Injectable()
export class AuthService {
constructor(private prisma: DbService) {}
async signup(dto: AuthDto): Promise<object> {
const keystore = new Keystore();
await keystore.init();
keystore.deviceModel = 'Muj Elektryk';
const vulcanAccount = await registerAccount(
keystore,
dto.token,
dto.symbol,
dto.pin,
);
const vulcanClient = new VulcanHebe(
keystore,
AccountTools.loadFromObject(vulcanAccount),
);
await vulcanClient.selectStudent();
const student = (await vulcanClient.getStudents())[0];
const lesson = (await vulcanClient.getLessons(new Date('2022-09-02')))[0];
const classNumber = student.periods.at(-1)?.level;
const saltRounds = 10;
let hashedPassword = '';
bcrypt.genSalt(saltRounds, (err, salt) => {
bcrypt.hash(dto.password, salt, (err, hash) => {
hashedPassword = hash;
});
});
try {
const user = await this.prisma.user.create({
data: {
name: student.pupil.firstName,
username: dto.username,
surname: student.pupil.surname,
class_name:
classNumber && lesson.class?.symbol
? classNumber + lesson.class.symbol
: '',
passwordHash: hashedPassword,
loginID: vulcanAccount.loginId,
email: vulcanAccount.userLogin,
certificate: keystore.certificate,
fingerprint: keystore.fingerprint,
privateKey: keystore.privateKey,
firebaseToken: keystore.firebaseToken,
},
});
return user;
} catch (error: any) {
if (error instanceof PrismaClientKnownRequestError) {
if (error.code === 'P2002') {
throw new ForbiddenException('Credentials taken!');
}
}
throw error;
}
}
}
It would be nice if we created a new version and publish it on npm.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.