.editorconfig000066400000000000000000000006371517657424700135630ustar00rootroot00000000000000# EditorConfig helps developers define and maintain consistent # coding styles between different editors and IDEs # editorconfig.org root = true [*] # Change these settings to your own preference indent_style = space indent_size = 4 # We recommend you to keep these unchanged end_of_line = lf charset = utf-8 trim_trailing_whitespace = true insert_final_newline = true [*.md] trim_trailing_whitespace = false .gitignore000066400000000000000000000003771517657424700130770ustar00rootroot00000000000000/build /node_modules /*.log /*.iws .idea/workspace.xml .idea/tasks.xml .idea/profiles_settings.xml .idea/inspectionProfiles/Project_Default.xml .idea/inspectionProfiles/profiles_settings.xml node_modules/.yarn-integrity .npmrc yarn.lock build-modules .idea/000077500000000000000000000000001517657424700120605ustar00rootroot00000000000000.idea/codeStyleSettings.xml000066400000000000000000000004251517657424700162570ustar00rootroot00000000000000 .idea/corifeus-app-web-pages.iml000066400000000000000000000005201517657424700170250ustar00rootroot00000000000000 .idea/modules.xml000066400000000000000000000004501517657424700142510ustar00rootroot00000000000000 .idea/php.xml000066400000000000000000000003301517657424700133650ustar00rootroot00000000000000 .idea/vcs.xml000066400000000000000000000002471517657424700134000ustar00rootroot00000000000000 .npmignore000066400000000000000000000002611517657424700130760ustar00rootroot00000000000000/.idea /artifacts /build /Gemfile /_layouts /_site /_includes /test /node_modules /*.iml /*.ipr /*.iws /.travis.yml /.scrutinizer.yml /Gruntfile.js /corifeus-boot.json /assets .travis.yml000066400000000000000000000015601517657424700132130ustar00rootroot00000000000000sudo: required cache: npm: false language: node_js node_js: - lts/* before_install: npm install -g npm before_script: - npm install -g grunt-cli npm - npm install env: global: secure: DfHvi6Jg6vXSCsdiB29pb1l315BEla5Pbfmr3t30n8p1OU2qeu1+PfaGwXv+vUvN3dQ81q7W9eN6aF1nPD+npibF8wd+xhSrLUE81wHIGfEWk7ZNO4p1t6Lx19PjYTCJLo5Oq+j6ceWrW2M9Vn4udvH2BkTrwjBSRTOIZQYHFw91R8MKT6jadKmnnb7bEWpjm7MBeTdf0jxcJIYlR4ydPHmE6+UEMYxa4RvM8GnBnbFwxygl+G9cduh8kPo/QgHFRBtEfdCjHpn5RooWz+xCvobgY3znvnrEZlj5f/AUxTdFjkdkfesA5IfgWqtaNwFBlvHtIwam8+9tLjBElbgVjVxoUiH+qB6atZshlOTbfSktH5pAdcHLNqan2nl/iHw7FsahWb1IzrZNBA/aEna2NqsEzuNjYz/68u7S//qQc6XR67wh6WBrR844uC1WF3DRGqkqtUmlVWA3wbKq61mksBtTtp+yGXQhklr5tz4nDfFwB6gkgKjSwJpt2SpTyp67Ce1mhJDHqVtlV1JgTNHCua/nw4k50tNeFCTZByL5o7V7ys0a7nAE0g7cvy6cCM0x9ihe+ZKyQvjHsBfKdYRTR2zIWMYzUtrOEwrAZl8cR5ITplXH0d6pRTmpaHh2JiT2wM9NHIcqSIQBGXtZtCrnshLChY3lg2n1OFdpGWjoUJE= Gruntfile.js000066400000000000000000000076711517657424700134100ustar00rootroot00000000000000module.exports = (grunt) => { const builder = require(`corifeus-builder-angular`); const loader = new builder.loader(grunt); loader.angular(); const folder = require('corifeus-builder').config.folder grunt.config.merge({ clean: { 'cory-build': [ folder.build.root, './build-modules' ] }, copy: { 'cory-build': { files: [ { cwd: 'src/public', expand: true, src: [ '**', ], dest: './build/browser/' }, { cwd: 'test/angular-webpack/public', expand: true, src: [ '**', ], dest: './build/browser/' }, { cwd: 'node_modules/corifeus-web', expand: true, src: [ '**', '!**/package.json' ], dest: './build-modules/corifeus-web/' }, { cwd: 'node_modules/corifeus-web-material', expand: true, src: [ '**', '!**/package.json' ], dest: './build-modules/corifeus-web-material/' }, ] }, 'cory-twemoji': { files: [ { cwd: 'node_modules/twemoji/2/svg', expand: true, src: [ '**', ], dest: './build/browser/assets/twemoji/svg' }, { cwd: 'test/angular-webpack/public', expand: true, src: [ '**', ], dest: './build/browser/' }, ] } }, watch: { wait: { files: ['**/*.js'], tasks: ['copy:cory-build'], }, json2sass: { } }, 'cory-json2scss': { json2sass: { files: ['src/angular/modules/github/json/settings.json'], dest: 'src/assets/_settings.scss', prefix: 'cory-layout-settings' }, }, 'cory-inject': { sass: { files: [ 'src/angular/**/*.scss' ], dest: 'src/assets/style.scss', template: '@import \'${file}\';' } }, }); const defaults = [ 'cory-json2scss', 'cory-inject' ]; const postProcess= [ 'copy:cory-twemoji', ] // grunt.registerTask('default', defaults.concat(builder.config.task.build.angularAot)); grunt.registerTask('default', defaults.concat(builder.config.task.build.angularAot).concat(postProcess)); grunt.registerTask('dev', defaults.concat(builder.config.task.build.angular).concat(postProcess)); grunt.registerTask('aot', defaults.concat(builder.config.task.build.angularAot).concat(postProcess)); grunt.registerTask('aot-jit', defaults.concat(builder.config.task.build.angularAotJit).concat(postProcess)); grunt.registerTask('run', defaults.concat(builder.config.task.run.angular)); grunt.registerTask('coverage', 'karma:cory-angular'); grunt.registerTask('test-connect', [ 'connect:cory-angular', 'watch:cory-wait' ]) } LICENSE000066400000000000000000000023221517657424700121040ustar00rootroot00000000000000 @license corifeus-app-web-pages v2020.4.227 🕸️ Corifeus App Web Pages https://corifeus.com/corifeus-app-web-pages Copyright (c) 2020 Patrik Laszlo / P3X / Corifeus and contributors. MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. README.md000066400000000000000000000065231517657424700123650ustar00rootroot00000000000000[//]: #@corifeus-header [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://paypal.me/patrikx3) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Corifeus @ Facebook](https://img.shields.io/badge/Facebook-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) [![Build Status](https://api.travis-ci.com/patrikx3/corifeus-app-web-pages.svg?branch=master)](https://travis-ci.com/patrikx3/corifeus-app-web-pages) [![Uptime Robot ratio (30 days)](https://img.shields.io/uptimerobot/ratio/m780749701-41bcade28c1ea8154eda7cca.svg)](https://uptimerobot.patrikx3.com/) --- # 🕸️ Corifeus App Web Pages v2020.4.226 **Bugs are evident™ - MATRIX️** ### NodeJs LTS Version Requirement ```txt >=12.13.0 ``` ### Built on NodeJs ```txt v12.16.3 ``` The ```async``` and ```await``` keywords are required. Only the latest LTS variant is supported. Install NodeJs: https://nodejs.org/en/download/package-manager/ # Built on Angular ```text 9.1.9 ``` # Description [//]: #@corifeus-header:end It is the common GitHub pages for all Corifeus projects. The Markdown rendering is off-loaded via a web worker. Non-blocking rendering, good for mobile clients. The code is splitted into multiple js chunks and using the script defer (deferred) loading. # More info [API](https://api.github.com/) [Repositories](https://api.github.com/users/patrikx3/repos) There is an error in TypeScript. The workaround is in ```tsconfig.json```: ```json { "compilerOptions": { "skipLibCheck": true } } ``` Should remove once it works. # `@Host()` decorator not working in Ivy https://github.com/angular/angular/issues/31539 Actually, I can inject the component without the `@Host` decorator. [//]: #@corifeus-footer --- 🙏 This is an open-source project. Star this repository, if you like it, or even donate to maintain the servers and the development. Thank you so much! Possible, this server, rarely, is down, please, hang on for 15-30 minutes and the server will be back up. All my domains ([patrikx3.com](https://patrikx3.com) and [corifeus.com](https://corifeus.com)) could have minor errors, since I am developing in my free time. However, it is usually stable. **Note about versioning:** Versions are cut in Major.Minor.Patch schema. Major is always the current year. Minor is either 4 (January - June) or 10 (July - December). Patch is incremental by every build. If there is a breaking change, it should be noted in the readme. --- [**CORIFEUS-APP-WEB-PAGES**](https://corifeus.com/corifeus-app-web-pages) Build v2020.4.226 [![Donate for Corifeus / P3X](https://img.shields.io/badge/Donate-Corifeus-003087.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZVM4V6HVZJW6) [![Contact Corifeus / P3X](https://img.shields.io/badge/Contact-P3X-ff9900.svg)](https://www.patrikx3.com/en/front/contact) [![Like Corifeus @ Facebook](https://img.shields.io/badge/LIKE-Corifeus-3b5998.svg)](https://www.facebook.com/corifeus.software) ## P3X Sponsor [IntelliJ - The most intelligent Java IDE](https://www.jetbrains.com/?from=patrikx3) [![JetBrains](https://cdn.corifeus.com/assets/svg/jetbrains-logo.svg)](https://www.jetbrains.com/?from=patrikx3) [//]: #@corifeus-footer:end corifeus-app-web-pages.iml000066400000000000000000000005171517657424700160530ustar00rootroot00000000000000 package.json000066400000000000000000000025751517657424700133770ustar00rootroot00000000000000{ "name": "corifeus-app-web-pages", "version": "2020.4.227", "corifeus": { "icon": "fas fa-sitemap", "code": "Support", "cdn": true, "nodejs": "v12.16.3", "opencollective": false, "reponame": "corifeus-app-web-pages", "build": true, "angular": "9.1.9" }, "description": "🕸️ Corifeus App Web Pages", "main": "src/index.js", "directories": { "test": "test" }, "scripts": { "test": "grunt", "postinstall": "node node_modules/corifeus-builder/src/utils/twemoji-install.js" }, "license": "MIT", "repository": { "type": "git", "url": "git+https://github.com/patrikx3/corifeus-app-web-pages.git" }, "keywords": [ "corifeus", "pages" ], "author": "Patrik Laszlo ", "bugs": { "url": "https://github.com/patrikx3/corifeus-app-web-pages/issues" }, "homepage": "https://corifeus.com/corifeus-app-web-pages", "dependencies": { "@types/marked": "^0.7.4", "corifeus-builder-angular": "^2020.4.230", "corifeus-utils": "^2020.4.185", "corifeus-web-material": "^2020.4.224", "emoji-regex": "^9.0.0", "highlight.js": "^10.0.3", "marked": "=1.1.0", "twemoji": "=13.0.0" }, "engines": { "node": ">=12.13.0" } }src-save/000077500000000000000000000000001517657424700126235ustar00rootroot00000000000000src-save/with-worker/000077500000000000000000000000001517657424700151055ustar00rootroot00000000000000src-save/with-worker/angular/000077500000000000000000000000001517657424700165365ustar00rootroot00000000000000src-save/with-worker/angular/service/000077500000000000000000000000001517657424700201765ustar00rootroot00000000000000src-save/with-worker/angular/service/markdown.ts000066400000000000000000000015131517657424700223700ustar00rootroot00000000000000import {Injectable} from '@angular/core'; import {Layout} from '../layout/cory-layout'; const Worker = require(`../../worker/markdown.worker.js`); const worker = new Worker(); @Injectable() export class MarkdownService { public context: any; layout: Layout; constructor() { } public render(md: string, layout: Layout) { this.layout = layout; return new Promise((resolve, reject) => { const message = (event: any) => { resolve(event.data) worker.removeEventListener('message', message) } worker.addEventListener('message', message) worker.postMessage({ md: md, settings: this.context.settings.data, currentRepo: this.layout.currentRepo, }); }) } } src-save/with-worker/worker/000077500000000000000000000000001517657424700164165ustar00rootroot00000000000000src-save/with-worker/worker/markdown.worker.js000066400000000000000000000165301517657424700221130ustar00rootroot00000000000000import {kebabCase} from 'lodash'; function htmlStrip(html) { // const tmp = document.createElement("DIV"); // tmp.innerHTML = html; // return tmp.textContent || tmp.innerText || ""; return html.replace(/<\/?[^>]+(>|$)/g, ""); } const IsBot = require('corifeus-web/src/util/is-bot.js') const hljs = require('highlight.js'); hljs.registerLanguage('conf', require('highlight.js/lib/languages/nginx.js')); hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml.js')); hljs.registerLanguage('css', require('highlight.js/lib/languages/css.js')); hljs.registerLanguage('scss', require('highlight.js/lib/languages/scss.js')); hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml.js')); hljs.registerLanguage('yml', require('highlight.js/lib/languages/yaml.js')); hljs.registerLanguage('powershell', require('highlight.js/lib/languages/powershell.js')); hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript.js')); hljs.registerLanguage('js', require('highlight.js/lib/languages/javascript.js')); hljs.registerLanguage('json', require('highlight.js/lib/languages/json.js')); hljs.registerLanguage('bash', require('highlight.js/lib/languages/shell.js')); hljs.registerLanguage('typescript', require('highlight.js/lib/languages/typescript.js')); hljs.registerLanguage('ts', require('highlight.js/lib/languages/typescript.js')); hljs.registerLanguage('ini', require('highlight.js/lib/languages/ini.js')); const twemoji = require('twemoji').default; if (process.env === 'production') { twemoji.base = '/assets/twemoji/'; } const marked = require('marked') const markdownRenderer = new marked.Renderer(); const extract = (template, area) => { // [//]: #@corifeus-header // [//]: #corifeus-header:end // [//]: #@corifeus-footer // [//]: #@corifeus-footer:end const start = `[//]: #@${area}`; const end = `[//]: #@${area}:end`; const startIndex = template.indexOf(start); const endIndex = template.indexOf(end); //console.log('start', start, startIndex) //console.log('end', end, endIndex) let result = template.substring(0, startIndex + start.length); result += template.substring(endIndex + end.length); return result; } markdownRenderer.heading = (text, level, raw) => { // console.log('text', text,) // console.log('raw', raw) const ref = kebabCase(htmlStrip(raw)).replace(/[^\x00-\xFF]/g, ""); // console.log('ref', ref) const id = `${ref}-parent`; //console.log(ref); let navClick = '' if (!IsBot()) { navClick = `onclick="return window.coryAppWebPagesNavigateHash('${id}');"`; } let element = `${text} `; // console.log('ref', ref) return element } markdownRenderer.image = (href, title, text) => { title = title || ''; text = text || ''; if (!href.startsWith('http')) { href = `https://cdn.corifeus.com/git/${currentRepo}/${href}`; } let result if (text.toLowerCase().trim() === 'link') { result = ``; } else { result = ` ${title} ${text} `; } return result; }; markdownRenderer.link = (href, title, text) => { let a; let tooltip = ''; if (title !== null) { tooltip = `tooltip="${title}"`; } let fixed = false; let path; const testHref = href.toLowerCase(); //console.log(testHref) if (testHref.includes(`${settings.pages.defaultDomain}`) || testHref.includes('localhost:8080')) { const url = new URL(href); href = url.pathname.substr(1); path = `${href}`; fixed = true; //console.log('fixed') } // console.log('href', href) if (!href.startsWith(locationOrigin) && (href.startsWith('https:/') || href.startsWith('http:/'))) { if (href.endsWith('#cory-non-external')) { a = `${text}`; } else { a = `${text} `; } } else { if (!fixed) { if (href.endsWith('.md')) { href = href.substr(0, href.length - 3) + '.html'; } if (href.startsWith(locationOrigin)) { path = `/${href.substring(locationOrigin.length + 1)}`; } else if (href.startsWith('./')) { let base = locationHref if (!base.includes('.')) { base = locationHref + '/'; } path = `${new URL(href, base).pathname}`; // console.log(path) } else { path = `/github/${currentRepo}/${href}`; } } // console.log(path) // this.context.parent.navigate const navClick = !IsBot() ? `onclick="window.coryAppWebPagesNavigate('${path}'); return false;"` : ''; a = `${text}`; // console.log(path); // console.log(a); } return a; } markdownRenderer.code = (code, language) => { if (language === undefined) { language = 'text'; } language = language.toLowerCase() if ((hljs.getLanguage(language) === 'undefined' || hljs.getLanguage(language) === undefined) && language !== 'text') { console.error(`Please add highlight.js as a language (could be a marked error as well, sometimes it thinks a language): ${language} We are not loading everything, since it is about 500kb`) } language = language === 'text' || language === undefined ? 'html' : language; const validLang = !!(language && hljs.getLanguage(language)); const highlighted = validLang ? hljs.highlight(language, code).value : code; return `
${highlighted}
`; }; markdownRenderer.codespan = (code) => { const lang = 'html'; const highlighted = hljs.highlight(lang, code).value; return `${highlighted}`; } let currentRepo, settings let locationOrigin, locationPathname, locationHref const construct = (data) => { currentRepo = data.currentRepo settings = data.settings locationOrigin = location.origin locationPathname = location.pathname locationHref = location.href let { md } = data md = md.trim() md = extract(md, 'corifeus-header'); md = extract(md, 'corifeus-footer'); md = twemoji.parse(md, { folder: 'svg', ext: '.svg', }) let html = marked(md, { renderer: markdownRenderer }); html = html.replace(/{/g, '{').replace(/}/g, '}'); html = html.replace(/&/g, '&'); return html; } onmessage = function (e) { const result = construct(e.data); postMessage(result) } src-save/without-worker/000077500000000000000000000000001517657424700156355ustar00rootroot00000000000000src-save/without-worker/angular/000077500000000000000000000000001517657424700172665ustar00rootroot00000000000000src-save/without-worker/angular/service/000077500000000000000000000000001517657424700207265ustar00rootroot00000000000000src-save/without-worker/angular/service/markdown.ts000066400000000000000000000175511517657424700231310ustar00rootroot00000000000000import {Injectable} from '@angular/core'; const hljs = require('highlight.js'); hljs.registerLanguage('conf', require('highlight.js/lib/languages/nginx.js')); hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml.js')); hljs.registerLanguage('css', require('highlight.js/lib/languages/css.js')); hljs.registerLanguage('scss', require('highlight.js/lib/languages/scss.js')); hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml.js')); hljs.registerLanguage('yml', require('highlight.js/lib/languages/yaml.js')); hljs.registerLanguage('powershell', require('highlight.js/lib/languages/powershell.js')); hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript.js')); hljs.registerLanguage('js', require('highlight.js/lib/languages/javascript.js')); hljs.registerLanguage('json', require('highlight.js/lib/languages/json.js')); hljs.registerLanguage('bash', require('highlight.js/lib/languages/shell.js')); hljs.registerLanguage('typescript', require('highlight.js/lib/languages/typescript.js')); hljs.registerLanguage('ts', require('highlight.js/lib/languages/typescript.js')); hljs.registerLanguage('ini', require('highlight.js/lib/languages/ini.js')); import * as marked from 'marked'; import {kebabCase} from 'lodash'; import {Layout} from '../layout/cory-layout'; import {htmlStrip} from "../utils/html-strip"; const IsBot = require('corifeus-web/src/util/is-bot.js') const twemoji = require('twemoji').default; @Injectable() export class MarkdownService { markdownRenderer: any = new marked.Renderer(); public context: any; layout: Layout; constructor() { this.markdownRenderer.heading = (text: string, level: number, raw: string) => { // console.log('text', text,) // console.log('raw', raw) const ref = kebabCase(htmlStrip(raw)).replace(/[^\x00-\xFF]/g, ""); // console.log('ref', ref) const id = `${ref}-parent`; //console.log(ref); let navClick = '' if (!IsBot()) { navClick = `onclick="return window.coryAppWebPagesNavigateHash('${id}');"`; } let element = `${text} `; // console.log('ref', ref) return element } this.markdownRenderer.image = (href: string, title: string, text: string) => { title = title || ''; text = text || ''; if (!href.startsWith('http')) { href = `https://cdn.corifeus.com/git/${this.layout.currentRepo}/${href}`; } let result if (text.toLowerCase().trim() === 'link') { result = ``; } else { result = ` ${title} ${text} `; } return result; }; this.markdownRenderer.link = (href: string, title: string, text: string) => { let a; let tooltip = ''; if (title !== null) { tooltip = `tooltip="${title}"`; } let fixed = false; let path; const testHref = href.toLowerCase(); //console.log(testHref) if (testHref.includes(`${this.context.settings.data.pages.defaultDomain}`) || testHref.includes('localhost:8080')) { const url = new URL(href); href = url.pathname.substr(1); path = `${href}`; fixed = true; //console.log('fixed') } // console.log('href', href) if (!href.startsWith(location.origin) && (href.startsWith('https:/') || href.startsWith('http:/'))) { if (href.endsWith('#cory-non-external')) { a = `${text}`; } else { a = `${text} `; } } else { if (!fixed) { if (href.endsWith('.md')) { href = href.substr(0, href.length - 3) + '.html'; } if (href.startsWith(location.origin)) { path = `/${href.substring(location.origin.length + 1)}`; } else if (href.startsWith('./')) { let base = location.href if (!base.includes('.')) { base = location.href + '/'; } path = `${new URL(href, base).pathname}`; // console.log(path) } else { path = `/github/${this.context.parent.currentRepo}/${href}`; } } // console.log(path) // this.context.parent.navigate const navClick = !IsBot() ? `onclick="window.coryAppWebPagesNavigate('${path}'); return false;"` : ''; a = `${text}`; // console.log(path); // console.log(a); } return a; } this.markdownRenderer.code = (code: string, language: string) => { if (language === undefined) { language = 'text'; } language = language.toLowerCase() if ((hljs.getLanguage(language) === 'undefined' || hljs.getLanguage(language) === undefined) && language !== 'text') { console.error(`Please add highlight.js as a language (could be a marked error as well, sometimes it thinks a language): ${language} We are not loading everything, since it is about 500kb`) } language = language === 'text' || language === undefined ? 'html' : language; const validLang = !!(language && hljs.getLanguage(language)); const highlighted = validLang ? hljs.highlight(language, code).value : code; return `
${highlighted}
`; }; this.markdownRenderer.codespan = (code: string) => { const lang = 'html'; const highlighted = hljs.highlight(lang, code).value; return `${highlighted}`; } } private extract(template: string, area: string): string { // [//]: #@corifeus-header // [//]: #corifeus-header:end // [//]: #@corifeus-footer // [//]: #@corifeus-footer:end const start = `[//]: #@${area}`; const end = `[//]: #@${area}:end`; const startIndex = template.indexOf(start); const endIndex = template.indexOf(end); let result: string = template.substring(0, startIndex); result += template.substring(endIndex); return result; } public render(md: string, layout: Layout) { this.layout = layout; md = twemoji.parse(md, { folder: 'svg', ext: '.svg', }) md = this.extract(md, 'corifeus-header'); md = this.extract(md, 'corifeus-footer'); let html = marked(md, { renderer: this.markdownRenderer }); html = html.replace(/{/g, '{').replace(/}/g, '}'); html = html.replace(/&/g, '&'); return html; } } src-save/without-worker/angular/utils/000077500000000000000000000000001517657424700204265ustar00rootroot00000000000000src-save/without-worker/angular/utils/html-strip.ts000066400000000000000000000002601517657424700230770ustar00rootroot00000000000000export function htmlStrip(html: string): string { const tmp = document.createElement("DIV"); tmp.innerHTML = html; return tmp.textContent || tmp.innerText || ""; } src/000077500000000000000000000000001517657424700116675ustar00rootroot00000000000000src/angular/000077500000000000000000000000001517657424700133205ustar00rootroot00000000000000src/angular/application.ts000066400000000000000000000002711517657424700161730ustar00rootroot00000000000000import { Component, } from '@angular/core'; @Component({ selector: 'cory-web-pages-app', template: ` ` }) export class Application { }src/angular/bundle.aot.ts000066400000000000000000000005351517657424700157260ustar00rootroot00000000000000import {enableProdMode} from '@angular/core'; enableProdMode(); import {platformBrowser} from '@angular/platform-browser'; import './bundle.common'; /* import {ModuleNgFactory} from './module.ngfactory'; platformBrowser().bootstrapModuleFactory(ModuleNgFactory); */ import {Module} from './module'; platformBrowser().bootstrapModule(Module) src/angular/bundle.common.ts000066400000000000000000000002561517657424700164330ustar00rootroot00000000000000/* if (process.env.ENV === 'production') { // Production } else { // Development } */ require('corifeus-web-material/src/bundle'); require('../assets/style.scss') src/angular/bundle.ts000066400000000000000000000005001517657424700151340ustar00rootroot00000000000000import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {enableProdMode} from '@angular/core'; declare var process: any; if (process.env === 'production') { enableProdMode(); } import './bundle.common'; import {Module} from './module'; platformBrowserDynamic().bootstrapModule(Module); src/angular/module.routes.ts000066400000000000000000000005551517657424700165020ustar00rootroot00000000000000import {Routes} from '@angular/router'; export const moduleRoutes: Routes = [ { path: ':repo', loadChildren: () => import('./modules/github/github.module').then(m => m.GitHubModule) }, { path: '', redirectTo: `/matrix`, // redirectTo: `/github/${settings.github.defaultRepo}`, pathMatch: 'full' }, ]; src/angular/module.ts000066400000000000000000000013301517657424700151520ustar00rootroot00000000000000import {NgModule } from '@angular/core'; import {RouterModule} from '@angular/router'; import {CorifeusMaterialModule } from 'corifeus-web-material'; import {Application} from './application'; import { moduleRoutes } from './module.routes'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; /*** * NEVER USE A EXPORT * AS, NEED THE EXACT COMPONENT FOR INJECTABLE FUNCTION!!!! */ @NgModule({ imports: [ BrowserAnimationsModule, RouterModule.forRoot(moduleRoutes), CorifeusMaterialModule, ], entryComponents: [], declarations: [ Application, ], providers: [ ], bootstrap: [ Application ] }) export class Module { } src/angular/modules/000077500000000000000000000000001517657424700147705ustar00rootroot00000000000000src/angular/modules/github/000077500000000000000000000000001517657424700162525ustar00rootroot00000000000000src/angular/modules/github/component/000077500000000000000000000000001517657424700202545ustar00rootroot00000000000000src/angular/modules/github/component/cory-web-pages-build-status.ts000066400000000000000000000104021517657424700260630ustar00rootroot00000000000000import { Component, Input, OnDestroy, } from '@angular/core'; import { Subscription } from 'rxjs' import {LocaleService, LocaleSubject} from "corifeus-web"; @Component({ selector: 'cory-web-pages-build-status', styles: [` .cory-web-pages-build-status { position: relative; top: 3px; } `], template: ` {{ pkg.description }}     {{ i18n.pages.title.uptime }}           ` }) export class Status implements OnDestroy { subscriptions$: Array = [] @Input('cory-pkg') pkg: any; tooltipPosition: string = 'above' i18n: any constructor( protected locale: LocaleService, ) { this.subscriptions$.push( this.locale.subscribe((subject: LocaleSubject) => { this.i18n = subject.locale.data }) ) } ngOnDestroy(): void { this.subscriptions$.forEach(subs$ => subs$.unsubscribe()) } } src/angular/modules/github/github.module.ts000066400000000000000000000037631517657424700214010ustar00rootroot00000000000000import {NgModule, Injectable} from '@angular/core'; import {RouterModule} from '@angular/router'; import { MatSidenavModule, } from '@angular/material/sidenav'; import {Layout, Header, Footer} from './layout'; import {Status} from './component/cory-web-pages-build-status'; import {Page, OpenCollective} from './page'; import {CdnService, MarkdownService} from './service'; import { githubRoutes } from './github.routes'; import {MatInputModule,} from '@angular/material/input' import { CommonModule } from '@angular/common' import {LocaleService, SettingsService} from 'corifeus-web'; import {CorifeusMaterialModule} from "corifeus-web-material/index"; /*** * NEVER USE A EXPORT * AS, NEED THE EXACT COMPONENT FOR INJECTABLE FUNCTION!!!! */ declare var process: any; @NgModule({ imports: [ CommonModule, MatInputModule, MatSidenavModule, CorifeusMaterialModule, RouterModule.forChild(githubRoutes), ], entryComponents: [], declarations: [ Layout, Header, Footer, Page, OpenCollective, Status ], providers: [ CdnService, MarkdownService, ], bootstrap: [ ] }) export class GitHubModule { constructor( private loc: LocaleService, private settings: SettingsService, ) { const twemoji = require('twemoji').default; twemoji.folder = 'svg'; twemoji.ext = '.svg'; if (process.env === 'production') { twemoji.base = '/assets/twemoji/'; } let settingsExtendJson = require('./json/settings.core.json'); settings.extend('core', settingsExtendJson); settings.afterInit(); const module = 'pages'; const settingsJson = require('./json/settings.json'); settings.register(module, settingsJson); loc.register(module, { en: require('./json/translation/english.json'), hu: require('./json/translation/hungarian.json'), }) } } src/angular/modules/github/github.routes.ts000066400000000000000000000012101517657424700214160ustar00rootroot00000000000000import {Routes} from '@angular/router'; import {Layout} from './layout'; import {Page} from './page/cory-page'; import {OpenCollective} from './page/cory-open-collective'; import {Http404} from 'corifeus-web-material'; export const githubRoutes: Routes = [ { path: '', component: Layout, children: [ { path: '404', component: Http404 }, { path: 'open-collective', component: OpenCollective }, { path: '**', component: Page } ] }, ]; src/angular/modules/github/json/000077500000000000000000000000001517657424700172235ustar00rootroot00000000000000src/angular/modules/github/json/settings.core.json000066400000000000000000000002531517657424700227050ustar00rootroot00000000000000{ "server": { "url": "https://server.patrikx3.com" }, "integration": { "google": { "analytics": "UA-102164992-1" } } } src/angular/modules/github/json/settings.json000066400000000000000000000006371517657424700217640ustar00rootroot00000000000000{ "debounce": { "default": 250 }, "defaultDomain": [ "corifeus.com", "www.corifeus.com" ], "p3x": { "git": { "url": "https://server.patrikx3.com/api/patrikx3/git/repos", "url-test": "https://localhost:23501/api/patrikx3/git/repos" } }, "github": { "defaultRepo": "corifeus", "repoNames": "corifeus" } } src/angular/modules/github/json/translation/000077500000000000000000000000001517657424700215615ustar00rootroot00000000000000src/angular/modules/github/json/translation/english.json000066400000000000000000000043511517657424700241100ustar00rootroot00000000000000{ "title": { "searchNotFound": "No packages found for the query.", "ready": "Bugs are evident™ - MATRIX", "search": "Search", "developer": "Patrik Laszlo © ", "packages": "Packages", "sponsor": { "jetbrains": "JetBrains" }, "opencollective": { "label": "\uD83D\uDE4F️ With your donation you may support our development. Become a backer or a sponsor on Open Collective ... ", "backers": "Backers on Open Collective", "sponsors": "Sponsors on Open Collective" }, "home": "Matrix", "travis": "Travis Build status", "uptime": "Uptime Robot ratio (30 days)", "githubStars": "GitHub Stars", "scrunitizer": { "quality": "Scrutinizer Code Quality", "coverage": "Scrutinizer Code Coverage", "build": "Scrutinizer Build Status" }, "donate": "Donate to Corifeus / P3X", "contact": "Contact", "facebook": "Facebook" }, "url": { "contact": "https://www.patrikx3.com/en/front/contact" }, "badge": { "contact": "https://img.shields.io/badge/Contact-P3X-ff9900.svg", "donate": "https://img.shields.io/badge/Donate-Corifeus-003087.svg", "facebook": "https://img.shields.io/badge/Facebook-Corifeus-3b5998.svg" }, "opencollective": { "contributors": "Contributors", "contributorsMessage": "This project exists thanks to all the people who contribute.", "backers": "Backers", "backersMessage": "Thank you to all our backers!", "backersLink": "Become a backer", "sponsors": "Sponsors", "sponsorsMessage": "Support this project by becoming a sponsor. Your logo will show up here with a link to your website.", "sponsorsMessageLink": "Become a sponsor" }, "menu": { "menu-corifeus-code-style": "Code style", "menu-corifeus-architecture": "Architecture", "menu-corifeus-architecture-overview": "Overview", "menu-corifeus-patterns": "Patterns", "menu-corifeus-more": "More", "menu-corifeus-more-github": "Github pages", "menu-corifeus-more-origin": "Corifeus name origin" } } src/angular/modules/github/json/translation/hungarian.json000066400000000000000000000044011517657424700244270ustar00rootroot00000000000000{ "title": { "searchNotFound": "A lekérdezéshez nincsenek talált csomagok.", "ready": "A hibák eredetiek™ - MATRIX", "search": "Keresés", "developer": "Laszlo Patrik © ", "packages": "Csomagok", "sponsor": { "jetbrains": "JetBrains" }, "opencollective": { "label": "\uD83D\uDE4F️ Adományával támogathatja a fejlesztésünket. Legyen támogató vagy szponzor az Open Collective-on ...", "backers": "Backers az Open Collective-on", "sponsors": "Szponzorok az Open Collective-on" }, "home": "Matrix", "travis": "Travis Kiépítettség", "uptime": "Uptime Robot hányados (30 nap)", "githubStars": "GitHub Csillagok", "scrunitizer": { "quality": "Scrutinizer kód minőség", "coverage": "Scrutinizer Kódlefedettséget", "build": "Scrutinizer Kiépítettség" }, "donate": "Adományozzon a Corifeus / P3X-nak", "contact": "Kapcsolat", "facebook": "Facebook" }, "url": { "contact": "https://www.patrikx3.com/hu/ajto/kapcsolat" }, "badge": { "contact": "https://img.shields.io/badge/Kapcsolat-P3X-ff9900.svg", "donate": "https://img.shields.io/badge/Adományozzon-Corifeus-003087.svg", "facebook": "https://img.shields.io/badge/Facebook-Corifeus-3b5998.svg" }, "opencollective": { "contributors": "Közreműködők", "contributorsMessage": "Az alábbi emberek dolgoztak ebben a projektben.", "backers": "Támogatók", "backersMessage": "Köszönjük a támogatást!", "backersLink": "Legyél támogató", "sponsors": "Szponzorok", "sponsorsMessage": "Legyél szponzor és a logódat megjelentítjük.", "sponsorsMessageLink": "Legyél szponzor" }, "menu": { "menu-corifeus-code-style": "Kód stílus", "menu-corifeus-architecture": "Szerkezet", "menu-corifeus-architecture-overview": "Áttekintés", "menu-corifeus-patterns": "Minták", "menu-corifeus-more": "Több", "menu-corifeus-more-github": "Github oldalok", "menu-corifeus-more-origin": "Corifeus név eredete " } } src/angular/modules/github/layout/000077500000000000000000000000001517657424700175675ustar00rootroot00000000000000src/angular/modules/github/layout/cory-layout.html000066400000000000000000000127331517657424700227520ustar00rootroot00000000000000
v{{ packageJson.version }}
 {{ extractStars(packageJson.corifeus.stargazers_count) }}


Built on Angular v{{packageJson.corifeus.angular}}

src/angular/modules/github/layout/cory-layout.scss000066400000000000000000000007151517657424700227560ustar00rootroot00000000000000#cory-pages-layout-menu-main-icon { float: left; min-width: 24px !important; display: inline-block; text-align: center; position: relative; left: -7px; } .cory-pages-layout-menu-main-title { display: inline-block; max-width: 240px !important; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; } #cory-pages-layout-menu-main-close { position: fixed; top: 5px; right: 15px; z-index: 3 } src/angular/modules/github/layout/cory-layout.ts000066400000000000000000000265661517657424700224450ustar00rootroot00000000000000import { Component, Injectable, ViewEncapsulation, ViewChild, NgZone, OnInit, ElementRef, ChangeDetectorRef, OnDestroy, } from '@angular/core'; import { ActivatedRoute, } from '@angular/router'; import {debounce} from 'lodash' import { Subscription } from 'rxjs' import { MatSidenav } from '@angular/material/sidenav' import { RouterService, } from 'corifeus-web'; import {HttpClient} from '@angular/common/http'; const emojiRegex = require('emoji-regex/es2015/index.js'); import {LocaleService, LocaleSubject, SettingsService} from 'corifeus-web'; import {NotifyService} from 'corifeus-web-material'; import {extractStars, extractTitle} from '../utils/extrac-title'; import {extractTitleWithStars} from '../utils/extrac-title'; import {isMobile} from '../utils/is-mobile'; //import {clearTimeout} from "timers"; import { DomSanitizer, } from '@angular/platform-browser'; const twemoji = require('twemoji').default; //FIXME corifeus - matrix const regexFixCorifeusMatrix = /^(\/)?(corifeus)([^-])(\/)?(.*)/ declare global { interface Window { coryAppWebPagesNavigate: any, coryAppWebPagesNavigateHash: any, } } @Component({ selector: 'cory-layout', templateUrl: 'cory-layout.html', encapsulation: ViewEncapsulation.None }) @Injectable() export class Layout implements OnInit, OnDestroy { subscriptions$: Array = [] private debounceSearchText: Function; menuMenuActive: any; menuRepoActive: any searchText: string; extractTitle = extractTitle; @ViewChild('menuSidenav', {read: MatSidenav, static: true}) public menuSidenav: MatSidenav; @ViewChild('searchTextInputRef', {read: ElementRef, static: true}) public searchTextInputRefRead: ElementRef; currentRepo: string; body = document.getElementsByTagName('body')[0]; i18n: any; config: any; repos: any[]; packages: any; settings: any; packageJson: any = { version: undefined, corifeus: { ['time-stamp']: undefined, code: '', publish: false, } } title: string; icon: string; noScript: any; public isMobile: boolean = false; constructor( private router: RouterService, private route: ActivatedRoute, protected notify: NotifyService, private http: HttpClient, protected locale: LocaleService, protected settingsAll: SettingsService, private zone: NgZone, private sanitizer: DomSanitizer, private ref: ChangeDetectorRef ) { this.isMobile = isMobile(); this.settings = settingsAll.data.pages; this.currentRepo = this.settings.github.defaultRepo; this.subscriptions$.push( this.locale.subscribe((data: LocaleSubject) => { this.i18n = data.locale.data.pages; }) ) this.noScript = document.getElementById('cory-seo'); this.subscriptions$.push( this.route.params.subscribe((params) => { let repo = params.repo if (repo === 'corifeus' && repo === location.pathname.slice(1)) { return this.navigate('matrix') } this.currentRepo = repo if (params.repo === undefined) { this.currentRepo = this.settings.github.defaultRepo; } this.load(); /* if (!location.pathname.endsWith('.html')) { this.navigate(); } */ }) ) } ngOnInit() { this.debounceSearchText = debounce(this.handleSearch, this.settings.debounce.default) } handleSearch(searchText: string) { this.searchText = searchText.trim(); } get reposSearch(): Array { if (this.searchText === '' || this.searchText === undefined) { return this.repos; } const regexes: Array = []; this.searchText.split(/[\s,]+/).forEach(search => { if (search === '') { return; } regexes.push( new RegExp('.*' + search + '.*', 'i') ) }) return Object.values(this.packages).filter( (pkg: any) => { let found = false; for (let regex of regexes) { if (regex.test(pkg.name) || regex.test(pkg.corifeus.reponame) || regex.test(pkg.corifeus.code)) { found = true; break; } } return found; }).map((pkg : any) => pkg.corifeus.reponame) } async load() { if (this.packages === undefined) { const response: any = await this.http.get(this.settings.p3x.git.url).toPromise() this.packages = response.repo; let sortedObject = {} sortedObject = Object.keys(this.packages).sort((a, b) => { return this.packages[b].corifeus.stargazers_count - this.packages[a].corifeus.stargazers_count }).reduce((prev, curr, i) => { prev[i] = this.packages[curr] return prev }, {}) this.packages = {}; Object.keys(sortedObject).forEach(key => { const item = sortedObject[key] if (item.corifeus.prefix !== undefined) { this.packages[item.name.substr(item.corifeus.prefix.length)] = item; } else { this.packages[item.name] = item; } }) this.ref.markForCheck() this.repos = Object.keys(this.packages); } if (!this.packages.hasOwnProperty(this.currentRepo)) { this.currentRepo = 'corifeus'; } this.packageJson = this.packages[this.currentRepo]; this.title = this.packageJson.description; this.icon = this.packageJson.corifeus.icon !== undefined ? `${this.packageJson.corifeus.icon}` : 'fas fa-bolt'; document.title = this.title.replace(emojiRegex(), ''); this.noScript.innerHTML = ''; this.repos.forEach((repo: any) => { const a = document.createElement('a'); a.href = `/${repo === 'corifeus' ? 'matrix' : repo}`; a.innerText = repo; this.noScript.appendChild(a) const a2 = document.createElement('a'); a2.href = `https://github.com/patrikx3/${repo}`; a2.innerText = 'Github ' + repo; this.noScript.appendChild(a2) }) window.coryAppWebPagesNavigate = (path?: string) => { this.zone.run(() => { if (path.includes('#')) { const hashIndex = path.indexOf('#') const pathMainPath = path.substring(0, hashIndex) const hash = path.substring(hashIndex + 1) this.navigate(pathMainPath); window.coryAppWebPagesNavigateHash(hash) } else { this.navigate(path); } }); }; window.coryAppWebPagesNavigateHash = (id: any) => { const scroll = (id: string) => { const el = document.getElementById(id); if (el === null) { return; } el.scrollIntoView({ block: "center", }) } if (typeof id === 'string') { const hash = `#${id.replace(/-parent$/, '')}`; if (history.pushState) { history.pushState(null, null, `${location.pathname}${hash}`); } else { location.hash = hash; } scroll(id); } else { id = `${id.id}`; setTimeout(() => { scroll(id) }, 500) } return false; } } async navigate(path?: string) { if (path === undefined) { path = `${this.currentRepo}/index.html`; } //FIXME corifeus - matrix //console.log(' ') //console.log(path) if (regexFixCorifeusMatrix.test(path)) { path = path.replace(regexFixCorifeusMatrix, 'matrix$3$5') //console.log(1, RegExp.$1, 2, RegExp.$2, 3, RegExp.$3, 4, RegExp.$4, 5, RegExp.$5, 6, RegExp.$6, 7, RegExp.$7) //console.log('match', path) } this.menuMenuActive = ''; //console.log('cory-layout', path); this.router.navigateTop([path]); } isOpenWrt() { return this.packageJson !== undefined && this.packageJson.corifeus !== undefined && this.packageJson.corifeus.hasOwnProperty('type') && this.packageJson.corifeus.type === 'openwrt'; } packageMenuClose() { // this.body.style.overflowY = 'auto'; this.menuSidenav.close(); } packageMenuOpen() { // this.body.style.overflowY = 'hidden'; this.menuSidenav.open(); setTimeout(() => { if (this.isMobile) { this.searchTextInputRefRead.nativeElement.blur() } // /** const e = document.querySelector('.cory-mat-menu-item-active') if (e) { // e.scrollIntoView(true); // const viewportH = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); // window.scrollBy(0, (e.getBoundingClientRect().height-viewportH)/2); e.scrollIntoView({ block: "center", }); } // **/ }, 500) } search(searchText: string) { this.debounceSearchText(searchText); } getDescription(title: string) { return !title ? title : this.sanitizer.bypassSecurityTrustHtml(twemoji.parse(title, { folder: 'svg', ext: '.svg', })) } renderTwemoji(text: string) { return !text ? text : this.sanitizer.bypassSecurityTrustHtml(twemoji.parse(text, { folder: 'svg', ext: '.svg', })) } keyDownFunction(event: any) { const repos = this.reposSearch; if (event.keyCode == 13 && repos.length === 1) { this.zone.run(() => { const navigate = `/${repos[0]}/index.html` this.debounceSearchText(''); this.searchTextInputRefRead.nativeElement.blur() this.searchTextInputRefRead.nativeElement.value = ''; this.packageMenuClose(); this.navigate(navigate); }); } } get showTitle() { const pathname = location.pathname.toLowerCase() const pieces = pathname.split('/') // console.log(pieces) const showTitle = pieces.length === 2 || (pieces.length === 3 && pieces[2] === 'index.html') // const showTitle = pathname.endsWith('index.html') || (!pathname.includes('.') && !pathname.includes('open-collective')); return showTitle; } get counter() { return window.corifeus.core.http.counter; } extractTitleWithStars(pkg: any) { const title = extractTitleWithStars(pkg); return title; } extractStars(stars: number) { return extractStars(stars) } ngOnDestroy(): void { this.subscriptions$.forEach(subs$ => subs$.unsubscribe()) } } src/angular/modules/github/layout/footer/000077500000000000000000000000001517657424700210655ustar00rootroot00000000000000src/angular/modules/github/layout/footer/cory-layout-footer.html000066400000000000000000000047731517657424700255510ustar00rootroot00000000000000 src/angular/modules/github/layout/footer/cory-layout-footer.scss000066400000000000000000000007521517657424700255510ustar00rootroot00000000000000cory-layout-footer { .cory-mat-footer { .cory-layout-footer-container { position: relative; top: -3px; } } .cory-pages-footer-shrink-text { @media screen and (min-width: 600px) and (max-width: 840px) { display: none !important; } } .cory-pages-footer-shrink-icon { @media screen and (min-width: 600px) and (max-width: 840px) { min-width: 0px !important; } } } src/angular/modules/github/layout/footer/cory-layout-footer.ts000066400000000000000000000107751517657424700252320ustar00rootroot00000000000000import { Component, Injectable, Host, OnDestroy, } from '@angular/core'; import { DomSanitizer, SafeUrl, } from '@angular/platform-browser'; import { Subscription } from 'rxjs' import { LocaleService, SettingsService, LocaleSubject, decodeEntities, MediaQueryService, MediaQuerySettingType, MediaQuerySetting } from "corifeus-web"; import {NotifyService, ThemeService} from 'corifeus-web-material'; import {Layout} from "../cory-layout"; class Tooltip { GitHub: string = ''; Npm: string = ''; Translation: string = ''; Theme: string = ''; Developer: string = ''; JetBrains: string = ''; } @Component({ selector: 'cory-layout-footer', templateUrl: 'cory-layout-footer.html', }) @Injectable() export class Footer implements OnDestroy { subscriptions$: Array = [] unsubscribeMediaQuery : Function npmSvg: SafeUrl; jetbrainsSvg: SafeUrl; settings: any; i18n: any; linkJetBrains: string = "https://www.jetbrains.com/?from=patrikx3" decodeEntities: Function = decodeEntities; tooltip: Tooltip = new Tooltip() tooltipPosition: string = 'left' currentWidthAlias: string; currentYear = new Date().getFullYear(); constructor( private notify: NotifyService, private theme: ThemeService, protected locale: LocaleService, protected settingsAll: SettingsService, private mediaQuery: MediaQueryService, private domSanitizer: DomSanitizer, public parent: Layout, ) { this.settings = settingsAll.data.pages; const npmSvg = require('../../../../../assets/npm-logo.svg') const jetbrainsSvg = require('../../../../../assets/jetbrains-logo.svg') this.npmSvg = this.domSanitizer.bypassSecurityTrustUrl(npmSvg.default) this.jetbrainsSvg = this.domSanitizer.bypassSecurityTrustUrl(jetbrainsSvg.default) this.subscriptions$.push( this.locale.subscribe((data: LocaleSubject) => { this.i18n = data.locale.data; this.setTooltip(); }) ) this.unsubscribeMediaQuery = this.mediaQuery.register([ { name: 'pages-small', min: 0, max: 599, type: MediaQuerySettingType.Width }, { name: 'pages-medium', min: 600, max: 840, type: MediaQuerySettingType.Width }, { name: 'pages-large', min: 841, max: Infinity, type: MediaQuerySettingType.Width }, ]) this.subscriptions$.push( this.mediaQuery.subscribe((settings: MediaQuerySetting[]) => { settings.forEach((setting) => this.setTooltip(setting.name)) }) ) } private setTooltip(alias?: string) { if (alias !== undefined) { this.currentWidthAlias = alias; } switch (this.currentWidthAlias) { case 'pages-small': this.tooltip.GitHub = 'GitHub'; this.tooltip.Npm = 'NPM'; this.tooltip.Developer = decodeEntities(this.i18n.pages.title.developer + ' ' + this.currentYear); this.tooltip.JetBrains = decodeEntities(this.i18n.pages.title.sponsor.jetbrains); break; case 'pages-medium': this.tooltip.GitHub = ""; this.tooltip.Npm = ""; this.tooltip.Developer = decodeEntities(this.i18n.pages.title.developer + ' ' + this.currentYear); this.tooltip.JetBrains = decodeEntities(this.i18n.pages.title.sponsor.jetbrains); break; case 'pages-large': default: this.tooltip.GitHub = ""; this.tooltip.Npm = ""; this.tooltip.Developer = ""; this.tooltip.JetBrains = ""; break; } } public get linkDeveloper() { return `http://patrikx3.com/${this.locale.current}`; } public get linkNpm() { return `https://www.npmjs.com/package/${this.parent.packageJson.name}`; } public get linkGithub() { return `https://github.com/patrikx3/${this.parent.currentRepo}`; } ngOnDestroy(): void { this.unsubscribeMediaQuery() this.subscriptions$.forEach(subs$ => subs$.unsubscribe()) } } src/angular/modules/github/layout/header/000077500000000000000000000000001517657424700210175ustar00rootroot00000000000000src/angular/modules/github/layout/header/cory-layout-header.html000066400000000000000000000110321517657424700254170ustar00rootroot00000000000000
{{ this.settings.github.repoNames }} {{ parent.packageJson.corifeus.type }} {{ parent.packageJson.corifeus.code }}
src/angular/modules/github/layout/header/cory-layout-header.scss000066400000000000000000000017251517657424700254360ustar00rootroot00000000000000.cory-layout-header-top { opacity: 0.5; font-size: 12px; position: relative; top: 19px; left: -55px; z-index: 10; .cory-layout-header-top-p3x { text-transform: uppercase; } @media screen and (max-width: $cory-mat-size-small) { top: 15px; } } .cory-layout-header-title { font-size: 30px !important; overflow: hidden; text-overflow: ellipsis; position: relative; top: -5px; @media screen and (max-width: 800px) { font-size: 16px !important; } } /* @media screen and (max-width: 700px) { font-size: 16px !important; } */ .cory-pages-layout-header-title { margin-left: 5px; display: inline-block; text-overflow: ellipsis; white-space: nowrap; overflow: hidden; @media screen and (min-width: 400px) and (max-width: 1000px) { max-width: 500px !important; } @media screen and (max-width: 399px) { max-width: 220px !important; } } src/angular/modules/github/layout/header/cory-layout-header.ts000066400000000000000000000032321517657424700251040ustar00rootroot00000000000000import { Component, Host, OnDestroy, } from '@angular/core'; const capitalize = require('lodash/capitalize'); import { Router, } from '@angular/router'; import {LocaleService, SettingsService, LocaleSubject} from "corifeus-web"; import {extractTitle} from '../../utils/extrac-title'; import {Layout} from "../cory-layout"; import { Subscription } from 'rxjs' @Component({ selector: 'cory-layout-header', templateUrl: 'cory-layout-header.html', }) export class Header implements OnDestroy { subscriptions$: Array = [] header: string; i18n: any; settings: any; extractTitle = extractTitle; constructor( private router: Router, protected locale: LocaleService, protected settingsAll: SettingsService, public parent: Layout, ) { this.settings = settingsAll.data.pages; this.subscriptions$.push( this.locale.subscribe((data: LocaleSubject) => { this.i18n = data.locale.data; }) ) this.header = capitalize(this.settings.github.repoNames); } linkExternal(link: string) { return link.startsWith('http'); } navigateMenu(link: string) { if (this.linkExternal(link)) { return window.open(link); } this.parent.navigate('/' + this.parent.currentRepo + '/' + link); } generateIcon() { return ``; } extractTitleWithStars(pkg: any) { return this.parent.extractTitleWithStars(pkg); } ngOnDestroy(): void { this.subscriptions$.forEach(subs$ => subs$.unsubscribe()) } } src/angular/modules/github/layout/index.ts000066400000000000000000000002161517657424700212450ustar00rootroot00000000000000export {Header} from "./header/cory-layout-header"; export {Footer} from "./footer/cory-layout-footer"; export {Layout} from "./cory-layout"; src/angular/modules/github/page/000077500000000000000000000000001517657424700171665ustar00rootroot00000000000000src/angular/modules/github/page/cory-open-collective.ts000066400000000000000000000102101517657424700235720ustar00rootroot00000000000000import { Component, Host, AfterContentChecked, OnDestroy, } from '@angular/core'; import {DomSanitizer, SafeHtml} from '@angular/platform-browser'; import {LocaleService, LocaleSubject} from "corifeus-web"; import {Layout} from "../layout"; const twemoji = require('twemoji').default; import { Subscription } from 'rxjs' @Component({ selector: 'cory-open-collective', template: `

{{ i18n.opencollective.contributors}}

{{ i18n.opencollective.contributorsMessage }}

{{ i18n.opencollective.backers}}

{{ i18n.opencollective.backersMessage }}

  {{ i18n.opencollective.backersLink}}

{{ i18n.opencollective.sponsors}}

{{ i18n.opencollective.sponsorsMessage }}

  {{ i18n.opencollective.sponsorsMessageLink }}
` }) export class OpenCollective implements AfterContentChecked, OnDestroy { subscriptions$: Array = [] public pkg: any; public twemojiPraise: SafeHtml; i18n: any constructor( public sanitize: DomSanitizer, protected locale: LocaleService, private parent: Layout, ) { this.twemojiPraise = sanitize.bypassSecurityTrustHtml(twemoji.parse('🙏', { folder: 'svg', ext: '.svg', })) this.subscriptions$.push( this.locale.subscribe((subject: LocaleSubject) => { this.i18n = subject.locale.data.pages }) ) } ngAfterContentChecked() { this.pkg = this.parent.packageJson; } ngOnDestroy(): void { this.subscriptions$.forEach(subs$ => subs$.unsubscribe()) } } src/angular/modules/github/page/cory-page.ts000066400000000000000000000122741517657424700214320ustar00rootroot00000000000000import { Component, Host, NgZone, AfterViewChecked, OnDestroy, } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser' import { Subscription } from 'rxjs' import { ActivatedRoute, NavigationStart, NavigationEnd, } from '@angular/router'; import {HttpClient} from '@angular/common/http'; import {RouterService} from 'corifeus-web'; import { Layout} from "../layout"; import {CdnService, MarkdownService} from '../service'; import {SettingsService, LocaleService} from 'corifeus-web'; import {State} from 'corifeus-web'; import { NotifyService } from 'corifeus-web-material'; const cache = {} let testing = false @Component({ selector: 'cory-page', template: ` ` }) export class Page implements AfterViewChecked, OnDestroy { subscriptions$: Array = [] loaded: boolean = false; content: any; //parent: any; constructor( private markdown: MarkdownService, private cdn: CdnService, private router: RouterService, private activatedRoute: ActivatedRoute, public http: HttpClient, private settings: SettingsService, private zone: NgZone, protected notify: NotifyService, protected locale: LocaleService, private _sanitizer: DomSanitizer, private parent: Layout, ) { this.markdown.context = this; // this.parent = Globals.layout let currentUrlPathTimeout: any; let usingActivatedUrl = true; this.subscriptions$.push( this.router.events.subscribe(event => { if (event instanceof NavigationStart) { usingActivatedUrl = false; //const urlPath = event.url.substr(1) clearTimeout(currentUrlPathTimeout); currentUrlPathTimeout = setTimeout(() => { // console.log('router', urlPath, 'usingActivatedUrl', usingActivatedUrl); if (usingActivatedUrl === false) { usingActivatedUrl = true; // console.log('have to navigate', urlPath) this.navigate() } }, 250) } }) ) this.subscriptions$.push( this.activatedRoute.url.subscribe((segment) => { usingActivatedUrl = true; const path = segment.join('/'); // console.log('update activated route', path) this.navigate(path); }) ) } async navigate(path?: string) { if (path === undefined || path === '') { path = `index.html`; } try { const cacheKey = JSON.stringify({ repo: this.parent.currentRepo, path: path }) if (cache.hasOwnProperty(cacheKey)) { this.content = cache[cacheKey] return } State.NotFound = false; window.corifeus.core.http.status = 200; let text = await this.cdn.file(this.parent.currentRepo, path); const pathLower = path.toLowerCase() if (pathLower.endsWith('.json')) { text = ` \`\`\`json ${text} \`\`\` ` } else if (pathLower.endsWith('.yml')) { text = ` \`\`\`yaml ${text} \`\`\` ` } else if (pathLower.endsWith('.conf')) { text = ` \`\`\`nginxconf ${text} \`\`\` ` } const html = await this.markdown.render(text, this.parent, pathLower); cache[cacheKey] = html this.content = html } catch (e) { //this.router.navigateTop(['/github/corifeus/404']); State.NotFound = true; window.corifeus.core.http.status = 404; this.content = `
404
${this.locale.data.material.http['404']}
${location.toString()}

${e.message}
` console.error(e); } finally { } } ngAfterViewChecked() { // const e = document.querySelector(`${decodeURI(location.hash)}-parent`); const e = document.querySelector(`${location.hash}-parent`); if (!this.loaded && e) { this.loaded = true; e.scrollIntoView({ block: "center", }) } if (!testing) { testing = true; this.notify.info(this.parent.i18n.title.ready) } } transformHtml(html: string): any { return this._sanitizer.bypassSecurityTrustHtml(html); } ngOnDestroy(): void { this.subscriptions$.forEach(subs$ => subs$.unsubscribe()) } } src/angular/modules/github/page/index.ts000066400000000000000000000001051517657424700206410ustar00rootroot00000000000000export * from "./cory-page"; export * from "./cory-open-collective"; src/angular/modules/github/service/000077500000000000000000000000001517657424700177125ustar00rootroot00000000000000src/angular/modules/github/service/cdn.ts000066400000000000000000000017711517657424700210340ustar00rootroot00000000000000import {Injectable} from '@angular/core'; import {HttpClient} from '@angular/common/http'; import {SettingsService} from 'corifeus-web'; @Injectable() export class CdnService { private settings: any; constructor(private http: HttpClient, private settingsAll: SettingsService) { this.settings = settingsAll.data.pages; } async file(repo: string, path: string) { const postfix = '.html'; //FIXME corifeus - matrix if (repo === 'matrix') { repo = 'corifeus' } const index = `index${postfix}`; if (path.endsWith(index)) { path = path.substr(0, path.length - index.length) + 'README.md'; } if (path.endsWith(postfix)) { path = path.substr(0, path.length - postfix.length) + '.md'; } const url = `https://cdn.corifeus.com/git/${repo}/${path}`; const text = await this.http.get(url, {responseType: 'text'}).toPromise(); return text; } } src/angular/modules/github/service/index.ts000066400000000000000000000001201517657424700213620ustar00rootroot00000000000000export {CdnService} from "./cdn"; export {MarkdownService} from "./markdown"; src/angular/modules/github/service/markdown.ts000066400000000000000000000034641517657424700221130ustar00rootroot00000000000000import {Injectable} from '@angular/core'; import {Layout} from '../layout/cory-layout'; const Worker = require(`../../../../worker/markdown.worker`); const worker = new Worker(); const nextId = require('../utils/next-id.js') @Injectable() export class MarkdownService { public context: any; layout: Layout; constructor() { } public render(md: string, layout: Layout, path: string) { this.layout = layout; return new Promise(async(resolve, reject) => { const requestId = nextId() const message = (event: any) => { if (event.data.requestId === requestId) { worker.removeEventListener('message', message) if (event.data.success === true) { resolve(event.data.html) } else { reject(new Error(event.data.errorMessage)); } } } worker.addEventListener('message', message) if (this.layout.packages === undefined) { await new Promise(resolve => { const wait = () => { console.info('waiting for github repo packages') if (this.layout.packages === undefined) { setTimeout(wait, 100) } else { resolve() } } wait() }) } worker.postMessage({ md: md, settings: this.context.settings.data, currentRepo: this.layout.currentRepo, packages: this.layout.packages, requestId: requestId, path: path, }); }) } } src/angular/modules/github/utils/000077500000000000000000000000001517657424700174125ustar00rootroot00000000000000src/angular/modules/github/utils/extrac-title.ts000066400000000000000000000035041517657424700223710ustar00rootroot00000000000000const cache = {}; const { extractStars } = require("../../../../helper/extract-stars.function.js"); export function extractTitle(pkg: any): string { if (pkg === undefined) { return ''; } if (pkg.name === undefined) { return ''; } if (cache.hasOwnProperty(pkg.name)) { return cache[pkg.name]; } if (pkg.name === 'corifeus') { cache[pkg.name] = 'Corifeus'; return cache[pkg.name]; } if (pkg.name.startsWith('grunt')) { let result = pkg.name.split('-').map((word: string) => { return word[0].toUpperCase() + word.substr(1) }); result = result.slice(); result.splice(1, 1); cache[pkg.name] = result.join(' '); return cache[pkg.name]; } else { let result: string = pkg.name.split('-').map((word: string) => { return word[0].toUpperCase() + word.substr(1) }).slice(1).join(' '); if (result !== undefined && result.startsWith('Openwrt')) { result = result.replace('Openwrt', 'OpenWrt') } result = result.split(' ').map((elem: string) => { if (elem.length === 2) { elem = elem.toUpperCase() } else if (elem.toLowerCase() === 'pdf') { elem = elem.toUpperCase() } else if (elem.endsWith('db')) { elem = elem.substr(0, elem.length - 2) + 'DB' } return elem }).join(' ') cache[pkg.name] = result; return cache[pkg.name]; } } export function extractTitleWithStars(pkg: any): string { let title = extractTitle(pkg); if (pkg !== undefined && pkg !== null && pkg.corifeus.stargazers_count < 1) { return title } return `${title} ⭐${extractStars(pkg.corifeus.stargazers_count)}`; } export { extractStars } src/angular/modules/github/utils/is-mobile.ts000066400000000000000000000002301517657424700216350ustar00rootroot00000000000000export function isMobile() { try { document.createEvent("TouchEvent"); return true; } catch (e) { return false; } } src/angular/modules/github/utils/next-id.js000066400000000000000000000014211517657424700213160ustar00rootroot00000000000000let currentId = 0 let currentIdTime = Date.now() const random = () => { return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16) } const reverse = function (str) { return str.split('').reverse().join('') } const nextId = () => { const now = Date.now(); if (currentIdTime !== now) { currentId = 0; currentIdTime = now } const comingId = ++currentId; const randomHex = reverse(random()).padStart(15, '0'); const timeHex = reverse(currentIdTime.toString(16).padStart(12, '0')) const comingIdHex = reverse(comingId.toString(16).padStart(3, '0')); const newId = `P3Xid${timeHex}${comingIdHex}${randomHex}`; //console.log(newId) return newId } module.exports = nextId src/angular/polyfills.ts000066400000000000000000000000451517657424700157040ustar00rootroot00000000000000import 'corifeus-web/src/polyfills'; src/assets/000077500000000000000000000000001517657424700131715ustar00rootroot00000000000000src/assets/_settings.scss000066400000000000000000000006241517657424700160670ustar00rootroot00000000000000$cory-layout-settings-debounce-default: 250; $cory-layout-settings-defaultDomain: "corifeus.com" , "www.corifeus.com"; $cory-layout-settings-p3x-git-url: "https://server.patrikx3.com/api/patrikx3/git/repos"; $cory-layout-settings-p3x-git-url-test: "https://localhost:23501/api/patrikx3/git/repos"; $cory-layout-settings-github-defaultRepo: "corifeus"; $cory-layout-settings-github-repoNames: "corifeus"; src/assets/_variables.scss000066400000000000000000000002101517657424700161660ustar00rootroot00000000000000$cory-layout-fixed-zindex: 0; $cory-layout-fixed-height: 85px; $cory-layout-fixed-height-collapsed: 45px; $cory-layout-padding: 20px; src/assets/jetbrains-logo.svg000066400000000000000000000100531517657424700166300ustar00rootroot00000000000000 src/assets/npm-logo.svg000066400000000000000000000012111517657424700154350ustar00rootroot00000000000000 src/assets/style.scss000066400000000000000000000102021517657424700152210ustar00rootroot00000000000000@import "_variables"; @import '~corifeus-web-material/src/scss/all'; @import '~@angular/material/theming'; img.emoji { height: 1em; width: 1em; margin: 0 .05em 0 .1em; vertical-align: -0.1em; } .cory-layout-title { font-size: 250%; font-weight: bold; } .cory-mat-theme-light { @import 'CSS:../../node_modules/highlight.js/styles/github'; .cory-layout-title { text-shadow: 2px 2px rgba(0, 0, 0, 0.5); } } .cory-mat-theme-dark { @import 'CSS:../../node_modules/highlight.js/styles/vs2015'; .cory-layout-title { text-shadow: 2px 2px rgba(255, 255, 255, 0.5); } } .cory-mat-theme-dark-matrix { .cory-layout-title { text-shadow: 2px 2px rgba(0, 255, 0, 0.5); } } img { max-width: 100%; height: auto; } .mat-toolbar { @media screen and (max-width: $cory-mat-size-xsmall) { padding-left: 0px !important; padding-right: 0px !important; } } a code { font-weight: bold; } .cory-layout-fa { font-size: 23px !important; } .cory-mat-footer { .mat-button { text-overflow: ellipsis; // overflow: hidden; } } .cory-mat-header, .cory-mat-footer { height: 56px !important; @media screen and (max-width: $cory-mat-size-xsmall) { .mat-button { $padding: 8px; min-width: 24px !important; padding-left: $padding; padding-right: $padding; } }; } .cory-mat-theme-light { .cory-mat-header { border-bottom: 5px solid rgba(0, 0, 0, 0.1); } .cory-mat-footer { border-top: 5px solid rgba(0, 0, 0, 0.1); } .cory-mat-header, .cory-mat-footer { box-shadow: 0px 0px 100px 10px rgba(0, 0, 0, 0.25); } } .cory-mat-theme-dark { .cory-mat-header { border-bottom: 5px solid rgba(255, 255, 255, 0.1); } .cory-mat-footer { border-top: 5px solid rgba(255, 255, 255, 0.1); } .cory-mat-header, .cory-mat-footer { box-shadow: 0px 0px 100px 10px rgba(255, 255, 255, 0.15); } } .cory-mat-theme-dark-matrix { .cory-mat-header { border-bottom: 5px solid rgba(0, 0, 0, 0.4); } .cory-mat-footer { border-top: 5px solid rgba(0, 0, 0, 0.4); } } .cory-layout-link-external { .fas, .fab, .far { opacity: 0.5; } &:hover { .fas, .fab, .far { opacity: 1; } } } /* .cory-layout-container-fixed { margin-top: $cory-mat-fixed-height-collapsed; margin-bottom: $cory-mat-fixed-height-collapsed; @media screen and (min-width: $cory-mat-size-xsmall) { margin-top: $cory-mat-fixed-height; margin-bottom: $cory-mat-fixed-height; } @media screen and (min-width: $cory-mat-size-medium) { width: $cory-mat-size-medium - 100; margin-left: auto; margin-right: auto; }; } */ .cory-layout-markdown-reference { /// float: right; display: none; } .cory-layout-markdown-header:hover > a { display: inline; } .cory-layout-sidenav-search { $padding: 15px; padding-left: $padding; padding-right: $padding; } .cory-layout-sidenav-container { background: none !important; position: absolute; z-index: 1; top: 0px; left: 0px; width: 100%; height: 100%; padding-top: $cory-mat-fixed-height-collapsed; padding-bottom: $cory-mat-fixed-height-collapsed; @media screen and (min-width: $cory-mat-size-xsmall) { // padding-top: $cory-mat-fixed-height-top; // padding-bottom: $cory-mat-fixed-height-bottom; } @media screen and (min-width: $cory-mat-size-medium) { margin-left: auto; margin-right: auto; padding-left: auto; padding-right: auto; }; } .cory-pages-menu-effect { opacity: 0.75; } .cory-pages-menu-effect:hover { opacity: 1; } hr { border-style: solid; opacity: 0.2; } //corifeus-inject @import '../angular/modules/github/layout/cory-layout.scss'; @import '../angular/modules/github/layout/footer/cory-layout-footer.scss'; @import '../angular/modules/github/layout/header/cory-layout-header.scss'; //corifeus-inject:end src/helper/000077500000000000000000000000001517657424700131465ustar00rootroot00000000000000src/helper/extract-stars.function.js000066400000000000000000000004131517657424700201320ustar00rootroot00000000000000module.exports.extractStars = (stars) => { if (stars >= 1000) { const starsCount = parseFloat((stars / 1000).toFixed(1)) return ( starsCount === Math.ceil(starsCount) ? starsCount.toFixed(0) : starsCount.toFixed(1)) + 'k' } return stars } src/index.html000066400000000000000000000034131517657424700136650ustar00rootroot00000000000000 p3x
src/public/000077500000000000000000000000001517657424700131455ustar00rootroot00000000000000src/public/apple-app-site-association000066400000000000000000000000021517657424700202130ust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KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI\KI]JHM]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI\KI]KI ]KII]KI]KI]KI]KI]KI]KI]KI]KI]KI]KHC]KI)]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]JI]KIg]KI ]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI ]KI-]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI#]KI]KI]KI]KI]KI]KI]KI]KHu]KIk]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]JIm]KIc]KI]KI]KI]KI]KI]KI]KI!]KI \KIk]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI]KI%]KI]KI]KI]KI]KI]KI]KI]KI ]KI]KIo\KI]KI]KI]KI]KI]KI]KI]KI]KI]KH]KI]KI]KI/]JI]KI]KI\JH]KHa]KH ]KIk]KI]KI]KI]KI]KI]KI]KI]KI]KH]KI5]KI]KI]KI]KI]KI]KI\JH]KIo]KI]KI]KI]KI]KI]KI]KI]KH]JH%]KI]KI]KI\JH]KIk\KI]KI]KI]KI]KI]KI]KI;]KI]KI]KI ]KH ]KIo]KI]KI]KI]KI]KI\KH]KI\KIk]KI]KI]KI]KIG]KI ]KIc\KI]KI\JI src/public/onnokfm6.txt000066400000000000000000000000031517657424700154340ustar00rootroot00000000000000ok src/public/robots.txt000066400000000000000000000000261517657424700152140ustar00rootroot00000000000000User-agent: * Allow: /src/worker/000077500000000000000000000000001517657424700132005ustar00rootroot00000000000000src/worker/markdown.worker.js000066400000000000000000000246641517657424700167040ustar00rootroot00000000000000import {kebabCase} from 'lodash'; const { extractStars} = require('../helper/extract-stars.function.js'); let currentRepo, settings, currentRepoPath let locationOrigin, locationPathname, locationHref, locationHostname function htmlStrip(html) { // const tmp = document.createElement("DIV"); // tmp.innerHTML = html; // return tmp.textContent || tmp.innerText || ""; return html.replace(/<\/?[^>]+(>|$)/g, ""); } const notifyMissingMarkdownCode = ({ code, language, currentRepo, currentRepoPath, coreUrl}) => { const url = `${coreUrl}/api/patrikx3/git/notify-markdown-error` fetch(url, { method: 'POST', // *GET, POST, PUT, DELETE, etc. // mode: 'cors', // no-cors, *cors, same-origin // cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached // credentials: 'same-origin', // include, *same-origin, omit headers: { 'Content-Type': 'application/json' // 'Content-Type': 'application/x-www-form-urlencoded', }, // redirect: 'follow', // manual, *follow, error // referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url body: JSON.stringify({ info: ` Repo: ${currentRepo}
Path: ${currentRepoPath}
Code:
${code}

Language: ${language}
` }) // body data type must match "Content-Type" header }).then(response => { if (response.status !== 200) { console.error(response) } }).catch(e => { console.error(e) }) } const IsBot = require('corifeus-web/src/util/is-bot.js') const hljs = require('highlight.js'); hljs.registerLanguage('conf', require('highlight.js/lib/languages/nginx.js')); // this is for HTML as well hljs.registerLanguage('xml', require('highlight.js/lib/languages/xml.js')); hljs.registerLanguage('css', require('highlight.js/lib/languages/css.js')); hljs.registerLanguage('scss', require('highlight.js/lib/languages/scss.js')); hljs.registerLanguage('yaml', require('highlight.js/lib/languages/yaml.js')); hljs.registerLanguage('yml', require('highlight.js/lib/languages/yaml.js')); hljs.registerLanguage('powershell', require('highlight.js/lib/languages/powershell.js')); hljs.registerLanguage('javascript', require('highlight.js/lib/languages/javascript.js')); hljs.registerLanguage('js', require('highlight.js/lib/languages/javascript.js')); hljs.registerLanguage('json', require('highlight.js/lib/languages/json.js')); hljs.registerLanguage('bash', require('highlight.js/lib/languages/shell.js')); hljs.registerLanguage('typescript', require('highlight.js/lib/languages/typescript.js')); hljs.registerLanguage('ts', require('highlight.js/lib/languages/typescript.js')); hljs.registerLanguage('ini', require('highlight.js/lib/languages/ini.js')); const twemoji = require('twemoji').default; if (process.env === 'production') { twemoji.base = '/assets/twemoji/'; } const marked = require('marked') const markdownRenderer = new marked.Renderer(); const extract = (template, area) => { // [//]: #@corifeus-header // [//]: #corifeus-header:end // [//]: #@corifeus-footer // [//]: #@corifeus-footer:end const start = `[//]: #@${area}`; const end = `[//]: #@${area}:end`; const startIndex = template.indexOf(start); const endIndex = template.indexOf(end); //console.log('start', start, startIndex) //console.log('end', end, endIndex) let result = template.substring(0, startIndex + start.length); result += template.substring(endIndex + end.length); return result; } markdownRenderer.heading = (text, level, raw) => { // console.log('text', text,) // console.log('raw', raw) const ref = kebabCase(htmlStrip(raw)).replace(/[^\x00-\xFF]/g, ""); // console.log('ref', ref) const id = `${ref}-parent`; //console.log(ref); let navClick = '' if (!IsBot()) { navClick = `onclick="return window.coryAppWebPagesNavigateHash('${id}');"`; } let element = `${text} `; // console.log('ref', ref) return element } markdownRenderer.image = (href, title, text) => { title = title || ''; text = text || ''; if (!href.startsWith('http')) { href = `https://cdn.corifeus.com/git/${currentRepo}/${href}`; } let result if (text.toLowerCase().trim() === 'link') { result = ``; } else { result = ` ${title} ${text} `; } return result; }; markdownRenderer.link = (href, title, text) => { let a; let tooltip = ''; if (title !== null && title !== undefined) { tooltip = `tooltip="${title}"`; } let fixed = false; let path; const testHref = href.toLowerCase(); const fixedUrl = () => { const url = new URL(href); href = url.pathname; path = `${href}`; fixed = true; //console.log('fixed') } if ((typeof testHref === 'string' && (testHref.startsWith('https://') || testHref.startsWith('http://'))) ) { const testUrl = new URL(testHref) for(let defaultDomain of settings.pages.defaultDomain) { if (testUrl.hostname === defaultDomain) { fixedUrl(); break; } } } else if (testHref.includes('localhost:8080')) { fixedUrl() } // console.log('href', href) if (!href.startsWith(locationOrigin) && (href.startsWith('https:/') || href.startsWith('http:/'))) { if (href.endsWith('#cory-non-external')) { a = `${text}`; } else { a = `${text} `; } } else { if (!fixed) { if (href.endsWith('.md')) { href = href.substr(0, href.length - 3) + '.html'; } if (href.startsWith(locationOrigin)) { path = `/${href.substring(locationOrigin.length + 1)}`; } else if (href.startsWith('./')) { let base = locationHref if (!base.includes('.')) { base = locationHref + '/'; } path = `${new URL(href, base).pathname}`; // console.log(path) } else { path = `/${currentRepo}/${href}`; } } // console.log(path) // this.context.parent.navigate const navClick = !IsBot() ? `onclick="window.coryAppWebPagesNavigate('${path}'); return false;"` : ''; a = `${text}`; // console.log(path); // console.log(a); } return a; } markdownRenderer.code = (code, language) => { if (language === undefined) { language = 'text'; } language = language.toLowerCase() // console.log('TEST', language, currentRepo, currentRepoPath, settings.core.server) if ((hljs.getLanguage(language) === 'undefined' || hljs.getLanguage(language) === undefined) && language !== 'text') { console.error(`Please add highlight.js as a language (could be a marked error as well, sometimes it thinks a language): ${language} We are not loading everything, since it is about 500kb`) notifyMissingMarkdownCode({ code, language, currentRepo, currentRepoPath, coreUrl: settings.core.server.url }) } language = language === 'text' || language === undefined ? 'html' : language; const validLang = !!(language && hljs.getLanguage(language)); const highlighted = validLang ? hljs.highlight(language, code).value : code; return `
${highlighted}
`; }; markdownRenderer.codespan = (code) => { const lang = 'html'; const highlighted = hljs.highlight(lang, code).value; return `${highlighted}`; } const construct = (data) => { currentRepo = data.currentRepo settings = data.settings locationOrigin = location.origin currentRepoPath = data.path locationPathname = location.pathname locationHref = location.href locationHostname = location.hostname let { md, packages, path } = data md = md.trim() md = extract(md, 'corifeus-header'); md = extract(md, 'corifeus-footer'); md = twemoji.parse(md, { folder: 'svg', ext: '.svg', }) let html = marked(md, { renderer: markdownRenderer }); html = html.replace(/{/g, '{').replace(/}/g, '}'); html = html.replace(/&/g, '&'); if (currentRepo === 'corifeus' && path === 'index.html') { //console.info('decorated corifeus index.html') for(let pkgName of Object.keys(packages)) { const pkg = packages[pkgName] if (pkg.corifeus.stargazers_count > 0) { const hiddenStars = ``; const stars = ` ${extractStars(pkg.corifeus.stargazers_count)}` const re = new RegExp(RegExp.escape(hiddenStars)); html = html.replace(re, stars) } } } else { //console.info('not decorated', currentRepo, path) } return html; } const escape = function (s) { return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); }; if (!RegExp.escape) { RegExp.escape = escape; } onmessage = function (e) { const data = { requestId: e.data.requestId } try { data.html = construct(e.data); data.success = true } catch (e) { console.error(e) data.success = false data.errorMessage = e.message } postMessage(data) } test/000077500000000000000000000000001517657424700120575ustar00rootroot00000000000000test/angualr-protractor/000077500000000000000000000000001517657424700157055ustar00rootroot00000000000000test/angualr-protractor/ci.js000066400000000000000000000000221517657424700166300ustar00rootroot00000000000000console.log('ci');test/angular-karma/000077500000000000000000000000001517657424700146015ustar00rootroot00000000000000test/angular-karma/test.js000066400000000000000000000010751517657424700161210ustar00rootroot00000000000000"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var testing_1 = require("@angular/core/testing"); var cory_layout_1 = require("../../src/angular/layout/cory-layout"); describe('Layout', function () { beforeEach(function () { testing_1.TestBed.configureTestingModule({ declarations: [cory_layout_1.Layout] }); }); it('should work', function () { // let fixture = TestBed.createComponent(Page); // expect(fixture.componentInstance instanceof Page).toBe(true, 'should create a Page'); }); }); test/angular-karma/test.ts000066400000000000000000000006771517657424700161420ustar00rootroot00000000000000import { TestBed } from '@angular/core/testing'; import { Layout } from '../../src/angular/modules/github/layout/cory-layout'; describe('Layout', () => { beforeEach(() => { TestBed.configureTestingModule({ declarations: [Layout]}); }); it ('should work', () => { // let fixture = TestBed.createComponent(Page); // expect(fixture.componentInstance instanceof Page).toBe(true, 'should create a Page'); }); }); tsconfig.aot.json000066400000000000000000000031701517657424700143720ustar00rootroot00000000000000{ "compilerOptions": { "rootDir": ".", "baseUrl": ".", "skipLibCheck": true, "outDir": "build/aot", "target": "es2018", "module": "esnext", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "lib": [ "es2018", "dom" ], "paths": { "corifeus-web-material": [ "build-modules/corifeus-web-material/index.ts" ], "corifeus-web": [ "build-modules/corifeus-web/index.ts" ], "corifeus-web-material/*": [ "build-modules/corifeus-web-material/*" ], "corifeus-web/*": [ "build-modules/corifeus-web/*" ] } }, "include": [ "build-modules/**/*", "src/angular/**/*", "test/angular-webpack/**/*" ], "exclude": [ "src-save", "*.worker.js", "src/angular/bundle.ts", "test/angular-webpack/angular/bundle.ts", "test/angular-karma", "build/browser", "node_modules/corifeus-web/test", "node_modules/corifeus-web-material/test" ], "angularCompilerOptions-save": { "annotationsAs": "decorators", "preserveWhitespaces": false }, "angularCompilerOptions": { "enableIvy": true, "strictMetadataEmit": true, "skipTemplateCodegen": true, "annotateForClosureCompiler": true } } tsconfig.json000066400000000000000000000020261517657424700136070ustar00rootroot00000000000000{ "compilerOptions": { "skipLibCheck": true, "baseUrl": "./", "target": "es2015", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "lib": [ "es2018", "dom" ], "paths": { "*": [ "node_modules/@types/*", "*" ] } }, "includes": [ "src/angular/**/*", "test/angular-webpack/**/*" ], "exclude": [ "src-save", "node_modules", "*.worker.js", "src/angular/bundle.aot.ts", "test/angular-karma", "test/angular-webpack/angular/bundle.aot.ts" ], "angularCompilerOptions-save": { "annotationsAs": "decorators", "preserveWhitespaces": false }, "angularCompilerOptions": { "enableIvy": false } }