diff --git a/src/main/frontend/src/Home.vue b/src/main/frontend/src/Home.vue index 1f758bdbe..a712cb7f5 100644 --- a/src/main/frontend/src/Home.vue +++ b/src/main/frontend/src/Home.vue @@ -261,6 +261,6 @@ export default { } } #relevanceBox { - margin-right: 5px; + margin-right: 5px; } diff --git a/src/main/frontend/src/VersionList.vue b/src/main/frontend/src/VersionList.vue index 15c77fcee..802847586 100644 --- a/src/main/frontend/src/VersionList.vue +++ b/src/main/frontend/src/VersionList.vue @@ -128,9 +128,11 @@ export default { }, created() { this.update(); - apiV2Request('permissions', 'GET', { author: window.PROJECT_OWNER, slug: window.PROJECT_SLUG }).then(response => { - this.canUpload = response.permissions.includes('create_version'); - }); + apiV2Request('permissions', 'GET', { author: window.PROJECT_OWNER, slug: window.PROJECT_SLUG }).then( + response => { + this.canUpload = response.permissions.includes('create_version'); + } + ); this.$watch( () => this.page, () => { diff --git a/src/main/frontend/src/entrypoints/version-list.js b/src/main/frontend/src/entrypoints/version-list.js index b9c3e4fb8..acd416beb 100644 --- a/src/main/frontend/src/entrypoints/version-list.js +++ b/src/main/frontend/src/entrypoints/version-list.js @@ -1,4 +1,7 @@ import { createApp } from 'vue'; +import $ from 'jquery'; import VersionList from '@/VersionList'; +$.ajaxSetup(window.ajaxSettings); + createApp(VersionList).mount('#version-list'); diff --git a/src/main/java/io/papermc/hangar/controller/ApplicationController.java b/src/main/java/io/papermc/hangar/controller/ApplicationController.java index eb92a5be6..c13cbd4c7 100644 --- a/src/main/java/io/papermc/hangar/controller/ApplicationController.java +++ b/src/main/java/io/papermc/hangar/controller/ApplicationController.java @@ -81,6 +81,11 @@ public class ApplicationController extends HangarController { private final HttpServletRequest request; + // TODO remove + private final List paperVersions = List.of("1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16"); + private final List waterfallVersions = List.of("1.11", "1.11", "1.12", "1.13", "1.14", "1.15", "1.16"); + private final List velocityVersions = List.of("1.0", "1.1"); + @Autowired public ApplicationController(HangarDao platformVersionsDao, UserService userService, ProjectService projectService, OrgService orgService, VersionService versionService, FlagService flagService, UserActionLogService userActionLogService, JobService jobService, SitemapService sitemapService, StatsService statsService, StatusZ statusZ, ObjectMapper mapper, HangarConfig hangarConfig, HttpServletRequest request) { this.platformVersionsDao = platformVersionsDao; @@ -97,6 +102,18 @@ public class ApplicationController extends HangarController { this.hangarConfig = hangarConfig; this.request = request; this.statsService = statsService; + + initPlatformVersions(); + } + + // TODO remove + private void initPlatformVersions() { + Map> platformVersions = platformVersionsDao.get().getVersions(); + if (platformVersions.isEmpty()) { + platformVersionsDao.get().insert(paperVersions.stream().map(v -> new PlatformVersionsTable(Platform.PAPER, v)).collect(Collectors.toList())); + platformVersionsDao.get().insert(velocityVersions.stream().map(v -> new PlatformVersionsTable(Platform.VELOCITY, v)).collect(Collectors.toList())); + platformVersionsDao.get().insert(waterfallVersions.stream().map(v -> new PlatformVersionsTable(Platform.WATERFALL, v)).collect(Collectors.toList())); + } } @GetMapping("/")