/** * The UGC Server page: counts and a list of what the UGC server made of players' models and modular builds (from the * database), its live status and previews (from the UGC server itself, at ugc_public_url), and making things again. */ (function () { 'use strict'; var kind = 'model', state = '', page = 0, ugcUrl = '', canManage = false, viewer = null; var STATES = { pending: ['Waiting', 'secondary'], done: ['Made', 'success'], failed: ['Failed', 'danger'] }; function serverUrl() { return (ugcUrl || (location.protocol + '//' + location.hostname + ':2008')).replace(/\/+$/, ''); } function fileUrl(id, name) { return serverUrl() + '/files/' + kind + '/' + encodeURIComponent(id) + '/' + name; } function countCard(title, c) { return '
' + esc(i.modules) + '' : '';
if (i.error) details += 'enable_ugc_server on, and ugc_public_url right?';
});
}
function remake(body, question) {
if (question && !confirm(question)) return;
body.kind = kind;
api.post('/api/ugc/reprocess', body).then(function (d) {
if (!d.success) { toast(d.error || 'Failed', 'danger'); return; }
toast(d.message, 'success');
load();
});
}
function preview(id) {
document.getElementById('previewTitle').textContent = 'Model ' + id;
document.getElementById('previewIcon').src = fileUrl(id, 'icon.png');
document.getElementById('previewLinks').innerHTML = 'Download the mesh (.nif)