This commit is contained in:
Mr. Stallion 2020-06-20 13:43:34 -05:00
parent 0fea2479a9
commit 9a77c0a856
11 changed files with 164 additions and 100 deletions

5
.run/Debug.run.xml Normal file
View File

@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Debug" type="ChromiumRemoteDebugType" factoryName="Chromium Remote" port="9229">
<method v="2" />
</configuration>
</component>

View File

@ -27,8 +27,11 @@ export function analyzeUrlTag(parser: BBCodeParser, param: string, content: stri
if(param.length > 0) { if(param.length > 0) {
url = param.trim(); url = param.trim();
if(content.length === 0) textContent = param; if(content.length === 0) textContent = param;
} else if(content.length > 0) url = content; } else if(content.length > 0) {
else { const m = content.match(/^\[url=?](.+)\[\/url]$/i);
url = m ? m[1] : content;
} else {
parser.warning('url tag contains no url.'); parser.warning('url tag contains no url.');
textContent = ''; textContent = '';
success = false; success = false;

View File

@ -128,6 +128,10 @@ export class BBCodeParser {
currentTag = this._currentTag = {tag: self.tag, line: this._line, column: this._column}; currentTag = this._currentTag = {tag: self.tag, line: this._line, column: this._column};
} }
let tagStart = -1, paramStart = -1, mark = start; let tagStart = -1, paramStart = -1, mark = start;
// @ts-ignore
let depth = 0;
for(let i = start; i < input.length; ++i) { for(let i = start; i < input.length; ++i) {
const c = input[i]; const c = input[i];
++this._column; ++this._column;
@ -136,64 +140,83 @@ export class BBCodeParser {
this._column = 1; this._column = 1;
} }
if(c === '[') { if(c === '[') {
tagStart = i; depth++;
paramStart = -1;
} else if(c === '=' && paramStart === -1) if (depth === 1) {
paramStart = i; tagStart = i;
else if(c === ']') { paramStart = -1;
const paramIndex = paramStart === -1 ? i : paramStart; } else {
let tagKey = input.substring(tagStart + 1, paramIndex).trim().toLowerCase(); console.log('Hit depth tagOpen', depth);
if(tagKey.length === 0) {
tagStart = -1;
continue;
} }
const param = paramStart > tagStart ? input.substring(paramStart + 1, i).trim() : ''; } else if(c === '=' && paramStart === -1) {
const close = tagKey[0] === '/'; if (depth <= 1) {
if(close) tagKey = tagKey.substr(1).trim(); paramStart = i;
if(this._tags[tagKey] === undefined) { } else {
tagStart = -1; console.log('Hit depth paramStart', depth);
continue;
} }
if(!close) { } else if(c === ']') {
const tag = this._tags[tagKey]!; depth--;
const allowed = isAllowed(tagKey);
if(parent !== undefined) { if (depth !== 0) {
parent.appendChild(document.createTextNode(input.substring(mark, allowed ? tagStart : i + 1))); console.log('Hit depth tagClose', depth);
mark = i + 1; }
}
if(!allowed || parent === undefined) { if (depth === 0) {
i = this.parse(input, i + 1, tag, parent, isAllowed); const paramIndex = paramStart === -1 ? i : paramStart;
mark = i + 1; let tagKey = input.substring(tagStart + 1, paramIndex).trim().toLowerCase();
if(tagKey.length === 0) {
tagStart = -1;
continue; continue;
} }
let element: HTMLElement | undefined; const param = paramStart > tagStart ? input.substring(paramStart + 1, i).trim() : '';
if(tag instanceof BBCodeTextTag) { const close = tagKey[0] === '/';
i = this.parse(input, i + 1, tag, undefined, isAllowed); if(close) tagKey = tagKey.substr(1).trim();
element = tag.createElement(this, parent, param, input.substring(mark, input.lastIndexOf('[', i))); if(this._tags[tagKey] === undefined) {
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1))); tagStart = -1;
} else { continue;
element = tag.createElement(this, parent, param, '');
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
if(!tag.noClosingTag)
i = this.parse(input, i + 1, tag, element !== undefined ? element : parent, isAllowed);
if(element === undefined)
parent.appendChild(document.createTextNode(input.substring(input.lastIndexOf('[', i), i + 1)));
} }
mark = i + 1; if(!close) {
this._currentTag = currentTag; const tag = this._tags[tagKey]!;
if(element === undefined) continue; const allowed = isAllowed(tagKey);
(<HTMLElement & {bbcodeTag: string}>element).bbcodeTag = tagKey; if(parent !== undefined) {
if(param.length > 0) (<HTMLElement & {bbcodeParam: string}>element).bbcodeParam = param; parent.appendChild(document.createTextNode(input.substring(mark, allowed ? tagStart : i + 1)));
} else if(self !== undefined) { //tslint:disable-line:curly mark = i + 1;
if(self.tag === tagKey) { }
if(parent !== undefined) if(!allowed || parent === undefined) {
parent.appendChild(document.createTextNode(input.substring(mark, selfAllowed ? tagStart : i + 1))); i = this.parse(input, i + 1, tag, parent, isAllowed);
return i;
} mark = i + 1;
if(!selfAllowed) return mark - 1; continue;
if(isAllowed(tagKey)) }
this.warning(`Unexpected closing ${tagKey} tag. Needed ${self.tag} tag instead.`); let element: HTMLElement | undefined;
} else if(isAllowed(tagKey)) this.warning(`Found closing ${tagKey} tag that was never opened.`); if(tag instanceof BBCodeTextTag) {
i = this.parse(input, i + 1, tag, undefined, isAllowed);
element = tag.createElement(this, parent, param, input.substring(mark, input.lastIndexOf('[', i)));
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
} else {
element = tag.createElement(this, parent, param, '');
if(element === undefined) parent.appendChild(document.createTextNode(input.substring(tagStart, i + 1)));
if(!tag.noClosingTag)
i = this.parse(input, i + 1, tag, element !== undefined ? element : parent, isAllowed);
if(element === undefined)
parent.appendChild(document.createTextNode(input.substring(input.lastIndexOf('[', i), i + 1)));
}
mark = i + 1;
this._currentTag = currentTag;
if(element === undefined) continue;
(<HTMLElement & {bbcodeTag: string}>element).bbcodeTag = tagKey;
if(param.length > 0) (<HTMLElement & {bbcodeParam: string}>element).bbcodeParam = param;
} else if(self !== undefined) { //tslint:disable-line:curly
if(self.tag === tagKey) {
if(parent !== undefined)
parent.appendChild(document.createTextNode(input.substring(mark, selfAllowed ? tagStart : i + 1)));
return i;
}
if(!selfAllowed) return mark - 1;
if(isAllowed(tagKey))
this.warning(`Unexpected closing ${tagKey} tag. Needed ${self.tag} tag instead.`);
} else if(isAllowed(tagKey)) this.warning(`Found closing ${tagKey} tag that was never opened.`);
}
} }
} }
if(mark < input.length && parent !== undefined) { if(mark < input.length && parent !== undefined) {

View File

@ -8,47 +8,74 @@
<link rel="stylesheet" type="text/css" media="screen" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}"> <link rel="stylesheet" type="text/css" media="screen" href="{{ '/assets/css/style.css?v=' | append: site.github.build_revision | relative_url }}">
<style> <style>
.mac_download_link { .download_link {
display: block; clear: both;
float: left; margin-left: 25px;
width: 45px;
height:45px;
text-indent: -5000px;
overflow: hidden;
background: url(assets/images/mac.png) no-repeat bottom left;
margin-left: 18px;
background-size: contain;
} }
.win_download_link { .download_link a {
display: block; color: #da9e0f;
float: left;
width: 45px;
height:45px;
text-indent: -5000px;
overflow: hidden;
background: url(assets/images/win.png) no-repeat bottom right;
background-size: contain;
} }
.mac_download_link:hover {
background: url(assets/images/mac.png) no-repeat top left; .download_link a:hover {
background-size: contain;
filter: brightness(1.2); filter: brightness(1.2);
} }
.win_download_link:hover {
background: url(assets/images/win.png) no-repeat top right; .download_link a i {
background-size: contain; float: left;
filter: brightness(1.2); width: 20px;
height: 20px;
padding-right: 5px;
display: inline-block;
} }
.download_link.mac a i {
background: url(assets/images/mac.png) no-repeat;
background-size: contain;
margin-top: -1px;
margin-left: -1px;
margin-right: 1px;
}
.download_link.win a i {
background: url(assets/images/win.png) no-repeat;
background-size: contain;
}
.download_link.win {
margin-bottom: 6px;
}
#downloads_small { #downloads_small {
height: 45px;
}
#downloads_small h3 {
color: #da9e0f;
font-weight: normal;
}
#downloads_small div small {
color: #7d7d7d;
font-size: 80%;
padding-left: 1px;
}
h1, h2, h3, h4, h5, h6 {
font-weight: normal !important;
} }
</style> </style>
{% seo %} {% seo %}
</head> </head>
@ -57,17 +84,24 @@
<!-- HEADER --> <!-- HEADER -->
<div id="header_wrap" class="outer"> <div id="header_wrap" class="outer">
<header class="inner"> <header class="inner">
{% if site.github.is_project_page %} <a id="forkme_banner" href="{{ site.github.repository_url }}">View on GitHub</a>
<a id="forkme_banner" href="{{ site.github.repository_url }}">View on GitHub</a>
{% endif %}
<h1 id="project_title">{{ site.title | default: site.github.repository_name }}</h1> <h1 id="project_title">{{ site.title | default: site.github.repository_name }}</h1>
<h2 id="project_tagline">{{ site.description | default: site.github.project_tagline }}</h2> <h2 id="project_tagline">{{ site.description | default: site.github.project_tagline }}</h2>
{% if site.show_downloads %} {% if site.show_downloads %}
<section id="downloads_small"> <section id="downloads_small">
<a class="win_download_link" href="{{ site.download.win_url }}">Download for Windows</a> <h3>Downloads</h3>
<a class="mac_download_link" href="{{ site.download.mac_url }}">Download for MacOS</a>
<div class="download_link win">
<a href="{{ site.download.win_url }}"><i></i> Windows</a>
<small>(72 MB)</small>
</div>
<div class="download_link mac">
<a href="{{ site.download.mac_url }}"><i></i> MacOS</a>
<small>(68 MB)</small>
</div>
</section> </section>
{% endif %} {% endif %}
</header> </header>

View File

@ -2,14 +2,6 @@
layout: rising layout: rising
--- ---
# Download Now!
F-Chat Rising v1
[Windows](https://github.com/mrstallion/flist-rising/releases/download/v3.0.13-rising-v1/F-Chat.Rising.Setup.exe) (72 MB)
[MacOS](https://github.com/mrstallion/flist-rising/releases/download/v3.0.13-rising-v1/F-Chat.Rising.dmg) (68 MB)
# Features # Features

Binary file not shown.

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; img-src file: data: https://static.f-list.net; connect-src *"> <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src file: data: https://static.f-list.net; connect-src *">
<title>F-Chat</title> <title>F-Chat</title>
<link href="fa.css" rel="stylesheet"> <link href="fa.css" rel="stylesheet">
</head> </head>

View File

@ -11,6 +11,8 @@
"build:dist": "node ../webpack production", "build:dist": "node ../webpack production",
"watch": "node ../webpack watch", "watch": "node ../webpack watch",
"start": "../node_modules/.bin/electron app", "start": "../node_modules/.bin/electron app",
"startDebugMain": "../node_modules/.bin/electron --serve --inspect-brk=9229 app",
"startDebugRender": "../node_modules/.bin/electron --remote-debugging-port=9229 app",
"pack": "node ./pack" "pack": "node ./pack"
} }
} }

View File

@ -130,7 +130,10 @@ module.exports = function(mode) {
mainConfig.devtool = rendererConfig.devtool = 'source-map'; mainConfig.devtool = rendererConfig.devtool = 'source-map';
rendererConfig.plugins.push(new OptimizeCssAssetsPlugin()); rendererConfig.plugins.push(new OptimizeCssAssetsPlugin());
} else { } else {
mainConfig.devtool = rendererConfig.devtool = 'none'; // mainConfig.devtool = rendererConfig.devtool = 'none';
mainConfig.devtool = 'inline-source-map';
rendererConfig.devtool = 'inline-source-map';
} }
return [mainConfig, rendererConfig]; return [mainConfig, rendererConfig];
}; };

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; img-src https://static.f-list.net"> <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src https://static.f-list.net">
<title>F-Chat</title> <title>F-Chat</title>
<link href="fa.css" rel="stylesheet"> <link href="fa.css" rel="stylesheet">
</head> </head>
@ -11,4 +11,4 @@
<script type="text/javascript" src="common.js"></script> <script type="text/javascript" src="common.js"></script>
<script type="text/javascript" src="window.js"></script> <script type="text/javascript" src="window.js"></script>
</body> </body>
</html> </html>

View File

@ -24,6 +24,8 @@ function compilerCallback(err, stats) {
if(mode !== 'watch' && stats.hasErrors()) process.exitCode = 2; if(mode !== 'watch' && stats.hasErrors()) process.exitCode = 2;
} }
console.log(config);
const compiler = webpack(config); const compiler = webpack(config);
if(mode === 'watch') compiler.watch({}, compilerCallback); if(mode === 'watch') compiler.watch({}, compilerCallback);
else compiler.run(compilerCallback); else compiler.run(compilerCallback);