You've already forked AstralRinth
forked from didirus/AstralRinth
move to cloudflare workers (#1229)
* move to cloudflare workers * remove junk
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -5,7 +5,9 @@ node_modules
|
|||||||
.cache
|
.cache
|
||||||
.output
|
.output
|
||||||
.env
|
.env
|
||||||
|
.dev.vars
|
||||||
dist
|
dist
|
||||||
|
.wrangler/
|
||||||
|
|
||||||
generated/
|
generated/
|
||||||
!.gitkeep
|
!.gitkeep
|
||||||
|
|||||||
@@ -258,8 +258,10 @@ export default defineNuxtConfig({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
apiBaseUrl: process.env.BASE_URL ?? getApiUrl(),
|
// @ts-ignore
|
||||||
rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY,
|
apiBaseUrl: process.env.BASE_URL ?? globalThis.BASE_URL ?? getApiUrl(),
|
||||||
|
// @ts-ignore
|
||||||
|
rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY ?? globalThis.RATE_LIMIT_IGNORE_KEY,
|
||||||
public: {
|
public: {
|
||||||
apiBaseUrl: getApiUrl(),
|
apiBaseUrl: getApiUrl(),
|
||||||
ariadneBaseUrl: getAriadneUrl(),
|
ariadneBaseUrl: getAriadneUrl(),
|
||||||
@@ -294,11 +296,13 @@ export default defineNuxtConfig({
|
|||||||
})
|
})
|
||||||
|
|
||||||
function getApiUrl() {
|
function getApiUrl() {
|
||||||
return process.env.BROWSER_BASE_URL ?? STAGING_API_URL
|
// @ts-ignore
|
||||||
|
return process.env.BROWSER_BASE_URL ?? globalThis.BROWSER_BASE_URL ?? STAGING_API_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAriadneUrl() {
|
function getAriadneUrl() {
|
||||||
return process.env.BROWSER_ARIADNE_URL ?? STAGING_ARIADNE_URL
|
// @ts-ignore
|
||||||
|
return process.env.BROWSER_ARIADNE_URL ?? globalThis.BROWSER_ARIADNE_URL ?? STAGING_ARIADNE_URL
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDomain() {
|
function getDomain() {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"dev": "nuxi dev",
|
"dev": "nuxi dev",
|
||||||
"generate": "nuxi generate",
|
"generate": "nuxi generate",
|
||||||
"preview": "nuxi preview",
|
"preview": "nuxi preview",
|
||||||
"postinstall": "nuxi prepare",
|
"postinstall": "nuxi prepare && patch-package",
|
||||||
"lint:js": "eslint . --ext .js,.vue,.ts",
|
"lint:js": "eslint . --ext .js,.vue,.ts",
|
||||||
"lint": "npm run lint:js && prettier --check .",
|
"lint": "npm run lint:js && prettier --check .",
|
||||||
"fix": "eslint . --fix --ext .js,.vue,.ts && prettier --write .",
|
"fix": "eslint . --fix --ext .js,.vue,.ts && prettier --write .",
|
||||||
@@ -33,7 +33,8 @@
|
|||||||
"typescript": "^5.0.4",
|
"typescript": "^5.0.4",
|
||||||
"vite-plugin-eslint": "^1.8.1",
|
"vite-plugin-eslint": "^1.8.1",
|
||||||
"vite-svg-loader": "^4.0.0",
|
"vite-svg-loader": "^4.0.0",
|
||||||
"vue-tsc": "^1.6.5"
|
"vue-tsc": "^1.6.5",
|
||||||
|
"patch-package": "^7.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ltd/j-toml": "^1.38.0",
|
"@ltd/j-toml": "^1.38.0",
|
||||||
|
|||||||
@@ -341,7 +341,7 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script setup>
|
||||||
import { Multiselect } from 'vue-multiselect'
|
import { Multiselect } from 'vue-multiselect'
|
||||||
import ProjectCard from '~/components/ui/ProjectCard.vue'
|
import ProjectCard from '~/components/ui/ProjectCard.vue'
|
||||||
import Pagination from '~/components/ui/Pagination.vue'
|
import Pagination from '~/components/ui/Pagination.vue'
|
||||||
@@ -361,39 +361,9 @@ import ImageIcon from '~/assets/images/utils/image.svg'
|
|||||||
|
|
||||||
import Promotion from '~/components/ads/Promotion.vue'
|
import Promotion from '~/components/ads/Promotion.vue'
|
||||||
|
|
||||||
export default defineNuxtComponent({
|
const sidebarMenuOpen = ref(false)
|
||||||
components: {
|
const showAllLoaders = ref(false)
|
||||||
LogoAnimated,
|
|
||||||
Promotion,
|
|
||||||
ProjectCard,
|
|
||||||
Pagination,
|
|
||||||
Multiselect,
|
|
||||||
SearchFilter,
|
|
||||||
Checkbox,
|
|
||||||
ClientIcon,
|
|
||||||
ServerIcon,
|
|
||||||
SearchIcon,
|
|
||||||
ClearIcon,
|
|
||||||
FilterIcon,
|
|
||||||
GridIcon,
|
|
||||||
ListIcon,
|
|
||||||
ImageIcon,
|
|
||||||
},
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
previousMaxResults: 20,
|
|
||||||
|
|
||||||
maxResultsForView: {
|
|
||||||
list: [5, 10, 15, 20, 50, 100],
|
|
||||||
grid: [6, 12, 18, 24, 48, 96],
|
|
||||||
gallery: [6, 10, 16, 20, 50, 100],
|
|
||||||
},
|
|
||||||
|
|
||||||
sidebarMenuOpen: false,
|
|
||||||
showAllLoaders: false,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setup() {
|
|
||||||
const data = useNuxtApp()
|
const data = useNuxtApp()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
@@ -491,7 +461,7 @@ export default defineNuxtComponent({
|
|||||||
const params = [`limit=${maxResults.value}`, `index=${sortType.value.name}`]
|
const params = [`limit=${maxResults.value}`, `index=${sortType.value.name}`]
|
||||||
|
|
||||||
if (query.value.length > 0) {
|
if (query.value.length > 0) {
|
||||||
params.push(`query=${query.value.replace(/ /g, '+')}`)
|
params.push(`query=${encodeURIComponent(query.value.replace(/ /g, '+'))}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -511,9 +481,7 @@ export default defineNuxtComponent({
|
|||||||
formattedFacets.push(orFacets.value)
|
formattedFacets.push(orFacets.value)
|
||||||
} else if (projectType.value.id === 'plugin') {
|
} else if (projectType.value.id === 'plugin') {
|
||||||
formattedFacets.push(
|
formattedFacets.push(
|
||||||
data.$tag.loaderData.allPluginLoaders.map(
|
data.$tag.loaderData.allPluginLoaders.map((x) => `categories:'${encodeURIComponent(x)}'`)
|
||||||
(x) => `categories:'${encodeURIComponent(x)}'`
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
} else if (projectType.value.id === 'mod') {
|
} else if (projectType.value.id === 'mod') {
|
||||||
formattedFacets.push(
|
formattedFacets.push(
|
||||||
@@ -521,9 +489,7 @@ export default defineNuxtComponent({
|
|||||||
)
|
)
|
||||||
} else if (projectType.value.id === 'datapack') {
|
} else if (projectType.value.id === 'datapack') {
|
||||||
formattedFacets.push(
|
formattedFacets.push(
|
||||||
data.$tag.loaderData.dataPackLoaders.map(
|
data.$tag.loaderData.dataPackLoaders.map((x) => `categories:'${encodeURIComponent(x)}'`)
|
||||||
(x) => `categories:'${encodeURIComponent(x)}'`
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -568,7 +534,7 @@ export default defineNuxtComponent({
|
|||||||
formattedFacets.push([`project_type:${projectType.value.actual}`])
|
formattedFacets.push([`project_type:${projectType.value.actual}`])
|
||||||
}
|
}
|
||||||
|
|
||||||
params.push(`facets=${JSON.stringify(formattedFacets)}`)
|
params.push(`facets=${encodeURIComponent(JSON.stringify(formattedFacets))}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const offset = (currentPage.value - 1) * maxResults.value
|
const offset = (currentPage.value - 1) * maxResults.value
|
||||||
@@ -587,7 +553,7 @@ export default defineNuxtComponent({
|
|||||||
return `${base}${url}`
|
return `${base}${url}`
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
transform(hits) {
|
transform: (hits) => {
|
||||||
noLoad.value = false
|
noLoad.value = false
|
||||||
return hits
|
return hits
|
||||||
},
|
},
|
||||||
@@ -599,7 +565,7 @@ export default defineNuxtComponent({
|
|||||||
results.value ? Math.ceil(results.value.total_hits / results.value.limit) : 1
|
results.value ? Math.ceil(results.value.total_hits / results.value.limit) : 1
|
||||||
)
|
)
|
||||||
|
|
||||||
const onSearchChange = (newPageNumber) => {
|
function onSearchChange(newPageNumber) {
|
||||||
noLoad.value = true
|
noLoad.value = true
|
||||||
|
|
||||||
currentPage.value = newPageNumber
|
currentPage.value = newPageNumber
|
||||||
@@ -617,7 +583,7 @@ export default defineNuxtComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const getSearchUrl = (offset, useObj) => {
|
function getSearchUrl(offset, useObj) {
|
||||||
const queryItems = []
|
const queryItems = []
|
||||||
const obj = {}
|
const obj = {}
|
||||||
|
|
||||||
@@ -675,33 +641,10 @@ export default defineNuxtComponent({
|
|||||||
return useObj ? obj : url
|
return useObj ? obj : url
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const categoriesMap = computed(() => {
|
||||||
query,
|
|
||||||
results,
|
|
||||||
facets,
|
|
||||||
orFacets,
|
|
||||||
selectedVersions,
|
|
||||||
onlyOpenSource,
|
|
||||||
showSnapshots,
|
|
||||||
selectedEnvironments,
|
|
||||||
sortTypes,
|
|
||||||
sortType,
|
|
||||||
maxResults,
|
|
||||||
currentPage,
|
|
||||||
pageCount,
|
|
||||||
projectType,
|
|
||||||
onSearchChange,
|
|
||||||
getSearchUrl,
|
|
||||||
searchLoading,
|
|
||||||
noLoad,
|
|
||||||
metaDescription,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
categoriesMap() {
|
|
||||||
const categories = {}
|
const categories = {}
|
||||||
|
|
||||||
for (const category of this.$sortedCategories) {
|
for (const category of data.$sortedCategories) {
|
||||||
if (categories[category.header]) {
|
if (categories[category.header]) {
|
||||||
categories[category.header].push(category)
|
categories[category.header].push(category)
|
||||||
} else {
|
} else {
|
||||||
@@ -709,129 +652,138 @@ export default defineNuxtComponent({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const newVals = Object.keys(categories).reduce((obj, key) => {
|
return Object.keys(categories).reduce((obj, key) => {
|
||||||
obj[key] = categories[key]
|
obj[key] = categories[key]
|
||||||
return obj
|
return obj
|
||||||
}, {})
|
}, {})
|
||||||
|
})
|
||||||
|
|
||||||
return newVals
|
function clearFilters() {
|
||||||
},
|
for (const facet of [...facets.value]) {
|
||||||
},
|
toggleFacet(facet, true)
|
||||||
methods: {
|
|
||||||
clearFilters() {
|
|
||||||
for (const facet of [...this.facets]) {
|
|
||||||
this.toggleFacet(facet, true)
|
|
||||||
}
|
}
|
||||||
for (const facet of [...this.orFacets]) {
|
for (const facet of [...orFacets.value]) {
|
||||||
this.toggleOrFacet(facet, true)
|
toggleOrFacet(facet, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onlyOpenSource = false
|
onlyOpenSource.value = false
|
||||||
this.selectedVersions = []
|
selectedVersions.value = []
|
||||||
this.selectedEnvironments = []
|
selectedEnvironments.value = []
|
||||||
this.onSearchChange(1)
|
onSearchChange(1)
|
||||||
},
|
}
|
||||||
toggleFacet(elementName, doNotSendRequest = false) {
|
|
||||||
const index = this.facets.indexOf(elementName)
|
function toggleFacet(elementName, doNotSendRequest = false) {
|
||||||
|
const index = facets.value.indexOf(elementName)
|
||||||
|
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.facets.splice(index, 1)
|
facets.value.splice(index, 1)
|
||||||
} else {
|
} else {
|
||||||
this.facets.push(elementName)
|
facets.value.push(elementName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doNotSendRequest) {
|
if (!doNotSendRequest) {
|
||||||
this.onSearchChange(1)
|
onSearchChange(1)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
toggleOrFacet(elementName, doNotSendRequest) {
|
|
||||||
const index = this.orFacets.indexOf(elementName)
|
function toggleOrFacet(elementName, doNotSendRequest) {
|
||||||
|
const index = orFacets.value.indexOf(elementName)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.orFacets.splice(index, 1)
|
orFacets.value.splice(index, 1)
|
||||||
} else {
|
} else {
|
||||||
if (elementName === 'categories:purpur') {
|
if (elementName === 'categories:purpur') {
|
||||||
if (!this.orFacets.includes('categories:paper')) {
|
if (!orFacets.value.includes('categories:paper')) {
|
||||||
this.orFacets.push('categories:paper')
|
orFacets.value.push('categories:paper')
|
||||||
}
|
}
|
||||||
if (!this.orFacets.includes('categories:spigot')) {
|
if (!orFacets.value.includes('categories:spigot')) {
|
||||||
this.orFacets.push('categories:spigot')
|
orFacets.value.push('categories:spigot')
|
||||||
}
|
}
|
||||||
if (!this.orFacets.includes('categories:bukkit')) {
|
if (!orFacets.value.includes('categories:bukkit')) {
|
||||||
this.orFacets.push('categories:bukkit')
|
orFacets.value.push('categories:bukkit')
|
||||||
}
|
}
|
||||||
} else if (elementName === 'categories:paper') {
|
} else if (elementName === 'categories:paper') {
|
||||||
if (!this.orFacets.includes('categories:spigot')) {
|
if (!orFacets.value.includes('categories:spigot')) {
|
||||||
this.orFacets.push('categories:spigot')
|
orFacets.value.push('categories:spigot')
|
||||||
}
|
}
|
||||||
if (!this.orFacets.includes('categories:bukkit')) {
|
if (!orFacets.value.includes('categories:bukkit')) {
|
||||||
this.orFacets.push('categories:bukkit')
|
orFacets.value.push('categories:bukkit')
|
||||||
}
|
}
|
||||||
} else if (elementName === 'categories:spigot') {
|
} else if (elementName === 'categories:spigot') {
|
||||||
if (!this.orFacets.includes('categories:bukkit')) {
|
if (!orFacets.value.includes('categories:bukkit')) {
|
||||||
this.orFacets.push('categories:bukkit')
|
orFacets.value.push('categories:bukkit')
|
||||||
}
|
}
|
||||||
} else if (elementName === 'categories:waterfall') {
|
} else if (elementName === 'categories:waterfall') {
|
||||||
if (!this.orFacets.includes('categories:bungeecord')) {
|
if (!orFacets.value.includes('categories:bungeecord')) {
|
||||||
this.orFacets.push('categories:bungeecord')
|
orFacets.value.push('categories:bungeecord')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.orFacets.push(elementName)
|
orFacets.value.push(elementName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doNotSendRequest) {
|
if (!doNotSendRequest) {
|
||||||
this.onSearchChange(1)
|
onSearchChange(1)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
toggleEnv(environment, sendRequest) {
|
|
||||||
const index = this.selectedEnvironments.indexOf(environment)
|
function toggleEnv(environment, sendRequest) {
|
||||||
|
const index = selectedEnvironments.value.indexOf(environment)
|
||||||
if (index !== -1) {
|
if (index !== -1) {
|
||||||
this.selectedEnvironments.splice(index, 1)
|
selectedEnvironments.value.splice(index, 1)
|
||||||
} else {
|
} else {
|
||||||
this.selectedEnvironments.push(environment)
|
selectedEnvironments.value.push(environment)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sendRequest) {
|
if (!sendRequest) {
|
||||||
this.onSearchChange(1)
|
onSearchChange(1)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
onSearchChangeToTop(newPageNumber) {
|
|
||||||
|
function onSearchChangeToTop(newPageNumber) {
|
||||||
if (process.client) {
|
if (process.client) {
|
||||||
window.scrollTo({ top: 0, behavior: 'smooth' })
|
window.scrollTo({ top: 0, behavior: 'smooth' })
|
||||||
}
|
}
|
||||||
|
|
||||||
this.onSearchChange(newPageNumber)
|
onSearchChange(newPageNumber)
|
||||||
},
|
}
|
||||||
onMaxResultsChange(newPageNumber) {
|
|
||||||
|
function cycleSearchDisplayMode() {
|
||||||
|
data.$cosmetics.searchDisplayMode[projectType.value.id] = data.$cycleValue(
|
||||||
|
data.$cosmetics.searchDisplayMode[projectType.value.id],
|
||||||
|
data.$tag.projectViewModes
|
||||||
|
)
|
||||||
|
saveCosmetics()
|
||||||
|
setClosestMaxResults()
|
||||||
|
}
|
||||||
|
|
||||||
|
const previousMaxResults = ref(20)
|
||||||
|
const maxResultsForView = ref({
|
||||||
|
list: [5, 10, 15, 20, 50, 100],
|
||||||
|
grid: [6, 12, 18, 24, 48, 96],
|
||||||
|
gallery: [6, 10, 16, 20, 50, 100],
|
||||||
|
})
|
||||||
|
|
||||||
|
function onMaxResultsChange(newPageNumber) {
|
||||||
newPageNumber = Math.max(
|
newPageNumber = Math.max(
|
||||||
1,
|
1,
|
||||||
Math.min(
|
Math.min(
|
||||||
Math.floor(newPageNumber / (this.maxResults / this.previousMaxResults)),
|
Math.floor(newPageNumber / (maxResults.value / previousMaxResults.value)),
|
||||||
this.pageCount
|
pageCount.value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
this.previousMaxResults = this.maxResults
|
previousMaxResults.value = maxResults.value
|
||||||
this.onSearchChange(newPageNumber)
|
onSearchChange(newPageNumber)
|
||||||
},
|
}
|
||||||
cycleSearchDisplayMode() {
|
|
||||||
this.$cosmetics.searchDisplayMode[this.projectType.id] = this.$cycleValue(
|
function setClosestMaxResults() {
|
||||||
this.$cosmetics.searchDisplayMode[this.projectType.id],
|
const view = data.$cosmetics.searchDisplayMode[projectType.value.id]
|
||||||
this.$tag.projectViewModes
|
const maxResultsOptions = maxResultsForView.value[view] ?? [20]
|
||||||
)
|
const currentMax = maxResults.value
|
||||||
saveCosmetics()
|
|
||||||
this.setClosestMaxResults()
|
|
||||||
},
|
|
||||||
setClosestMaxResults() {
|
|
||||||
const view = this.$cosmetics.searchDisplayMode[this.projectType.id]
|
|
||||||
const maxResultsOptions = this.maxResultsForView[view] ?? [20]
|
|
||||||
const currentMax = this.maxResults
|
|
||||||
if (!maxResultsOptions.includes(currentMax)) {
|
if (!maxResultsOptions.includes(currentMax)) {
|
||||||
this.maxResults = maxResultsOptions.reduce(function (prev, curr) {
|
maxResults.value = maxResultsOptions.reduce(function (prev, curr) {
|
||||||
return Math.abs(curr - currentMax) <= Math.abs(prev - currentMax) ? curr : prev
|
return Math.abs(curr - currentMax) <= Math.abs(prev - currentMax) ? curr : prev
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
},
|
|
||||||
})
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
482
patches/markdown-it+13.0.1.patch
Normal file
482
patches/markdown-it+13.0.1.patch
Normal file
File diff suppressed because one or more lines are too long
1335
pnpm-lock.yaml
generated
1335
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
9
wrangler.toml
Normal file
9
wrangler.toml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
name = "knossos"
|
||||||
|
main = "./.output/server/index.mjs"
|
||||||
|
workers_dev = true
|
||||||
|
compatibility_date = "2022-07-12"
|
||||||
|
account_id = "9ddae624c98677d68d93df6e524a6061"
|
||||||
|
node_compat = true
|
||||||
|
|
||||||
|
[site]
|
||||||
|
bucket = ".output/public"
|
||||||
Reference in New Issue
Block a user