-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(POC Shim): Remove unneeded iconfont shim for the webId POC
- Loading branch information
Showing
8 changed files
with
18 additions
and
1,679 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,16 @@ | ||
import { logger } from '$Logger'; | ||
import { | ||
isRunningPackaged, | ||
isRunningSpectronTestProcess, | ||
isRunningSpectronTestProcessingPackagedApp | ||
} from '$Constants'; | ||
import path from 'path'; | ||
import url from 'url'; | ||
|
||
import safeRoute from './safe'; | ||
import authRoute from './auth'; | ||
|
||
const setupRoutes = ( server, store ) => { | ||
export const setupRoutes = ( server, store ): void => { | ||
const routes = [safeRoute( store ), authRoute]; | ||
|
||
// TODO: Remove serving onf antd files when we can package | ||
// webId manager properly. | ||
server.get( /dummy/, ( request, res ) => { | ||
const { link } = request.params; | ||
const linkUrl = url.parse( link ); | ||
|
||
let safeFolder = isRunningPackaged | ||
? '../extensions/safe/' | ||
: './extensions/safe/'; | ||
safeFolder = | ||
isRunningSpectronTestProcess && | ||
!isRunningSpectronTestProcessingPackagedApp | ||
? 'extensions/safe/' | ||
: safeFolder; | ||
|
||
const antdIcons = path.resolve( __dirname, safeFolder, 'iconfont/' ); | ||
const finalPath = path.resolve( antdIcons, link ); | ||
res | ||
.sendFile( finalPath, { confine: false } ) | ||
.header( 'Access-Control-Allow-Origin', '*' ); | ||
} ); | ||
|
||
routes.forEach( route => { | ||
routes.forEach( ( route ) => { | ||
try { | ||
server.get( route.path, route.handler ); | ||
} catch ( e ) { | ||
logger.error( 'Problem initing a route.', route, e ); | ||
} catch ( error ) { | ||
logger.error( 'Problem initing a route.', route, error ); | ||
} | ||
} ); | ||
}; | ||
|
||
export default setupRoutes; |