Skip to content

Commit

Permalink
Dienstag 16:40
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Hornburger committed Oct 24, 2023
1 parent e818bc6 commit 568e6ee
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 17 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/server_bib-cockpit-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ jobs:
npm install
npm run build --if-present
npm run copy --if-present
npx playwright install --with-deps chromium
- name: Zip artifact for deployment
run: zip release.zip ./* -r -q
Expand Down
2 changes: 2 additions & 0 deletions src/routes/saveprotokollerouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export class SaveProtokolleroutsClass {

try {

// npx playwright install --with-deps chromium

let token;
let tenantId = this.Config.TENANT_ID;
let clientId = this.Config.CLIENT_APPLICATION_ID;
Expand Down
45 changes: 30 additions & 15 deletions src/routes/sendprotokollerouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ export class SendProtokolleroutsClass {
try {

let token;
let tenantId = this.Config.TENANT_ID;
let clientId = this.Config.CLIENT_APPLICATION_ID;
let endpoint = this.Config.MICROSOFT_LOGIN_ENDPOINT;
let Secret = this.Config.CLIENT_APPLICATION_SECRET;
let tenantId: string;
let clientId: string;
let endpoint: string;
let Secret: string;
let getdata: any;
let chunk: any;
let filebuffer;
Expand All @@ -71,7 +71,10 @@ export class SendProtokolleroutsClass {

this.sendprotokolllerouter.put('/', async (req: Request, res: Response) => {


tenantId = this.Config.TENANT_ID;
clientId = this.Config.CLIENT_APPLICATION_ID;
endpoint = this.Config.MICROSOFT_LOGIN_ENDPOINT;
Secret = this.Config.CLIENT_APPLICATION_SECRET;
filebuffer = [];

console.log('Send Protokoll');
Expand Down Expand Up @@ -111,23 +114,29 @@ export class SendProtokolleroutsClass {
scopes: ['https://graph.microsoft.com/.default'],
};

token = await msalClient.acquireTokenByClientCredential(tokenRequest);
try {

token = await msalClient.acquireTokenByClientCredential(tokenRequest);

graphClient = Client.init({
graphClient = Client.init({

authProvider: done => {
authProvider: done => {

done(null, token.accessToken);
}
});
done(null, token.accessToken);
}
});
}
catch(error) {

console.error('Tokenerror' + error.message);

res.status(error.statusCode).send({Error: error.message});
}

// Datei laden aus Teams

let Url = '/sites/' + this.Const.BAESiteID + '/drive/items/' + FileID + '/content';

// let Url = '/groups/' + TeamsID + '/drive/items/' + FileID + '/content';
// let Url = '/sites/' + this.Const.BAESiteID + '/drive/items/' + DirectoryID + ':/' + Filename + ':/content';

try {

getdata = await graphClient.api(Url).get();
Expand All @@ -139,7 +148,7 @@ export class SendProtokolleroutsClass {
res.status(error.statusCode).send({Error: error.message});
}

if(getdata) {
if(getdata && getdata !== null) {

getdata.on('readable', () => {

Expand Down Expand Up @@ -213,7 +222,13 @@ export class SendProtokolleroutsClass {
res.status(400).send({ Message: mailerror.message });
});
});
}
else {

console.error('getdata ist nicht bereit.');
console.error('Url: ' + Url);

res.status(400).send({ Message: 'getdata ist nicht bereit.'});
}

});
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"sourceMap": true,
"outDir": "dist-server",
"esModuleInterop": true,
"strictPropertyInitialization": false
},
"exclude": [
"node_modules"
Expand Down

0 comments on commit 568e6ee

Please sign in to comment.