This commit is contained in:
Freddie
2020-05-30 02:37:17 +01:00
parent 93c881b733
commit 76cfbad925
29 changed files with 862 additions and 414 deletions

View File

@@ -1,7 +1,13 @@
## v1.15 beta
- **PluginLoader**: Lodash (\_) is now exposed as API.
- **WebUI**: Added a query shell for plugins. You need to enable developer mode to use it
- **WebUI**: Added a dark mode which follows system's color preference
## v1.14 beta
- **WebUI** Deleting any data now requires an additional step to prevent accidental deletion.
- **WebUI** You can now delete plugins' data in the "Data Management" page.
- **WebUI**: Deleting any data now requires an additional step to prevent accidental deletion.
- **WebUI**: You can now delete plugins' data in the "Data Management" page.
## v1.13 beta

View File

@@ -0,0 +1,88 @@
@media (prefers-color-scheme: dark) {
.content table td,
.content table th {
border: solid #363636;
border-top-color: rgb(54, 54, 54);
border-top-style: solid;
border-top-width: 0px;
border-right-color: rgb(54, 54, 54);
border-right-style: solid;
border-right-width: 0px;
border-bottom-color: rgb(54, 54, 54);
border-bottom-style: solid;
border-bottom-width: 1px;
border-left-color: rgb(54, 54, 54);
border-left-style: solid;
border-left-width: 0px;
border-image-source: initial;
border-image-slice: initial;
border-image-width: initial;
border-image-outset: initial;
border-image-repeat: initial;
border-width: 0 0 1px;
border-top-width: 0px;
border-right-width: 0px;
border-bottom-width: 1px;
border-left-width: 0px;
padding: 0.5em 0.75em;
vertical-align: top;
}
.input,
.select select,
.textarea {
background-color: #000;
border-color: #363636;
border-radius: 4px;
color: #dbdbdb;
}
a.tag.is-dark:hover {
background-color: #363636;
}
span.tag.is-dark,
a.tag.is-dark {
background-color: #505050;
}
.switch input[type='checkbox'] + .check {
background: #363636;
}
.switch input[type='checkbox'] + .check:hover {
background: #454545;
}
section.hero.is-hero-bar {
background-color: #363636;
}
.modal-card-body {
background-color: #111;
}
.modal-background {
background-color: rgba(10, 10, 10, 0.85);
}
.navbar-dropdown {
background-color: #0a0a0a;
border-top: 2px solid #363636;
box-shadow: 0 8px 8px rgba(255, 255, 255, 0.1);
}
a.navbar-item:focus {
background-color: red;
}
}
@media (prefers-color-scheme: dark) {
.menu-list a.is-active {
background-color: #282c33;
}
}
@media screen and (max-width: 1023px) {
nav.navbar .navbar-menu .navbar-item.has-dropdown > .navbar-link {
background-color: #343434;
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
[data-simplebar]{position:relative;flex-direction:column;flex-wrap:wrap;justify-content:flex-start;align-content:flex-start;align-items:flex-start}.simplebar-wrapper{overflow:hidden;width:inherit;height:inherit;max-width:inherit;max-height:inherit}.simplebar-mask{direction:inherit;position:absolute;overflow:hidden;padding:0;margin:0;left:0;top:0;bottom:0;right:0;width:auto!important;height:auto!important;z-index:0}.simplebar-offset{direction:inherit!important;box-sizing:inherit!important;resize:none!important;position:absolute;top:0;left:0;bottom:0;right:0;padding:0;margin:0;-webkit-overflow-scrolling:touch}.simplebar-content-wrapper{direction:inherit;box-sizing:border-box!important;position:relative;display:block;height:100%;width:auto;max-width:100%;max-height:100%;scrollbar-width:none;-ms-overflow-style:none}.simplebar-content-wrapper::-webkit-scrollbar,.simplebar-hide-scrollbar::-webkit-scrollbar{width:0;height:0}.simplebar-content:after,.simplebar-content:before{content:' ';display:table}.simplebar-placeholder{max-height:100%;max-width:100%;width:100%;pointer-events:none}.simplebar-height-auto-observer-wrapper{box-sizing:inherit!important;height:100%;width:100%;max-width:1px;position:relative;float:left;max-height:1px;overflow:hidden;z-index:-1;padding:0;margin:0;pointer-events:none;flex-grow:inherit;flex-shrink:0;flex-basis:0}.simplebar-height-auto-observer{box-sizing:inherit;display:block;opacity:0;position:absolute;top:0;left:0;height:1000%;width:1000%;min-height:1px;min-width:1px;overflow:hidden;pointer-events:none;z-index:-1}.simplebar-track{z-index:1;position:absolute;right:0;bottom:0;pointer-events:none;overflow:hidden}[data-simplebar].simplebar-dragging .simplebar-content{pointer-events:none;user-select:none;-webkit-user-select:none}[data-simplebar].simplebar-dragging .simplebar-track{pointer-events:all}.simplebar-scrollbar{position:absolute;left:0;right:0;min-height:10px}.simplebar-scrollbar:before{position:absolute;content:'';background:#000;border-radius:7px;left:2px;right:2px;opacity:0;transition:opacity .2s linear}.simplebar-scrollbar.simplebar-visible:before{opacity:.5;transition:opacity 0s linear}.simplebar-track.simplebar-vertical{top:0;width:11px}.simplebar-track.simplebar-vertical .simplebar-scrollbar:before{top:2px;bottom:2px}.simplebar-track.simplebar-horizontal{left:0;height:11px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar:before{height:100%;left:2px;right:2px}.simplebar-track.simplebar-horizontal .simplebar-scrollbar{right:auto;left:0;top:2px;height:7px;min-height:0;min-width:10px;width:auto}[data-simplebar-direction=rtl] .simplebar-track.simplebar-vertical{right:auto;left:0}.hs-dummy-scrollbar-size{direction:rtl;position:fixed;opacity:0;visibility:hidden;height:500px;width:500px;overflow-y:hidden;overflow-x:scroll}.simplebar-hide-scrollbar{position:fixed;left:0;visibility:hidden;overflow-y:scroll;scrollbar-width:none;-ms-overflow-style:none}

View File

@@ -2,6 +2,10 @@
margin-right: 0.3em;
}
html {
overflow-y: hidden;
}
aside {
overflow-y: auto;
overflow-x: hidden;
@@ -13,8 +17,13 @@ aside {
flex-direction: column;
}
.content {
.content#main-content {
flex: 1 0 auto;
/* display: flex;
flex-direction: column; */
max-height: calc(100vh - 92.31px);
overflow-y: auto;
margin-bottom: 0;
}
html.has-aside-mobile-transition #app,
@@ -304,7 +313,7 @@ a.tag.is-dark:hover {
}
#confirm-delete span {
padding: calc(0.5em - 1px) 1em;
padding: calc(0.375em - 1px) 0.75em;
text-align: center;
}
@@ -336,3 +345,16 @@ a.tag.is-dark:hover {
transition-delay: 0.3s;
opacity: 1;
}
.shell-input input {
font-family: monospace;
}
#shell-content {
display: flex;
flex-direction: column-reverse;
}
#shell-content code {
overflow-x: hidden;
}

View File

@@ -0,0 +1,202 @@
(() => {
const __HISTORY_MAX = 64;
const __history = [];
let __history_cur = 0;
function __callFunc(command) {
return async (...args) => {
return (
await axios.post(
'db',
{
command,
plugin: $('#shell-command').attr('data-plugin'),
args,
},
{ timeout: 10000 }
)
).data;
};
}
const DB = {
Count: __callFunc('Count'),
Find: __callFunc('Find'),
FindOne: __callFunc('FindOne'),
Insert: __callFunc('Insert'),
Remove: __callFunc('Remove'),
Update: __callFunc('Update'),
Upsert: __callFunc('Upsert'),
};
function clear() {
$('#shell-content').html('');
return null;
}
Object.freeze(DB);
let __auto_command_store = null;
const __AUTO_KW = {
'': ['clear'],
'DB': Object.keys(DB),
};
let __auto_starts = 0;
$('#shell-command').on('keydown', async e => {
if (e.code == 'Enter') {
e.preventDefault();
__history_cur = 0;
const command = $('#shell-command').val();
if (command == null || command.length == '') {
return;
}
$('#shell-command').prop('disabled', true);
__history.push(command);
if (__history.length > __HISTORY_MAX) {
__history.slice(__history.length - __HISTORY_MAX, __history.length);
}
let result = '';
try {
result = await eval(command);
} catch (err) {
result = { error: err.toString() };
}
if (result !== null && result !== DB) {
$('#shell-content').append(
`<code class="language-json hljs">${
hljs.highlight('json', `/* ${command} */\n${JSON.stringify(result, null, 2)}`).value
}</code>`
);
}
$('#shell-command').val('');
$('#shell-command').prop('disabled', false);
$('#shell-command').focus();
} else if (e.code == 'ArrowUp') {
e.preventDefault();
//Up
if (__history_cur < Math.min(__HISTORY_MAX, __history.length)) {
__history_cur += 1;
$('#shell-command').val(__history[__history.length - __history_cur]);
}
} else if (e.code == 'ArrowDown') {
e.preventDefault();
//Down
if (__history_cur > 0) {
__history_cur -= 1;
if (__history_cur == 0) $('#shell-command').val('');
else $('#shell-command').val(__history[__history.length - __history_cur]);
}
} else if (e.code == 'Tab') {
e.preventDefault();
let start = $('#shell-command').prop('selectionStart');
let end = $('#shell-command').prop('selectionEnd');
if (start != end) {
return;
}
let input = $('#shell-command').val();
if (__auto_command_store == null) {
__auto_command_store = { command: input, cursor: end };
} else {
input = __auto_command_store.command;
end = __auto_command_store.cursor;
}
const findSep = (seps, end) => {
for (let cur = end - 1; cur >= -1; --cur) {
if (seps.indexOf(input[cur]) >= 0) {
return cur;
}
}
return -1;
};
const cur = findSep([undefined, ' ', ',', '.', ';'], end);
let namespace = '';
if (input[cur] == '.') {
const cur2 = findSep([undefined, ' ', ',', ';'], cur);
const _ns = input.slice(cur2 + 1, cur);
if (__AUTO_KW[_ns]) {
namespace = _ns;
}
}
for (let i = 0; i < __AUTO_KW[namespace].length; ++i) {
const index = (__auto_starts + i) % __AUTO_KW[namespace].length;
if (
__AUTO_KW[namespace][index]
.toLowerCase()
.startsWith(input.slice(cur + 1, end).toLowerCase())
) {
input = input.slice(0, cur + 1) + __AUTO_KW[namespace][index] + '()' + input.slice(end);
__auto_starts = (index + 1) % __AUTO_KW[namespace].length;
start = end = cur + 1 + __AUTO_KW[namespace][index].length + 1;
break;
}
}
$('#shell-command').val(input);
$('#shell-command').prop('selectionStart', start);
$('#shell-command').prop('selectionEnd', end);
}
});
$('#shell-command').on('input', e => {
__auto_command_store = null;
__auto_starts = 0;
if (e.originalEvent.inputType != 'insertText') {
return;
}
const keywords = Object.keys(DB)
.map(k => `DB.${k}(`)
.concat('DB.');
let start = $('#shell-command').prop('selectionStart');
let end = $('#shell-command').prop('selectionEnd');
if (start != end) {
return;
}
let input = $('#shell-command').val();
const sep = [undefined, ' ', ',', '.', ';'];
for (const kw of keywords) {
if (
input.substr(end - kw.length, end).toLowerCase() == kw.toLowerCase() &&
sep.indexOf(input[end - kw.length - 1]) >= 0
) {
input = input.slice(0, end - kw.length) + kw + input.slice(end);
}
}
const fillRight = {
'(': ')',
'{': '}',
'[': ']',
'"': '"',
"'": "'",
'`': '`',
};
if (input[end - 1] in fillRight) {
input = input.slice(0, end) + fillRight[input[end - 1]] + input.slice(end);
}
if (Object.values(fillRight).indexOf(input[end]) >= 0 && input[end - 1] == input[end]) {
input = input.slice(0, end - 1) + input.slice(end);
}
$('#shell-command').val(input);
$('#shell-command').prop('selectionStart', start);
$('#shell-command').prop('selectionEnd', end);
});
})();

View File

@@ -9,7 +9,7 @@
});
$('#card-input').on('keypress', e => {
if (e.which == 13) {
if (e.code == 'Enter') {
axios
.post(`/profile/${$('#refid').text()}/card`, { cid: $('#card-input').val() })
.then(response => {

File diff suppressed because one or more lines are too long

View File

@@ -1,12 +1,13 @@
extends _layout.pug
block content
section.hero.is-dark(geopattern)
.hero-body
.columns
.column.is-narrow
.image.is-128x128(style="background-color: #ffffffaa" jdenticon jdenticon-size=128)
.column
h1.title Oh well.
p.subtitle At least I have a random pattern for you to look at.
p.has-text-right.is-size-7 How did you end up here anyway?
section.section.is-main-section
section.hero.is-dark(geopattern)
.hero-body
.columns
.column.is-narrow
.image.is-128x128(style="background-color: #ffffffaa" jdenticon jdenticon-size=128)
.column
h1.title Oh well.
p.subtitle At least I have a random pattern for you to look at.
p.has-text-right.is-size-7 How did you end up here anyway?

View File

@@ -1,17 +1,18 @@
extends _layout.pug
block content
section.hero.is-dark(geopattern)
.hero-body
.columns
.column.is-narrow
.image.is-128x128(style="background-color: #ffffffaa" jdenticon jdenticon-size=128)
.column
h1.title Something went wrong
p.subtitle Let me distract you with this random pattern.
p.has-text-right.is-size-7 So you don't see the error message
section.section
.container.has-text-grey
p #{err}
p.is-size-7 It's just something wrong with the frontend. Probably not a big deal anyway.
section.section.is-main-section
section.hero.is-dark(geopattern)
.hero-body
.columns
.column.is-narrow
.image.is-128x128(style="background-color: #ffffffaa" jdenticon jdenticon-size=128)
.column
h1.title Something went wrong
p.subtitle Let me distract you with this random pattern.
p.has-text-right.is-size-7 So you don't see the error message
section.section
.container.has-text-grey
p #{err}
p.is-size-7 It's just something wrong with the frontend. Probably not a big deal anyway.

View File

@@ -39,14 +39,22 @@ html.has-aside-left.has-aside-mobile-transition.has-navbar-fixed-top.has-aside-e
link(rel="stylesheet", href="/static/css/margin.min.css")
link(rel="stylesheet", href="/static/css/materialdesignicons.min.css")
link(rel="stylesheet", href="/static/css/tooltip.min.css")
link(rel="stylesheet", href="/static/css/bulma-slider.min.css")
link(rel="stylesheet", href="/static/css/style.css")
link(rel="stylesheet", href="/static/css/simplebar.min.css")
script(type="text/javascript" src="/static/js/axios.min.js")
script(type="text/javascript" src="/static/js/jquery-3.5.1.min.js")
script(type="text/javascript" src="/static/js/jdenticon-2.2.0.min.js")
script(type="text/javascript" src="/static/js/geopattern.min.js")
script(type="text/javascript" src="/static/js/js.cookie-2.2.1.min.js")
script(type="text/javascript" src="/static/js/simplebar.min.js")
block head
link(rel="stylesheet", href="/static/css/bulma-fix.css")
noscript
style
.
.simplebar-content-wrapper {
overflow: auto;
}
body
#app
nav.navbar.is-fixed-top.is-info.is-mobile#navbar-main
@@ -82,7 +90,7 @@ html.has-aside-left.has-aside-mobile-transition.has-navbar-fixed-top.has-aside-e
span.icon
i.mdi.mdi-power
span Shutdown CORE
aside.aside.is-placed-left.is-expanded
aside.aside.is-placed-left.is-expanded(data-simplebar)
.aside-tools
.aside-tools-label
span #{version}
@@ -94,7 +102,7 @@ html.has-aside-left.has-aside-mobile-transition.has-navbar-fixed-top.has-aside-e
+li_menu_item("database", "Data Management", "/data")
+li_menu_item("help-circle", "About", "/about")
p.menu-label Plugins
ui.menu-list
ul.menu-list
each plugin in plugins
-
var link = plugin.id.toLowerCase();
@@ -104,7 +112,7 @@ html.has-aside-left.has-aside-mobile-transition.has-navbar-fixed-top.has-aside-e
var isNumeric = /[0-9]/.test(char);
var icon = isAlpha ? `alpha-${char}-circle` : (isNumeric ? `numeric-${char}-circle` : 'record-circle');
+li_plugin(icon, label, link, plugin.pages)
.content
.content#main-content(data-simplebar)
section.hero.is-hero-bar
.hero-body
p.title #{title}
@@ -121,8 +129,7 @@ html.has-aside-left.has-aside-mobile-transition.has-navbar-fixed-top.has-aside-e
|
span.has-text-grey #{subsubtitle}
section.section.is-main-section
block content
block content
footer.footer
.content.has-text-centered
@@ -133,5 +140,7 @@ html.has-aside-left.has-aside-mobile-transition.has-navbar-fixed-top.has-aside-e
| by Team Asphyxia | Plugins by
a(href="/about") Community
block modal
script(type="text/javascript" src="/static/js/main.js")
block scripts

View File

@@ -1,23 +1,24 @@
extends _layout.pug
block content
.has-text-centered
img(src="/static/img/logo.png" width="192px" height="192px")
h1.title Asphyxia CORE
span.tags.has-addons.has-text-weight-normal.has-margin-left-7.is-inline
span.tag.is-dark by
span.tag.is-info Team Asphyxia
if contributors && contributors.length > 0
p.subtitle with plugins contributed by
span.field.is-grouped.is-grouped-multiline#contrib-tags
each contributor in contributors
.control
if contributor.link
span.tags.has-addons
span.tag.is-info #{contributor.name}
a.tag.is-dark(href=contributor.link)
span.icon.is-small
i.mdi.mdi-link-variant
else
span.tags.has-addons
span.tag.is-info #{contributor.name}
section.section.is-main-section
.has-text-centered
img(src="/static/img/logo.png" width="192px" height="192px")
h1.title Asphyxia CORE
span.tags.has-addons.has-text-weight-normal.has-margin-left-7.is-inline
span.tag.is-dark by
span.tag.is-info Team Asphyxia
if contributors && contributors.length > 0
p.subtitle with plugins contributed by
span.field.is-grouped.is-grouped-multiline#contrib-tags
each contributor in contributors
.control
if contributor.link
span.tags.has-addons
span.tag.is-info #{contributor.name}
a.tag.is-dark(href=contributor.link)
span.icon.is-small
i.mdi.mdi-link-variant
else
span.tags.has-addons
span.tag.is-info #{contributor.name}

View File

@@ -1,4 +1,5 @@
extends _layout.pug
block content
| !{content}
section.section.is-main-section
| !{content}

View File

@@ -1,17 +1,18 @@
extends _layout.pug
block content
if tabs.length > 1
.tabs.is-toggle.is-paddingless
ul.is-marginless
each tab in tabs
if (subsubidentifier == tab.link)
li.is-active
a(href=`/plugin/${plugin}/profile?refid=${refid}&page=${tab.link}`) #{tab.name}
else
li
a.has-background-white(href=`/plugin/${plugin}/profile?refid=${refid}&page=${tab.link}`) #{tab.name}
| !{content}
section.section.is-main-section
if tabs.length > 1
.tabs.is-toggle.is-paddingless
ul.is-marginless
each tab in tabs
if (subsubidentifier == tab.link)
li.is-active
a(href=`/plugin/${plugin}/profile?refid=${refid}&page=${tab.link}`) #{tab.name}
else
li
a.has-background-white(href=`/plugin/${plugin}/profile?refid=${refid}&page=${tab.link}`) #{tab.name}
| !{content}
block scripts
script var refid = "#{refid}";

View File

@@ -2,69 +2,73 @@ extends _layout.pug
include _delete.pug
block content
.notification.is-success
h4.title Query Tool Coming Soon
p Interactive query frontend will come later.
section.section.is-main-section
if dev
.notification.is-warning
h4.title Developer Mode
p Query shell enabled
//- div #{plugin.id} #{plugin.dataSize}
//- .notification.is-danger
//- h4.title
//- span.icon
//- i.mdi.mdi-alert
//- | Danger Zone
//- p Here you can erase each plugin's data. You will <b>NOT</b> be able to undo any action here.
//- p Note that plugins that you already uninstalled will still show up here, so you can clear their data if you don't want them anymore.
//- p PROCEED WITH CAUTION
//- .columns
//- .column
//- .card
//- header.card-header
//- p.card-header-title
//- span.icon
//- i.mdi.mdi-account
//- | Profile
//- .card-content
//- .column
.columns.is-multiline
each plugin in pluginStats
.column.is-half
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-puzzle
| #{plugin.id}
if (installed.indexOf(plugin.id) >= 0)
span.tag.has-margin-left-7.is-primary
span.icon
i.mdi.mdi-check-decagram.mdi-18px
span Active
else
span.tag.has-margin-left-7.is-warning
span.icon
i.mdi.mdi-alert-decagram.mdi-18px
span Uninstalled
.card-content
.level
.level-item.has-text-centered
div
p.heading Plugin
p.subtitle #{plugin.name}
.level-item.has-text-centered
div
p.heading Data Usage
p.subtitle #{plugin.dataSize}
.buttons.is-right
//- a.button.is-primary(href=`/data/${plugin.id}`)
//- span.icon.is-small
//- i.mdi.mdi-table
//- span Query
button.button.is-danger.is-outlined.jb-modal.data-delete-button(data-target="confirm-modal" deleting=plugin.id deleting-name=plugin.id)
span.icon.is-small
i.mdi.mdi-trash-can
span Delete
//- div #{plugin.id} #{plugin.dataSize}
//- .notification.is-danger
//- h4.title
//- span.icon
//- i.mdi.mdi-alert
//- | Danger Zone
//- p Here you can erase each plugin's data. You will <b>NOT</b> be able to undo any action here.
//- p Note that plugins that you already uninstalled will still show up here, so you can clear their data if you don't want them anymore.
//- p PROCEED WITH CAUTION
//- .columns
//- .column
//- .card
//- header.card-header
//- p.card-header-title
//- span.icon
//- i.mdi.mdi-account
//- | Profile
//- .card-content
//- .column
.columns.is-multiline
each plugin in pluginStats
.column.is-half
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-puzzle
| #{plugin.id}
if (installed.indexOf(plugin.id) >= 0)
span.tag.has-margin-left-7.is-primary
span.icon
i.mdi.mdi-check-decagram.mdi-18px
span Active
else
span.tag.has-margin-left-7.is-warning
span.icon
i.mdi.mdi-alert-decagram.mdi-18px
span Uninstalled
.card-content
.level
.level-item.has-text-centered
div
p.heading Plugin
p.subtitle #{plugin.name}
.level-item.has-text-centered
div
p.heading Data Usage
p.subtitle #{plugin.dataSize}
.buttons.is-right
if dev
a.button.is-warning(href=`/data/${plugin.id}`)
span.icon.is-small
i.mdi.mdi-table
span Query
button.button.is-danger.is-outlined.jb-modal.data-delete-button(data-target="confirm-modal" deleting=plugin.id deleting-name=plugin.id)
span.icon.is-small
i.mdi.mdi-trash-can
span Delete
block modal
+confirm("Deleting all data of", "/data/")
p
b Are you sure?

View File

@@ -0,0 +1,23 @@
extends _layout.pug
block head
link(rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/styles/atom-one-dark.min.css")
script(src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.0/highlight.min.js")
<script>hljs.initHighlightingOnLoad();</script>
block content
.shell
.control.has-icons-left.shell-input
input.input#shell-command(type="text" spellcheck="false" data-plugin=subtitle)
span.icon.is-left
i.mdi.mdi-chevron-right
pre.has-padding-7.is-marginless#shell-content
code.language-json
.
/*
You can call any DB operations here.
Call clear() to clear history.
*/
block scripts
script(type="text/javascript" src="/static/js/data_plugin.js")

View File

@@ -2,67 +2,68 @@ extends _layout.pug
include _settings.pug
block content
.columns
.column
.card
.card-content
.level.is-mobile
.level-item
.is-widget-label
p.subtitle Profile Slots
p.title #{profiles}/16
.level-item
span.icon.is-large.has-text-primary
i.mdi.mdi-48px.mdi-account-multiple
.column
.card
.card-content
.level.is-mobile
.level-item
.is-widget-label
p.subtitle Plugins
p.title #{plugins.length}
.level-item
span.icon.is-large.has-text-info
i.mdi.mdi-48px.mdi-view-module
.column
.card
.card-content
.level.is-mobile
.level-item
.is-widget-label
p.subtitle RAM Usage
p.title #{memory}
.level-item
span.icon.is-large.has-text-danger
i.mdi.mdi-48px.mdi-memory
section.section.is-main-section
.columns
.column
.card
.card-content
.level.is-mobile
.level-item
.is-widget-label
p.subtitle Profile Slots
p.title #{profiles}/16
.level-item
span.icon.is-large.has-text-primary
i.mdi.mdi-48px.mdi-account-multiple
.column
.card
.card-content
.level.is-mobile
.level-item
.is-widget-label
p.subtitle Plugins
p.title #{plugins.length}
.level-item
span.icon.is-large.has-text-info
i.mdi.mdi-48px.mdi-view-module
.column
.card
.card-content
.level.is-mobile
.level-item
.is-widget-label
p.subtitle RAM Usage
p.title #{memory}
.level-item
span.icon.is-large.has-text-danger
i.mdi.mdi-48px.mdi-memory
.columns
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-information-outline
| Information
.card-content
p Homepage:
a(href="https://asphyxia-core.github.io") https://team-asphyxia.github.io
p
div Latest Community Plugins:
a(href="https://github.com/asphyxia-core/plugins") https://github.com/asphyxia-core/plugins
p
| Asphyxia CORE is a
b.has-text-danger FREE
|
| software made by and for the community. If you bought this software, you have been scammed.
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-format-list-bulleted
| Changelog
.card-content !{changelog}
.column
+form('CORE Settings', config, 'core')
.columns
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-information-outline
| Information
.card-content
p Homepage:
a(href="https://asphyxia-core.github.io") https://team-asphyxia.github.io
p
div Latest Community Plugins:
a(href="https://github.com/asphyxia-core/plugins") https://github.com/asphyxia-core/plugins
p
| Asphyxia CORE is a
b.has-text-danger FREE
|
| software made by and for the community. If you bought this software, you have been scammed.
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-format-list-bulleted
| Changelog
.card-content !{changelog}
.column
+form('CORE Settings', config, 'core')

View File

@@ -2,46 +2,47 @@ extends _layout.pug
include _settings.pug
block content
.columns
.column
if contributors && contributors.length > 0
section.section.is-main-section
.columns
.column
if contributors && contributors.length > 0
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-dev-to
| Contributors
.card-content
span.field.is-grouped.is-grouped-multiline
each contributor in contributors
.control
if contributor.link
span.tags.has-addons
span.tag.is-info #{contributor.name}
a.tag.is-dark(href=contributor.link)
span.icon.is-small
i.mdi.mdi-link-variant
else
span.tags.has-addons
span.tag.is-info #{contributor.name}
if readme
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-information-outline
| Information
.card-content !{readme}
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-dev-to
| Contributors
.card-content
span.field.is-grouped.is-grouped-multiline
each contributor in contributors
.control
if contributor.link
span.tags.has-addons
span.tag.is-info #{contributor.name}
a.tag.is-dark(href=contributor.link)
span.icon.is-small
i.mdi.mdi-link-variant
else
span.tags.has-addons
span.tag.is-info #{contributor.name}
if readme
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-information-outline
| Information
.card-content !{readme}
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-gamepad-variant-outline
| Game Support
.card-content
span.tags
each code in gameCodes
span.tag.is-primary #{code}
if config.length
+form("Plugin Settings", config)
i.mdi.mdi-gamepad-variant-outline
| Game Support
.card-content
span.tags
each code in gameCodes
span.tag.is-primary #{code}
if config.length
+form("Plugin Settings", config)

View File

@@ -2,54 +2,56 @@ extends _layout.pug
include _delete.pug
block content
if profiles.length > 0
.columns.is-multiline
each profile in profiles
.column.is-half
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-file
| #{profile.coreProfile.name}
.card-content
.level
.level-item.has-text-centered
.image.is-64x64(jdenticon=profile.coreProfile.name jdenticon-size=64)
.level-item.has-text-centered
div
p.heading ID
p
span.tag.is-info #{profile.refid}
.level
.level-item.has-text-centered
div
p.heading Name
p.subtitle #{profile.name}
.level-item.has-text-centered
div
p.heading Data Usage
p.subtitle #{profile.dataSize}
.buttons.is-right
if hasCustomPage
a.button.is-primary(href=`/plugin/${plugin}/profile?refid=${profile.refid}`)
section.section.is-main-section
if profiles.length > 0
.columns.is-multiline
each profile in profiles
.column.is-half
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-file
| #{profile.coreProfile.name}
.card-content
.level
.level-item.has-text-centered
.image.is-64x64(jdenticon=profile.coreProfile.name jdenticon-size=64)
.level-item.has-text-centered
div
p.heading ID
p
span.tag.is-info #{profile.refid}
.level
.level-item.has-text-centered
div
p.heading Name
p.subtitle #{profile.name}
.level-item.has-text-centered
div
p.heading Data Usage
p.subtitle #{profile.dataSize}
.buttons.is-right
if hasCustomPage
a.button.is-primary(href=`/plugin/${plugin}/profile?refid=${profile.refid}`)
span.icon.is-small
i.mdi.mdi-account-edit
span Detail
button.button.is-danger.is-outlined.jb-modal.data-delete-button(data-target="confirm-modal" deleting=profile.refid deleting-name=profile.coreProfile.name)
span.icon.is-small
i.mdi.mdi-account-edit
span Detail
button.button.is-danger.is-outlined.jb-modal.data-delete-button(data-target="confirm-modal" deleting=profile.refid deleting-name=profile.coreProfile.name)
span.icon.is-small
i.mdi.mdi-trash-can
span Delete
i.mdi.mdi-trash-can
span Delete
else
section.section
.content.has-text-grey.has-text-centered
p
span.icon.is-large
i.mdi.mdi-emoticon-happy.mdi-48px
p Nothing's here yet. Let's play!
else
section.section
.content.has-text-grey.has-text-centered
p
span.icon.is-large
i.mdi.mdi-emoticon-happy.mdi-48px
p Nothing's here yet. Let's play!
block modal
+confirm("Deleting game data of", "profile/")
p
b Are you sure?

View File

@@ -2,49 +2,51 @@ extends _layout.pug
include _delete.pug
block content
- var dateformat = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };
section.section.is-main-section
- var dateformat = { year: 'numeric', month: 'numeric', day: 'numeric', hour: 'numeric', minute: 'numeric' };
.card.has-table
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-account-multiple
| Players
.card-content
if profiles.length > 0
.table-container
table.table.is-fullwidth.is-striped.is-hoverable
thead
tr
th
th Name
th.is-hidden-mobile ID
th Cards
th
tbody
each profile, index in profiles
.card.has-table
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-account-multiple
| Players
.card-content
if profiles.length > 0
.table-container
table.table.is-fullwidth.is-striped.is-hoverable
thead
tr
td.is-image-cell
.image.is-32x32(jdenticon=profile.name jdenticon-size='32')
td.has-padding-top-7 #{profile.name}
td.is-hidden-mobile.has-padding-top-7 #{profile.__refid}
td.has-padding-top-7 #{profile.cards}
td.has-padding-right-5
.buttons.is-right.are-small
a.button.is-primary(href=`/profile/${profile.__refid}` data-tooltip="Edit")
span.icon
i.mdi.mdi-account-edit.mdi-18px
a.button.is-danger.jb-modal.data-delete-button(data-target="confirm-modal" deleting=profile.__refid deleting-name=profile.name data-tooltip="Delete")
span.icon
i.mdi.mdi-trash-can.mdi-18px
else
section.section
.content.has-text-grey.has-text-centered
p
span.icon.is-large
i.mdi.mdi-emoticon-happy.mdi-48px
p Nothing's here yet. Let's play!
th
th Name
th.is-hidden-mobile ID
th Cards
th
tbody
each profile, index in profiles
tr
td.is-image-cell
.image.is-32x32(jdenticon=profile.name jdenticon-size='32')
td.has-padding-top-7 #{profile.name}
td.is-hidden-mobile.has-padding-top-7 #{profile.__refid}
td.has-padding-top-7 #{profile.cards}
td.has-padding-right-5
.buttons.is-right.are-small
a.button.is-primary(href=`/profile/${profile.__refid}` data-tooltip="Edit")
span.icon
i.mdi.mdi-account-edit.mdi-18px
a.button.is-danger.jb-modal.data-delete-button(data-target="confirm-modal" deleting=profile.__refid deleting-name=profile.name data-tooltip="Delete")
span.icon
i.mdi.mdi-trash-can.mdi-18px
else
section.section
.content.has-text-grey.has-text-centered
p
span.icon.is-large
i.mdi.mdi-emoticon-happy.mdi-48px
p Nothing's here yet. Let's play!
block modal
+confirm("Deleting profile", "/profile/")
p
b Are you sure?

View File

@@ -1,85 +1,86 @@
extends _layout.pug
block content
.columns
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-account
| Details
.card-content
.columns
.column.is-narrow
.image.is-64x64#profile-icon(jdenticon=profile.name jdenticon-size=64)
.column
.field.is-horizontal.is-narrow
.field-label
label.label ID
.field-body
.field
.control
span.tag.is-info#refid #{profile.__refid}
form(method='post')
section.section.is-main-section
.columns
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-account
| Details
.card-content
.columns
.column.is-narrow
.image.is-64x64#profile-icon(jdenticon=profile.name jdenticon-size=64)
.column
.field.is-horizontal.is-narrow
.field-label.is-normal
label.label PIN
.field-label
label.label ID
.field-body
.field
.control
input.input(type='password' size='4' maxlength='4' placeholder='••••' name='pin')
.field.is-horizontal.is-narrow(data-tooltip="Only used in WebUI")
.field-label.is-normal
label.label Name
.field-body
.field
.control
input.input#name-input(type='text' placeholder=profile.name name='name')
.field.is-grouped
span.tag.is-info#refid #{profile.__refid}
form(method='post')
.field.is-horizontal.is-narrow
.field-label.is-normal
label.label PIN
.field-body
.field
.control
input.input(type='password' size='4' maxlength='4' placeholder='••••' name='pin')
.field.is-horizontal.is-narrow(data-tooltip="Only used in WebUI")
.field-label.is-normal
label.label Name
.field-body
.field
.control
input.input#name-input(type='text' placeholder=profile.name name='name')
.field.is-grouped
.control.is-expanded
if formMessage
if formMessage.danger
.notification.is-danger.is-light #{formMessage.message}
else
.notification.is-success.is-light #{formMessage.message}
.control
button.button.is-link(type='submit')
span.icon.is-small
i.mdi.mdi-pencil
span Change
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-account
| Cards
.card-content
.field.is-horizontal.is-narrow
.field-label.is-normal
label.label Add
.field-body
.field.has-addons
.control.is-expanded
if formMessage
if formMessage.danger
.notification.is-danger.is-light #{formMessage.message}
else
.notification.is-success.is-light #{formMessage.message}
input.input#card-input(type='text' placeholder='Card Number' name='card')
.control
button.button.is-link(type='submit')
button.button.is-primary#add-card
span.icon.is-small
i.mdi.mdi-pencil
span Change
.column
.card
header.card-header
p.card-header-title
span.icon
i.mdi.mdi-account
| Cards
.card-content
.field.is-horizontal.is-narrow
.field-label.is-normal
label.label Add
.field-body
.field.has-addons
.control.is-expanded
input.input#card-input(type='text' placeholder='Card Number' name='card')
.control
button.button.is-primary#add-card
span.icon.is-small
i.mdi.mdi-plus
each card in profile.cards
.ecard.box.is-paddingless(geopattern=card.cid)
.ecard-brand ASPHYXIA
.ecard-print
.desc Card Number
.print #{card.print.replace(/[^a-z0-9]+/gi, '').replace(/(.{4})/g, '$1 ')}
.ecard-number
.desc NFC
.print #{card.cid}
.ecard-logo
button.button.is-danger.ecard-delete(deleting=card.cid data-tooltip="Delete this card")
span.icon
i.mdi.mdi-trash-can.mdi-24px
i.mdi.mdi-plus
each card in profile.cards
.ecard.box.is-paddingless(geopattern=card.cid)
.ecard-brand ASPHYXIA
.ecard-print
.desc Card Number
.print #{card.print.replace(/[^a-z0-9]+/gi, '').replace(/(.{4})/g, '$1 ')}
.ecard-number
.desc NFC
.print #{card.cid}
.ecard-logo
button.button.is-danger.ecard-delete(deleting=card.cid data-tooltip="Delete this card")
span.icon
i.mdi.mdi-trash-can.mdi-24px
block scripts
script(type="text/javascript" src="/static/js/profile.js")

6
package-lock.json generated
View File

@@ -152,9 +152,9 @@
"dev": true
},
"@types/lodash": {
"version": "4.14.150",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.150.tgz",
"integrity": "sha512-kMNLM5JBcasgYscD9x/Gvr6lTAv2NVgsKtet/hm93qMyf/D1pt+7jeEZklKJKxMVmXjxbRVQQGfqDSfipYCO6w==",
"version": "4.14.153",
"resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.153.tgz",
"integrity": "sha512-lYniGRiRfZf2gGAR9cfRC3Pi5+Q1ziJCKqPmjZocigrSJUVPWf7st1BtSJ8JOeK0FLXVndQ1IjUjTco9CXGo/Q==",
"dev": true
},
"@types/mime": {

View File

@@ -12,7 +12,7 @@
"@types/express-session": "^1.17.0",
"@types/get-caller-file": "^1.0.0",
"@types/ini": "^1.3.30",
"@types/lodash": "^4.14.150",
"@types/lodash": "^4.14.153",
"@types/nedb": "^1.8.9",
"@types/node": "^13.13.4",
"@types/node-notifier": "^6.0.1",

View File

@@ -26,8 +26,8 @@ function Main() {
Logger.info(' |_| |___/ / ` / \\ |__) |__ ');
Logger.info(' \\__, \\__/ | \\ |___ ');
Logger.info('');
Logger.info(chalk.cyanBright(pad(`Asphyxia ${VERSION}`, 60)));
Logger.info(pad(`Brought you by TsFreddie`, 60));
Logger.info(chalk.cyanBright(pad(`CORE ${VERSION}`, 60)));
Logger.info(pad(`Brought you by Team Asphyxia`, 60));
Logger.info(` `);
Logger.info(chalk.redBright(pad(`FREE SOFTWARE. BEWARE OF SCAMMERS.`, 60)));
Logger.info(pad(`If you bought this software, request refund immediately.`, 60));

View File

@@ -13,12 +13,12 @@ facility.add('facility.get', async (info, data, send) => {
id: kitem('str', 'ea'),
country: kitem('str', 'AX'),
region: kitem('str', '1'),
name: kitem('str', 'Asphyxia'),
name: kitem('str', 'CORE'),
type: kitem('u8', 0),
countryname: kitem('str', 'UNKNOWN'),
countryjname: kitem('str', '不明'),
regionname: kitem('str', 'Asphyxia'),
regionjname: kitem('str', 'Asphyxia'),
regionname: kitem('str', 'CORE'),
regionjname: kitem('str', 'CORE'),
customercode: kitem('str', 'AXUSR'),
companycode: kitem('str', 'AXCPY'),
latitude: kitem('s32', 6666),
@@ -47,11 +47,11 @@ facility.add('facility.get', async (info, data, send) => {
supplylimit: kitem('s32', 100000),
},
url: {
eapass: kitem('str', `AsphyxiaCore ${VERSION}`),
arcadefan: kitem('str', `AsphyxiaCore ${VERSION}`),
konaminetdx: kitem('str', `AsphyxiaCore ${VERSION}`),
konamiid: kitem('str', `AsphyxiaCore ${VERSION}`),
eagate: kitem('str', `AsphyxiaCore ${VERSION}`),
eapass: kitem('str', `CORE ${VERSION}`),
arcadefan: kitem('str', `CORE ${VERSION}`),
konaminetdx: kitem('str', `CORE ${VERSION}`),
konamiid: kitem('str', `CORE ${VERSION}`),
eagate: kitem('str', `CORE ${VERSION}`),
},
},
};

View File

@@ -35,6 +35,7 @@ import { ARGS, PluginRegisterConfig, CONFIG } from '../utils/ArgConfig';
import { EamusePlugin } from './EamusePlugin';
import { EamuseRouteHandler } from './EamuseRouteContainer';
import xml2json from 'fast-xml-parser';
import _ from 'lodash';
/* Exposing API */
const $: any = global;
@@ -66,6 +67,7 @@ $.$.NUMBER = getNumber;
$.$.NUMBERS = getNumbers;
$.$.STR = getStr;
$._ = _;
$.K = {
ATTR: kattr,
ITEM: kitem,

View File

@@ -1,4 +1,4 @@
export const VERSION = 'v1.14 beta';
export const VERSION = 'v1.15 beta';
export const NAMES = [
'Akehiro',
'Akihiro',

View File

@@ -510,6 +510,13 @@ export async function APIFindOne(
__affiliation: plugin.name,
__refid: arg1,
};
} else if (arg1 == null && typeof arg2 == 'object') {
CheckQuery(arg2);
query = {
...arg2,
__reserved_field: 'plugins_profile',
__affiliation: plugin.name,
};
} else if (typeof arg1 == 'object') {
CheckQuery(arg1);
query = {
@@ -530,7 +537,6 @@ export async function APIFindOne(
__reserved_field: 0,
__affiliation: 0,
__collection: 0,
__refid: 0,
},
(err, doc) => {
if (err) reject(err);
@@ -581,7 +587,6 @@ export async function APIFind(
__reserved_field: 0,
__affiliation: 0,
__collection: 0,
__refid: 0,
}
)
.sort({ createdAt: 1 })
@@ -613,6 +618,8 @@ export async function APIInsert(
__affiliation: plugin.name,
__refid: arg1,
};
} else if (arg1 == null && typeof arg2 == 'object') {
throw new Error('refid must be specified for Insert Query');
} else if (typeof arg1 == 'object') {
CheckQuery(arg1);
doc = {

View File

@@ -5,7 +5,14 @@ import cookies from 'cookie-parser';
import createMemoryStore from 'memorystore';
import flash from 'connect-flash';
import { VERSION } from '../utils/Consts';
import { CONFIG_MAP, CONFIG_DATA, CONFIG, CONFIG_OPTIONS, SaveConfig } from '../utils/ArgConfig';
import {
CONFIG_MAP,
CONFIG_DATA,
CONFIG,
CONFIG_OPTIONS,
SaveConfig,
ARGS,
} from '../utils/ArgConfig';
import { get, isEmpty } from 'lodash';
import { Converter } from 'showdown';
import {
@@ -25,6 +32,11 @@ import {
APIRemove,
PluginStats,
PurgePlugin,
APIFindOne,
APIInsert,
APIUpdate,
APIUpsert,
APICount,
} from '../utils/EamuseIO';
import { urlencoded, json } from 'body-parser';
import humanize from 'humanize-string';
@@ -279,23 +291,73 @@ webui.get(
wrap(async (req, res) => {
const pluginStats = await PluginStats();
const installed = ROOT_CONTAINER.Plugins.map(p => p.Identifier);
res.render('data', data(req, 'Data Management', 'core', { pluginStats, installed }));
res.render(
'data',
data(req, 'Data Management', 'core', { pluginStats, installed, dev: ARGS.dev })
);
})
);
webui.get(
'/data/:plugin',
wrap(async (req, res) => {
const pluginID = req.params['plugin'];
res.render('data_plugin', data(req, 'Data Management', 'core', { subtitle: pluginID }));
})
);
webui.post(
'/data/db',
json(),
wrap(async (req, res) => {
const command = req.body.command;
const args = req.body.args;
const plugin = req.body.plugin;
try {
switch (command) {
case 'FindOne':
res.send((await (APIFindOne as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
case 'Find':
res.send((await (APIFind as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
case 'Insert':
res.send((await (APIInsert as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
case 'Remove':
res.send((await (APIRemove as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
case 'Update':
res.send((await (APIUpdate as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
case 'Upsert':
res.send((await (APIUpsert as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
case 'Count':
res.send((await (APICount as any)({ name: plugin, core: false }, ...args)) || '<null>');
break;
}
} catch (err) {
res.send({ error: err.toString() });
}
})
);
webui.delete(
'/data/:plugin',
wrap(async (req, res) => {
const plugin = req.params['plugin'];
if (plugin && plugin.length > 0) await PurgePlugin(plugin);
const pluginID = req.params['plugin'];
if (pluginID && pluginID.length > 0) await PurgePlugin(pluginID);
const instance = ROOT_CONTAINER.getPluginByID(plugin);
if (instance) {
const plugin = ROOT_CONTAINER.getPluginByID(pluginID);
if (plugin) {
// Re-register for init data
try {
instance.Register();
plugin.Register();
} catch (err) {
Logger.error(err, { plugin });
Logger.error(err, { plugin: pluginID });
}
}
res.sendStatus(200);