Skip to content

Commit 8cf947a

Browse files
committed
Merge remote-tracking branch 'upstream/main' into feat/dependents-api
2 parents 52b7f9f + 72a52eb commit 8cf947a

File tree

236 files changed

+6361
-2971
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

236 files changed

+6361
-2971
lines changed

.cargo/config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,8 @@
22
[target.'cfg(windows)']
33
rustflags = ["-C", "link-args=/STACK:16777220", "--cfg", "tokio_unstable"]
44

5+
[target.x86_64-pc-windows-msvc]
6+
linker = "rust-lld"
7+
58
[build]
69
rustflags = ["--cfg", "tokio_unstable"]

.github/workflows/daedalus-docker.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,26 @@ jobs:
2222
runs-on: ubuntu-latest
2323
steps:
2424
- name: Checkout
25-
uses: actions/checkout@v2
25+
uses: actions/checkout@v4
26+
- name: Set up Docker Buildx
27+
uses: docker/setup-buildx-action@v2
2628
- name: Fetch docker metadata
2729
id: docker_meta
28-
uses: docker/metadata-action@v3
30+
uses: docker/metadata-action@v5
2931
with:
3032
images: ghcr.io/modrinth/daedalus
3133
- name: Login to GitHub Images
32-
uses: docker/login-action@v1
34+
uses: docker/login-action@v3
3335
with:
3436
registry: ghcr.io
3537
username: ${{ github.actor }}
3638
password: ${{ secrets.GITHUB_TOKEN }}
3739
- name: Build and push
38-
id: docker_build
39-
uses: docker/build-push-action@v2
40+
uses: docker/build-push-action@v6
4041
with:
4142
file: ./apps/daedalus_client/Dockerfile
4243
push: ${{ github.event_name != 'pull_request' }}
4344
tags: ${{ steps.docker_meta.outputs.tags }}
4445
labels: ${{ steps.docker_meta.outputs.labels }}
46+
cache-from: type=registry,ref=ghcr.io/modrinth/daedalus:main
47+
cache-to: type=inline

.github/workflows/labrinth-docker.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,26 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- name: Checkout
23-
uses: actions/checkout@v2
23+
uses: actions/checkout@v4
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
2426
- name: Fetch docker metadata
2527
id: docker_meta
26-
uses: docker/metadata-action@v3
28+
uses: docker/metadata-action@v5
2729
with:
2830
images: ghcr.io/modrinth/labrinth
2931
- name: Login to GitHub Images
30-
uses: docker/login-action@v1
32+
uses: docker/login-action@v3
3133
with:
3234
registry: ghcr.io
3335
username: ${{ github.actor }}
3436
password: ${{ secrets.GITHUB_TOKEN }}
3537
- name: Build and push
36-
id: docker_build
37-
uses: docker/build-push-action@v2
38+
uses: docker/build-push-action@v6
3839
with:
3940
file: ./apps/labrinth/Dockerfile
4041
push: ${{ github.event_name != 'pull_request' }}
4142
tags: ${{ steps.docker_meta.outputs.tags }}
4243
labels: ${{ steps.docker_meta.outputs.labels }}
44+
cache-from: type=registry,ref=ghcr.io/modrinth/labrinth:main
45+
cache-to: type=inline

.github/workflows/theseus-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ jobs:
7575
rename-to: ${{ startsWith(matrix.platform, 'windows') && 'dasel.exe' || 'dasel' }}
7676
chmod: 0755
7777

78-
- name: ⚙️ Set application version
78+
- name: ⚙️ Set application version and environment
7979
shell: bash
8080
run: |
8181
APP_VERSION="$(git describe --tags --always | sed -E 's/-([0-9]+)-(g[0-9a-fA-F]+)$/-canary+\1.\2/')"
@@ -84,6 +84,8 @@ jobs:
8484
dasel put -f packages/app-lib/Cargo.toml -t string -v "${APP_VERSION#v}" 'package.version'
8585
dasel put -f apps/app-frontend/package.json -t string -v "${APP_VERSION#v}" 'version'
8686
87+
cp packages/app-lib/.env.prod packages/app-lib/.env
88+
8789
- name: 💨 Setup Turbo cache
8890
uses: rharkor/caching-for-turbo@v1.8
8991

.github/workflows/turbo-ci.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
# cargo-binstall does not have pre-built binaries for sqlx-cli, so we fall
5353
# back to a cached cargo install
5454
- name: 🧰 Setup cargo-sqlx
55-
uses: AlexTMjugador/cache-cargo-install-action@feat/features-support
55+
uses: taiki-e/cache-cargo-install-action@v2
5656
with:
5757
tool: sqlx-cli
5858
locked: false
@@ -74,10 +74,14 @@ jobs:
7474
cp .env.local .env
7575
sqlx database setup
7676
77+
- name: ⚙️ Set app environment
78+
working-directory: packages/app-lib
79+
run: cp .env.staging .env
80+
7781
- name: 🔍 Lint and test
7882
run: pnpm run ci
7983

8084
- name: 🔍 Verify intl:extract has been run
8185
run: |
8286
pnpm intl:extract
83-
git diff --exit-code */*/src/locales/en-US/index.json
87+
git diff --exit-code --color */*/src/locales/en-US/index.json

Cargo.lock

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ heck = "0.5.0"
6767
hex = "0.4.3"
6868
hickory-resolver = "0.25.2"
6969
hmac = "0.12.1"
70+
hyper = "1.6.0"
7071
hyper-rustls = { version = "0.27.7", default-features = false, features = [
7172
"http1",
7273
"native-tokio",
@@ -98,6 +99,7 @@ notify = { version = "8.0.0", default-features = false }
9899
notify-debouncer-mini = { version = "0.6.0", default-features = false }
99100
p256 = "0.13.2"
100101
paste = "1.0.15"
102+
phf = { version = "0.12.1", features = ["macros"] }
101103
png = "0.17.16"
102104
prometheus = "0.14.0"
103105
quartz_nbt = "0.2.9"

apps/app-frontend/src/App.vue

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ import { renderString } from '@modrinth/utils'
6161
import { useFetch } from '@/helpers/fetch.js'
6262
import { check } from '@tauri-apps/plugin-updater'
6363
import NavButton from '@/components/ui/NavButton.vue'
64-
import { get as getCreds, login, logout } from '@/helpers/mr_auth.js'
64+
import { cancelLogin, get as getCreds, login, logout } from '@/helpers/mr_auth.js'
6565
import { get_user } from '@/helpers/cache.js'
6666
import AppSettingsModal from '@/components/ui/modal/AppSettingsModal.vue'
67+
import AuthGrantFlowWaitModal from '@/components/ui/modal/AuthGrantFlowWaitModal.vue'
6768
import PromotionWrapper from '@/components/ui/PromotionWrapper.vue'
6869
import { hide_ads_window, init_ads_window } from '@/helpers/ads.js'
6970
import FriendsList from '@/components/ui/friends/FriendsList.vue'
@@ -263,6 +264,8 @@ const incompatibilityWarningModal = ref()
263264
264265
const credentials = ref()
265266
267+
const modrinthLoginFlowWaitModal = ref()
268+
266269
async function fetchCredentials() {
267270
const creds = await getCreds().catch(handleError)
268271
if (creds && creds.user_id) {
@@ -272,8 +275,24 @@ async function fetchCredentials() {
272275
}
273276
274277
async function signIn() {
275-
await login().catch(handleError)
276-
await fetchCredentials()
278+
modrinthLoginFlowWaitModal.value.show()
279+
280+
try {
281+
await login()
282+
await fetchCredentials()
283+
} catch (error) {
284+
if (
285+
typeof error === 'object' &&
286+
typeof error['message'] === 'string' &&
287+
error.message.includes('Login canceled')
288+
) {
289+
// Not really an error due to being a result of user interaction, show nothing
290+
} else {
291+
handleError(error)
292+
}
293+
} finally {
294+
modrinthLoginFlowWaitModal.value.hide()
295+
}
277296
}
278297
279298
async function logOut() {
@@ -402,6 +421,9 @@ function handleAuxClick(e) {
402421
<Suspense>
403422
<AppSettingsModal ref="settingsModal" />
404423
</Suspense>
424+
<Suspense>
425+
<AuthGrantFlowWaitModal ref="modrinthLoginFlowWaitModal" @flow-cancel="cancelLogin" />
426+
</Suspense>
405427
<Suspense>
406428
<InstanceCreationModal ref="installationModal" />
407429
</Suspense>

apps/app-frontend/src/components/ui/InstanceCreationModal.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,16 @@ const [
305305
get_game_versions().then(shallowRef).catch(handleError),
306306
get_loaders()
307307
.then((value) =>
308-
value
309-
.filter((item) => item.supported_project_types.includes('modpack'))
310-
.map((item) => item.name.toLowerCase()),
308+
ref(
309+
value
310+
.filter((item) => item.supported_project_types.includes('modpack'))
311+
.map((item) => item.name.toLowerCase()),
312+
),
311313
)
312-
.then(ref)
313-
.catch(handleError),
314+
.catch((err) => {
315+
handleError(err)
316+
return ref([])
317+
}),
314318
])
315319
loaders.value.unshift('vanilla')
316320
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<script setup lang="ts">
2+
import { LogInIcon, SpinnerIcon } from '@modrinth/assets'
3+
import { ref } from 'vue'
4+
import ModalWrapper from '@/components/ui/modal/ModalWrapper.vue'
5+
6+
defineProps({
7+
onFlowCancel: {
8+
type: Function,
9+
default() {
10+
return async () => {}
11+
},
12+
},
13+
})
14+
15+
const modal = ref()
16+
17+
function show() {
18+
modal.value.show()
19+
}
20+
21+
function hide() {
22+
modal.value.hide()
23+
}
24+
25+
defineExpose({ show, hide })
26+
</script>
27+
<template>
28+
<ModalWrapper ref="modal" @hide="onFlowCancel">
29+
<template #title>
30+
<span class="items-center gap-2 text-lg font-extrabold text-contrast">
31+
<LogInIcon /> Sign in
32+
</span>
33+
</template>
34+
35+
<div class="flex justify-center gap-2">
36+
<SpinnerIcon class="w-12 h-12 animate-spin" />
37+
</div>
38+
<p class="text-sm text-secondary">
39+
Please sign in at the browser window that just opened to continue.
40+
</p>
41+
</ModalWrapper>
42+
</template>

0 commit comments

Comments
 (0)