Skip to content

Web Console

CoreLib includes a lightweight HTTP Web Console. WebConsoleService starts the embedded HTTP server, serves the frontend bundled under EmakiCoreLib/src/main/resources/web, and lets the browser inspect module status, browse registered configuration trees, edit structured YAML, open source editors, manage scripts/GUI/item files, and load module-provided frontend extensions.

The Web Console is a high-permission maintenance entry point. Change the default password before enabling it, and prefer binding it to 127.0.0.1, a private network address, or a protected reverse proxy.

Commands

CoreLib registers /emakicorelib with aliases /corelib and /emakicore.

CommandDescriptionPermission
/emakicorelib helpShow CoreLib command help.None
/emakicorelib webPrint the Web Console address and a clickable link when supported. Aliases: webconsole, url, link.emakicorelib.web
/emakicorelib reloadReload CoreLib configuration, action system, and Web Console.emakicorelib.reload
`/emakicorelib webdebug [allfrontendbackend]`

Permissions:

PermissionDefaultDescription
emakicorelib.adminopAdmin umbrella permission, including Web Console and reload.
emakicorelib.webopAllows viewing the Web Console link.
emakicorelib.reloadopAllows reloading CoreLib and toggling Web Console debug logging.

Configuration

The configuration lives under plugins/EmakiCoreLib/config.yml > web_console. The current default resource writes the minimal security section:

yaml
web_console:
  enabled: false
  host: "127.0.0.1"
  port: 38765
  public_access_warning: true
  auth:
    username: "EmakiAdmin"
    password: "EmakiAdminPassword"
    session_timeout_minutes: 60
  security:
    allow_config_write: false
    max_request_body_kb: 256

The source also supports optional nodes. Older generated configs can omit them and still use built-in defaults:

yaml
web_console:
  security:
    allowed_modules: []
  config_browser:
    max_file_size_kb: 512
    allowed_extensions:
      - ".yml"
      - ".yaml"
      - ".json"
      - ".txt"

allowed_modules: [] means no explicit module allowlist; the console uses registered module IDs. Fill it only when you need to hide or isolate specific installed modules.

Fields

FieldTypeDefaultDescription
enabledbooleanfalseStarts the embedded HTTP service.
hoststring127.0.0.1Bind address. 0.0.0.0 listens on all interfaces and must be protected.
portint38765Listening port. Invalid ports fall back to 38765.
public_access_warningbooleantrueReturns a warning flag in login responses for risky public access.
auth.usernamestringresource default EmakiAdmin, internal default adminLogin username.
auth.passwordstringresource default EmakiAdminPassword, internal default change-meLogin password. Change it before enabling.
auth.session_timeout_minutesint60Token lifetime, minimum 1 minute.
security.allow_config_writebooleanfalseAllows saving config, script, GUI, item, or custom resource files.
security.max_request_body_kbint256Request body limit. Increase it for large YAML or script saves.
security.allowed_moduleslist[]Module ID allowlist. Empty means all registered modules.
config_browser.max_file_size_kbint512Max file size readable by the config browser.
config_browser.allowed_extensionslist.yml/.yaml/.json/.txtAllowed extensions. Values are normalized to lowercase with a leading dot.

Security behavior

Current source behavior:

  1. enabled=false means no HTTP server is started.
  2. If the config falls back to the internal password change-me, startup is refused.
  3. The generated sample password is EmakiAdminPassword; it is not blocked by the change-me check, so production servers must still change it.
  4. After login, frontend API requests use a bearer token. Expired tokens require logging in again.
  5. When allow_config_write=false, save/create/delete endpoints reject writes; reads and previews remain available.
  6. /extensions/ scripts are loaded with <script> tags and therefore cannot send Authorization headers. The backend only serves registered plugin resources from this route.
  7. File paths are checked against absolute paths, .., cross-module access, and unregistered extension paths.

Recommended operation:

  • Bind to 127.0.0.1 or a trusted private network for routine use.
  • For public access, place it behind HTTPS reverse proxy and additional access control.
  • Keep allow_config_write=false on production servers and enable it only during maintenance windows.
  • Run /emakicorelib reload after changing Web Console configuration.
  • Use /emakicorelib webdebug frontend, backend, or all temporarily while troubleshooting, then disable debug logging again.

Current capabilities

CapabilityDescription
Login/sessionPassword login with token-based API access.
Module treeReads modules, files, child files, icons, versions, and status from the backend registry.
Structured config editorEdits single-file CONFIG nodes and lazily loads glob child-file nodes.
Source editorOpens source for config, GUI, item, script, and custom resource files with revision conflict checks.
File create/deleteCreates and deletes child files under glob entries such as **/*.yml or **/*.js.
GUI editorGeneric GUI surface for Bukkit InventoryType, titles, rows, slots, display items, sounds, and components.
Item editorGeneric ITEM surface for field forms, source editing, item preview, and custom field renderers.
Runtime informationRuntime libraries, economy providers, name/lore action types, and Bukkit DamageCause enum values.
Variable-map editingvariablesMap fields use a dedicated key/value editor instead of plain object or text editing.
Changed-field highlightThe structured editor tracks changed paths and highlights modified fields before saving.
Frontend extensionsDynamically loads module IIFE scripts returned by the registry; scripts register pages, fields, translations, and preview logic through window.EmakiWebConsole.

Declarative registration

Business modules currently register their Web Console entries mainly through src/main/resources/web-console.yml, then call:

java
WebConsoleRegistry.registerFromYaml(this);

On disable or reload they call:

java
WebConsoleRegistry.unregisterModule(this);

Supported web-console.yml sections:

SectionDescription
moduleModule metadata: name, summary, tone, icon. Current built-in modules mostly define tone and SVG icon; display text is provided by frontend i18n.
filesFile entries. Each supports path, kind, title, comment, and editor.
extensionsFrontend extension scripts. Each supports id and resource.
nodesStructured config node metadata. Each supports path, type, label, comment, and creatableChildren.
commentsLegacy node-comment format kept for compatibility.

File kinds

kindBackend registrationDefault frontend behavior
CONFIGregisterConfigFileStructured editing for fixed files; child-file tree for glob paths.
GUIregisterGuiFileGeneric GUI editor; can bind a dedicated editor with editor.
ITEMregisterItemFileGeneric item editor; can bind a dedicated editor with editor.
SCRIPTregisterScriptFileScript text read/write interface.
Other valuesregisterResourceFileCustom resource kind exposed to the frontend surface registry, such as SET.

Structured field types

Besides the base text, number, boolean, list, and object types, current Web Console schemas can use these CoreLib field types:

TypeDescription
stringList / numberList / actionsFrontend list display overrides. actions uses the shared Name/Lore action-chain editor.
effectsShared effect-list editor. The selected effect type controls which payload fields are shown.
economyProviderShared economy provider selector. Options come from the runtime CoreLib economy manager, with auto as the standard default.
variablesMapKey/value variable-map editor for dynamic variable tables.
dynamic_mapTreats an object node as an editable dynamic-key map.
enum:A,B,CStatic enum options.
dynamic_enum:folderDynamic enum options loaded from YAML ids or file names under a module data folder.

Registered module entries

ModuleRegistered file entriesFrontend extension
EmakiCoreLibconfig.yml, scripts/**/*.jsCore frontend shell and generic components.
EmakiAttributeconfig.yml, attribute_balance.yml, attributes/**/*.yml, damage_types/**/*.yml, lore_formats/**/*.yml, conditions/**/*.ymlemakiattribute:locale for field metadata and runtime enum usage.
EmakiForgeconfig.yml, recipes/**/*.yml, item_adjustments/**/*.yml, gui/**/*.ymlemakiforge:gui-surface for forge config schemas and GUI editor.
EmakiStrengthenconfig.yml, recipes/**/*.yml, gui/**/*.ymlemakistrengthen:gui-surface for strengthen config, recipes, and GUI editor.
EmakiCookingconfig.yml, recipes/**/*.yml, gui/**/*.ymlemakicooking:gui-surface for station config and cooking GUI editor.
EmakiGemconfig.yml, conditions/**/*.yml, resonances/**/*.yml, gui/**/*.yml, items/**/*.yml, gems/**/*.ymlemakigem:item-surface for gem/socket item editors, cost/upgrade fields, local previews, and GUI editor.
EmakiSkillsconfig.yml, skills/**/*.yml, resources/**/*.yml, gui/**/*.ymlemakiskills:gui-surface for skills, resources, triggers, and GUI editor.
EmakiItemconfig.yml, items/**/*.yml, sets/**/*.ymlemakiitem:locale for SET kind, item/set editors, field renderers, and source adapter.

HTTP API overview

The service uses the JDK HttpServer. Main routes include:

PathMethodDescription
/api/auth/loginPOSTLog in and receive a token.
/api/sessionGETValidate the current token session.
/api/modulesGETShow allowed module install/enabled/version status.
/api/registryGETReturn module tree, file entries, editor descriptors, GUI types, runtime enums, and extension scripts.
/api/registry/fileGETReturn structured YAML nodes for a glob child file.
/api/registry/savePOSTSave a structured config node.
/api/files/createPOSTCreate a child file under a glob entry.
/api/files/deletePOSTDelete a child file after path confirmation.
/api/configs/createPOSTCompatibility config-file creation route.
/api/configs/treeGETBrowse a module config directory.
/api/configs/read / /api/configs/saveGET / POSTRead or save config source.
/api/librariesGETShow CoreLib runtime library information.
/api/debug/frontend-errorPOSTReport frontend errors.
/api/scripts/read / /api/scripts/saveGET / POSTRead or save scripts.
/api/gui/read / /api/gui/saveGET / POSTRead or save GUI YAML.
/api/items/read / /api/items/saveGET / POSTRead or save item YAML.
/api/resources/read / /api/resources/saveGET / POSTRead or save custom-kind YAML resources.
/api/items/previewPOSTGenerate an item display preview from YAML content.
/api/items/action-typesGETReturn registered name/lore operation types.
/api/economy/providersGETReturn economy provider options and currently available providers.
/extensions/{moduleId}/{resource}GETServe a registered frontend extension script.

These routes are primarily internal frontend routes. Manual calls are only recommended for debugging, reverse-proxy integration, or frontend extension development.

Item preview

WebItemPreviewService can simulate item display output from YAML content:

  • Generic items: reads display_name / item_name / id, lore, name_actions, and lore_actions.
  • Gem definitions: reads gem_type, levels, effects, inlay_cost, extract_cost, and upgrade.
  • Gem socket items: reads match.item_sources, slots, default_open_slots, allowed_gem_types, max_same_type, and max_same_id.

Preview output includes rendered name/lore, resolved variables, operation steps, and summaries for effects, upgrades, materials, and costs. It is an editing aid only and does not replace real server-side item generation, PDC writes, or external item-source resolution.

Gem also registers local preview fallbacks for gem and socket-item editors when server-side preview is unavailable or immediate draft feedback is needed.

Troubleshooting

/emakicorelib web prints a URL but the page does not open

Check:

  1. web_console.enabled=true.
  2. host is reachable from the browser machine.
  3. If host=0.0.0.0, the clickable link falls back to 127.0.0.1; replace it with the real server IP or domain for remote access.
  4. Firewall, container port mapping, or reverse proxy allows the port.
  5. The server console has no Web Console startup error.

Save buttons fail

Check:

  1. security.allow_config_write=true.
  2. The login token has not expired.
  3. The request body does not exceed security.max_request_body_kb.
  4. The file extension is allowed by config_browser.allowed_extensions.
  5. The module is allowed by security.allowed_modules, or the allowlist is empty.
  6. The server process can write the target file.
  7. No revision conflict occurred; refresh before saving again if another admin changed the file.

A module is missing from the tree

Confirm the plugin is enabled, then check:

  • The plugin calls WebConsoleRegistry.registerFromYaml(this) during enable.
  • The plugin JAR contains web-console.yml.
  • web-console.yml registers at least one file entry.
  • If security.allowed_modules is configured, it contains the module ID such as EmakiGem.
  • Reload cleans stale entries through unregisterModule and then registers again; if it is still missing, check for web-console.yml parse warnings.

A frontend extension fails to load

Check:

  1. web-console.yml > extensions[].resource matches the resource path inside the JAR.
  2. The resource path does not start with / and does not contain ...
  3. Vite outputs the bundle to src/main/resources/web-extensions and it is included in the JAR.
  4. The bundle uses IIFE format and externalizes react and emaki-web-console to global React and EmakiWebConsole.
  5. Browser console and /emakicorelib webdebug frontend logs do not report script errors.

See Web Extension Integration for implementation details.