removed jquery webjar

All webjars removed including webjar locator.
This commit is contained in:
Jake Potrebic 2020-09-26 10:32:19 -07:00 committed by MiniDigger
parent c5993ada30
commit f1803733b6
13 changed files with 170 additions and 174 deletions

22
pom.xml
View File

@ -36,9 +36,7 @@
<snakeyaml.version>1.26</snakeyaml.version>
<jsitemapgenerator.version>4.5</jsitemapgenerator.version>
<!-- webjars dependencies -->
<webjars-locator.version>0.40</webjars-locator.version>
<jquery.version>3.5.1</jquery.version>
<apache-commons-lang.version>3.11</apache-commons-lang.version>
<!-- plugins -->
<frontend-maven-plugin.version>1.10.0</frontend-maven-plugin.version>
@ -93,6 +91,12 @@
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${apache-commons-lang.version}</version>
</dependency>
<!--SpringFox dependencies -->
<dependency>
<groupId>io.springfox</groupId>
@ -179,18 +183,6 @@
<version>${jsitemapgenerator.version}</version>
</dependency>
<!-- webjars -->
<dependency>
<groupId>org.webjars</groupId>
<artifactId>webjars-locator</artifactId>
<version>${webjars-locator.version}</version>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>jquery</artifactId>
<version>${jquery.version}</version>
</dependency>
<!-- runtime -->
<dependency>
<groupId>org.springframework.boot</groupId>

View File

@ -117,12 +117,12 @@
<script>
import Tag from './Tag';
import { clearFromEmpty, numberWithCommas } from './../utils';
import { Category, Platform, Visibility } from '../enums';
import { clearFromEmpty, numberWithCommas } from '@/utils';
import { Category, Platform, Visibility } from '@/enums';
import Pagination from './Pagination';
import Icon from './Icon';
import debounce from 'lodash/debounce';
import { API } from '../api';
import { API } from '@/api';
export default {
components: {

View File

@ -194,4 +194,8 @@ $(function() {
false
);
}
if (window.loadDeleteManager) {
window.loadDeleteManager();
}
});

View File

@ -214,6 +214,10 @@ $(function() {
initFlagList();
initBtnEdit();
if (window.buttonClick) {
window.buttonClick();
}
// flag button alert
var flagMsg = $('.flag-msg');
if (flagMsg.length) {

View File

@ -76,13 +76,6 @@ public class MvcConfig implements WebMvcConfigurer {
.setCacheControl(CacheControl.maxAge(1, TimeUnit.DAYS))
.resourceChain(true)
.addResolver(new VersionResourceResolver());
registry
.addResourceHandler("/lib/**")
.addResourceLocations("/webjars/")
.setCacheControl(CacheControl.maxAge(1, TimeUnit.DAYS))
.resourceChain(true)
.addResolver(new VersionResourceResolver());
}
@Bean

View File

@ -225,7 +225,7 @@ public class VersionsController extends HangarController {
return _showCreator(author, slug, pendingVersion);
}
private final Pattern URL_PATTERN = Pattern.compile("^https?://[^\\s$.?#].[^\\s]*$");
private final Pattern URL_PATTERN = Pattern.compile("(https?://(?:www\\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|www\\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\\.[^\\s]{2,}|https?://(?:www\\.|(?!www))[a-zA-Z0-9]+\\.[^\\s]{2,}|www\\.[a-zA-Z0-9]+\\.[^\\s]{2,})");
@ProjectPermission(NamedPermission.CREATE_VERSION)
@UserLock(route = Routes.PROJECTS_SHOW, args = "{#author, #slug}")
@ -233,7 +233,7 @@ public class VersionsController extends HangarController {
@PostMapping(value = "/{author}/{slug}/versions/new/create", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
public ModelAndView create(@PathVariable String author, @PathVariable String slug, @RequestParam String externalUrl) {
ProjectData projData = projectData.get();
if (!URL_PATTERN.matcher(externalUrl).matches()) { // TODO check list of allowed hosts
if (!URL_PATTERN.matcher(externalUrl).matches()) {
ModelAndView mav = _showCreator(author, slug, null);
return fillModel(AlertUtil.showAlert(mav, AlertType.ERROR, "error.invalidUrl"));
}

View File

@ -24,12 +24,9 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
<link rel="prefetch" href="<@hangar.url "css/chunk-vendors.css" />">
<link rel="prefetch" href="<@hangar.url "css/main.css" />">
<link rel="prefetch" href="<@hangar.url "manifest/manifest.json" />">
<link rel="prefetch" href="<@hangar.url "js/bootstrap.js" />">
<link rel="prefetch" href="<@hangar.url "lib/jquery/dist/jquery.min.js" />"> <#--TODO this to go away-->
<title>${title} | Hangar</title>
<meta charset="utf-8">
@ -55,9 +52,6 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
<#-- See https://goo.gl/OOhYW5 and https://goo.gl/qRE0vM -->
<link rel="manifest" href="<@hangar.url "manifest/manifest.json" />">
<meta name="theme-color" content="#2980B9">
<script type="text/javascript" src="<@hangar.url "lib/jquery/dist/jquery.min.js" />"></script> <#--TODO this to go away-->
</head>
<body class="site">
<#if showHeader>
@ -107,7 +101,6 @@ showFooter: Boolean = true, noContainer: Boolean = false, additionalMeta: Html =
};
window.ajaxSettings = {"headers": { '${_csrf.headerName}': window.csrf}};
window.isLoggedIn = ${headerData.hasUser()?c};
$.ajaxSetup(window.ajaxSettings);
</script>
</#if>

View File

@ -17,8 +17,8 @@
<#assign message><@spring.messageArgs code="channel.list.title" args=[p.project.ownerName, p.project.slug] /></#assign>
<@base.base title=message additionalScripts=scriptsVar>
<div class="row">
<div class="col-md-6 col-md-offset-3">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card">
<div class="card-header">
<h3 class="card-title"><@spring.message "channel.list.title" /></h3>
@ -62,7 +62,7 @@
</td>
</#if>
<script <#--@CSPNonce.attr-->>
$(function () {
window.loadDeleteManager = function() {
initChannelDelete('#channel-delete-${channel.id}', '${channel.name}', ${versions});
initChannelManager(
"#channel-edit-${channel.id}", "${channel.name}", "${channel.color.hex}",
@ -70,7 +70,7 @@
p.project.ownerName, p.project.slug, channel.name)}",
"post", "Save changes", ${channel.isNonReviewed?string('true', 'false')}
);
});
}
</script>
</tr>
</#list>

View File

@ -15,8 +15,12 @@ Discussion page within Project overview.
topicId: ${p.project.topicId}
};
</script>
<script <#--@CSPNonce.attr-->>
window.buttonClick = function() {
document.getElementsByClassName('btn.edit')[0].click();
}
</script>
<script type="text/javascript" src="<@hangar.url "js/projectDiscuss.js" />"></script>
<#--<script>$(function() { $('.btn-edit').click(); });</script>--> <#-- TODO jquery was removed from this scope -->
</#assign>
<@view.view p=p sp=sp active="#discussion" additionalScripts=scriptsVar>

View File

@ -22,12 +22,16 @@ Documentation page within Project overview.
window.PLUGIN_ID = '${p.getProject().pluginId}';
window.NAMESPACE = '${p.getFullSlug()}';
</script>
<#if editorOpen>
<script <#--@CSPNonce.attr-->>
window.buttonClick = function() {
document.getElementsByClassName('btn-edit')[0].click();
}
</script>
</#if>
<script type="text/javascript" src="<@hangar.url "js/pageCollapse.js" />"></script>
<script type="text/javascript" src="<@hangar.url "js/userSearch.js" />"></script>
<script type="text/javascript" src="<@hangar.url "js/memberList.js" />"></script>
<#if editorOpen>
<script <#--@CSPNonce.attr-->>$(function() { $('.btn-edit').click(); });</script>
</#if>
</#assign>
<@projectView.view p=p sp=sp active="#docs" additionalScripts=scriptsVar>

View File

@ -43,150 +43,154 @@
<#if pending??>
<#-- Show plugin meta -->
<#assign version = pending>
<div class="plugin-meta">
<table class="plugin-meta-table">
<tr>
<td><strong><@spring.message "version" /></strong></td>
<td>
<#if version.versionString??>
${version.versionString}
<div class="plugin-meta">
<table class="plugin-meta-table">
<tr>
<td><strong><@spring.message "version" /></strong></td>
<td>
<#if version.versionString??>
${version.versionString}
<#else>
<div class="form-group">
<label for="version-string-input" class="sr-only">Version String</label>
<input id="version-string-input" class="form-control" type="text" form="form-publish" name="versionString" required placeholder="Version">
</div>
</#if>
</td>
</tr>
<tr>
<td><strong><@spring.message "version.description" /></strong></td>
<td>
<#if version.versionString??>
<#if version.description?has_content>
${version.description}
<#else>
<div class="form-group">
<label for="version-string-input" class="sr-only">Version String</label>
<input id="version-string-input" class="form-control" type="text" form="form-publish" name="versionString" required placeholder="Version">
</div>
</#if>
</td>
</tr>
<tr>
<td><strong><@spring.message "version.description" /></strong></td>
<td>
<#if version.versionString??>
<#if version.description?has_content>
${version.description}
<#if projectDescription?has_content>
${projectDescription}
<#else>
<#if projectDescription?has_content>
${projectDescription}
<#else>
<@spring.message "version.create.noDescription" />
</#if>
<@spring.message "version.create.noDescription" />
</#if>
<#else>
<div class="form-group">
<label for="version-description-input" class="sr-only">Version Description</label>
<input type="text" form="form-publish" name="versionDescription" class="form-control" id="version-description-input">
</div>
</#if>
</td>
</tr>
<#if version.fileName?? && !version.externalUrl??>
<tr>
<td><strong><@spring.message "version.filename" /></strong></td>
<td>${version.fileName}</td>
</tr>
<tr>
<td><strong><@spring.message "version.fileSize" /></strong></td>
<td>${utils.formatFileSize(version.fileSize)}</td>
</tr>
<#else>
<tr>
<td><strong><@spring.message "version.externalUrl" /></strong></td>
<td>
<div class="form-group">
<label for="external-url-input" class="sr-only"></label>
<input id="external-url-input" class="form-control" type="text" value="${version.externalUrl}" name="externalUrl" form="form-publish" required>
</div>
</td>
</tr>
</#if>
<tr>
<td><strong>Channel</strong></td>
<td class="form-inline">
<#-- Show channel selector if old project, editor if new project -->
<select id="select-channel" form="form-publish" name="channel-input" class="form-control">
<#list channels as channel>
<option value="${channel.name}" data-color="${channel.color.hex}" <#if channel.name == version.channelName>selected</#if>>
${channel.name}
</option>
</#list>
</select>
<a href="#">
<i id="channel-new" class="fas fa-plus" data-toggle="modal" data-target="#channel-settings"></i>
</a>
</td>
</tr>
<tr>
<td><strong>Platform</strong></td>
<td>
<#if version.dependencies??>
<div class="float-right" id="upload-platform-tags">
<#list version.dependenciesAsGhostTags as pair>
<@projectTag.tagTemplate @helper["io.papermc.hangar.model.viewhelpers.ViewTag"].fromVersionTag(pair.right) pair.left "form-publish" />
</#list>
</div>
<#else>
<div id="platform-choice"></div>
</#if>
</td>
</tr>
<tr>
<td>
<label for="is-unstable-version" class="form-check-label">
<strong><@spring.message "version.create.unstable" /></strong>
</label>
</td>
<td class="rv">
<div class="form-check">
<input id="is-unstable-version" class="form-check-input" form="form-publish" name="unstable" type="checkbox" value="true">
<#else>
<div class="form-group">
<label for="version-description-input" class="sr-only">Version Description</label>
<input type="text" form="form-publish" name="versionDescription" class="form-control" id="version-description-input">
</div>
<div class="clearfix"></div>
</td>
</#if>
</td>
</tr>
<#if version.fileName?? && !version.externalUrl??>
<tr>
<td><strong><@spring.message "version.filename" /></strong></td>
<td>${version.fileName}</td>
</tr>
<tr>
<td>
<label for="is-recommended-version" class="form-check-label">
<strong>Recommended</strong>
</label>
</td>
<td class="rv">
<div class="form-check">
<input id="is-recommended-version" class="form-check-input" form="form-publish" name="recommended" type="checkbox" checked value="true">
</div>
<div class="clearfix"></div>
</td>
<td><strong><@spring.message "version.fileSize" /></strong></td>
<td>${utils.formatFileSize(version.fileSize)}</td>
</tr>
<#else>
<tr>
<td><strong><@spring.message "version.externalUrl" /></strong></td>
<td>
<label for="create-forum-post-version" class="form-check-label"></label>
<strong>Create forum post</strong>
</td>
<td class="rv">
<div class="form-check">
<#-- @ftlvariable name="forumSync" type="java.lang.Boolean" -->
<input id="create-forum-post-version" class="form-check-input" form="form-publish" name="forum-post" type="checkbox" <#if forumSync> checked </#if> value="true">
<div class="form-group">
<label for="external-url-input" class="sr-only"></label>
<input id="external-url-input" class="form-control" type="text" value="${version.externalUrl}" name="externalUrl" form="form-publish" required>
</div>
<div class="clearfix"></div>
</td>
</tr>
</table>
</div>
</#if>
<tr>
<td><strong>Channel</strong></td>
<td class="form-inline">
<#-- Show channel selector if old project, editor if new project -->
<select id="select-channel" form="form-publish" name="channel-input" class="form-control">
<#list channels as channel>
<option value="${channel.name}" data-color="${channel.color.hex}" <#if channel.name == version.channelName>selected</#if>>
${channel.name}
</option>
</#list>
</select>
<a href="#">
<i id="channel-new" class="fas fa-plus" data-toggle="modal" data-target="#channel-settings"></i>
</a>
</td>
</tr>
<tr>
<td><strong>Platform</strong></td>
<td>
<#if version.dependencies??>
<div class="float-right" id="upload-platform-tags">
<#list version.dependenciesAsGhostTags as pair>
<@projectTag.tagTemplate @helper["io.papermc.hangar.model.viewhelpers.ViewTag"].fromVersionTag(pair.right) pair.left "form-publish" />
</#list>
</div>
<#else>
<div id="platform-choice"></div>
</#if>
</td>
</tr>
<tr>
<td>
<label for="is-unstable-version" class="form-check-label">
<strong><@spring.message "version.create.unstable" /></strong>
</label>
</td>
<td class="rv">
<div class="form-check">
<input id="is-unstable-version" class="form-check-input" form="form-publish" name="unstable" type="checkbox" value="true">
</div>
<div class="clearfix"></div>
</td>
</tr>
<tr>
<td>
<label for="is-recommended-version" class="form-check-label">
<strong>Recommended</strong>
</label>
</td>
<td class="rv">
<div class="form-check">
<input id="is-recommended-version" class="form-check-input" form="form-publish" name="recommended" type="checkbox" checked value="true">
</div>
<div class="clearfix"></div>
</td>
</tr>
<tr>
<td>
<label for="create-forum-post-version" class="form-check-label"></label>
<strong>Create forum post</strong>
</td>
<td class="rv">
<div class="form-check">
<#-- @ftlvariable name="forumSync" type="java.lang.Boolean" -->
<input id="create-forum-post-version" class="form-check-input" form="form-publish" name="forum-post" type="checkbox" <#if forumSync> checked </#if> value="true">
</div>
<div class="clearfix"></div>
</td>
</tr>
</table>
</div>
<div class="release-bulletin">
<div>
<h3><@spring.message "version.releaseBulletin" /></h3>
<p><@spring.message "version.releaseBulletin.info" /></p>
<div class="release-bulletin">
<div>
<h3><@spring.message "version.releaseBulletin" /></h3>
<p><@spring.message "version.releaseBulletin.info" /></p>
<@editor.editor
cooked=markdownService.render(version.description!"")
savable=false
enabled=true
raw=version.description!""
cancellable=false
targetForm="form-publish"
/>
</div>
<@editor.editor
cooked=markdownService.render(version.description!"")
savable=false
enabled=true
raw=version.description!""
cancellable=false
targetForm="form-publish"
/>
</div>
<script <#--@CSPNonce.attr-->>$(function () { $('.btn-edit').click() });</script>
</div>
<script <#--@CSPNonce.attr-->>
window.buttonClick = function() {
document.getElementsByClassName('btn-edit')[0].click();
}
</script>
</#if>
<@form.form action=Routes.VERSIONS_UPLOAD.getRouteUrl(ownerName, projectSlug) method="POST"

View File

@ -21,9 +21,9 @@ Base template for Project overview.
window.ACTIVE_NAV = "${active}";
</script>
${additionalScripts}
<script type="text/javascript" src="<@hangar.url "js/projectDetail.js" />"></script>
<script type="text/javascript" src="<@hangar.url "js/pageEdit.js" />"></script>
${additionalScripts}
</#assign>
<#assign metaVar>

View File

@ -5,9 +5,7 @@
<#macro url path>
<#compress>
<#if path?starts_with("lib")>
/${path}
<#elseif config.useWebpack>
<#if config.useWebpack>
http://localhost:8081/${path}
<#else>
/assets/${path}