Skip to content

Commit

Permalink
Merge pull request #153 from bl4drnnr/web-interface-dev
Browse files Browse the repository at this point in the history
Web interface dev
  • Loading branch information
bl4drnnr authored Apr 12, 2024
2 parents 7ad62a4 + 65fc3d7 commit 8b47731
Show file tree
Hide file tree
Showing 251 changed files with 9,653 additions and 1,410 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ ALLOWED_ENDPOINTS_SECURITY=registration-generate-2fa-qr,login-generate-2fa-qr,ge
ALLOWED_ENDPOINTS_USERS=forgot-password,upload-user-photo,user-info,user-security,user-info
ALLOWED_ENDPOINTS_COMPANY=create-company,company-information,delete-company,update-company,company-users,transfer-ownership
ALLOWED_ENDPOINTS_COMPANY_USERS=invite-user,company-member-info,delete-company-member,search-company-members
ALLOWED_ENDPOINTS_ROLES=create-role,update-role,assign-role,get-company-roles
ALLOWED_ENDPOINTS_ROLES=create-role,update-role,get-company-roles
ALLOWED_CONTROLLERS=auth,security,confirmation-hash,users,recovery,company,company-users,roles
Expand Down
51 changes: 0 additions & 51 deletions mnemosyne-web-interface/mnemosyne-api-proxy/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as cors from 'cors';
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
Expand All @@ -23,63 +22,13 @@ import { urlencoded, json } from 'express';
app.use(json({ limit: '50mb' }));
app.use(urlencoded({ extended: true, limit: '50mb' }));

// app.enableCors({
// allowedHeaders: ['Content-Type', 'Authorization', 'X-Access-Token'],
// methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'],
// credentials: true,
// origin: function (origin, callback) {
// if (whitelist.indexOf(origin) !== -1) {
// console.log('allowed cors for (API Proxy):', origin);
// callback(null, true);
// } else {
// console.log('blocked cors for:', origin);
// callback(new Error('Not allowed by CORS (API Proxy)'));
// }
// }
// });

// app.use(cors({
// allowedHeaders: ['Content-Type', 'Authorization', 'X-Access-Token'],
// methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'],
// origin: function (origin, callback) {
// if (whitelist.indexOf(origin) !== -1) {
// const message = `allowed cors for (API Proxy): ${origin}\n`;
// fs.appendFile('cors_logs.txt', message, (err) => {
// if (err) throw err;
// console.log('Cors log appended to file');
// });
// callback(null, true);
// } else {
// const message = `blocked cors for (API Proxy): ${origin}\n`;
// fs.appendFile('cors_logs.txt', message, (err) => {
// if (err) throw err;
// console.log('Cors log appended to file');
// });
// callback(new Error('Not allowed by CORS'));
// }
// },
// credentials: true,
// }));

// app.enableCors({
// allowedHeaders: ['content-type'],
// origin: 'https://mnemosyne.io',
// credentials: true
// });

app.enableCors({
allowedHeaders: ['Content-Type', 'Authorization', 'X-Access-Token'],
methods: ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS', 'HEAD'],
origin: whitelist,
credentials: true
});

// Working in the development mode
// app.enableCors({
// origin: ['http://localhost:4200', 'https://mnemosyne.io'],
// credentials: true
// });

const config = new DocumentBuilder()
.setTitle('Mnemosyne')
.setDescription('Documentation of Mnemosyne Proxy API.')
Expand Down

Large diffs are not rendered by default.

Loading

0 comments on commit 8b47731

Please sign in to comment.