Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 🐛 Zenodo callback issue resolved with purging token before sign in #116

Merged
merged 49 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
0767e2c
refactor: :recycle: transfer validation api to codefair repo (#106)
slugb0t Nov 16, 2024
be75575
🚚 chore: rename `validator-api` to `validator`
megasanjay Nov 16, 2024
8e3b3a4
👷 ci: add validator deploy
megasanjay Nov 16, 2024
aba85b3
👷 ci: add validator healthcheck
megasanjay Nov 16, 2024
242bde1
👷 ci: add validator deploy for prod
megasanjay Nov 16, 2024
303824b
refactor: :recycle: update codefair name
slugb0t Nov 22, 2024
96d4e82
feat: ✨ Metadata + license validators + bug patches (#107)
slugb0t Dec 2, 2024
9219131
fix: :bug: use the correct env variable for private key
slugb0t Dec 2, 2024
76c35b7
fix: 🐛 Codefair v3.2.0 finalization (#113)
slugb0t Dec 9, 2024
95dad9c
fix: :bug: migrate db during deployment
slugb0t Dec 9, 2024
f570d2d
fix: :bug: revert
slugb0t Dec 9, 2024
4db16dd
fix: :bug: typo on dockerfile
slugb0t Dec 9, 2024
10de0d5
refactor: :recycle: use npm instead of yarn for migration
slugb0t Dec 9, 2024
408a242
refactor: :recycle: access db url during prisma build
slugb0t Dec 9, 2024
b3b75f6
refactor: :recycle: apply node env
slugb0t Dec 9, 2024
e97beb0
💚 ci: copy package json
megasanjay Dec 9, 2024
2c5b413
💚 ci: revert arg
megasanjay Dec 9, 2024
a3f891d
💚 ci: add prisma migrate to ci
megasanjay Dec 9, 2024
c0b0540
💚 ci: add prisma migrate to ci
megasanjay Dec 9, 2024
fd0b979
👷 ci: update dockerfile
megasanjay Dec 9, 2024
561169d
refactor: :recycle: use deployed validator
slugb0t Dec 9, 2024
027c86d
Merge branch 'staging' of https://github.com/fairdataihub/codefair-ap…
slugb0t Dec 9, 2024
29c0617
fix: :bug: when license is updated validate metadata files
slugb0t Dec 9, 2024
a86c6ca
fix: :bug: validation returns codemeta version on errors
slugb0t Dec 9, 2024
dd9718e
🐛 fix: add basic logwatch
megasanjay Dec 9, 2024
1f51519
fix: :bug: add @type key for 2.0 codemeta.json files
slugb0t Dec 9, 2024
25bc54b
Merge branch 'staging' of https://github.com/fairdataihub/codefair-ap…
slugb0t Dec 9, 2024
c940a7b
refactor: :recycle: updated required fields for codemeta schmea
slugb0t Dec 9, 2024
6036f5a
🐛 fix: add logwatch support
megasanjay Dec 9, 2024
c13e7a6
🐛 fix: add json to logwatch
megasanjay Dec 9, 2024
82baf3f
fix: :bug: patch json parse issue
slugb0t Dec 9, 2024
d4c2335
Merge branch 'staging' of https://github.com/fairdataihub/codefair-ap…
slugb0t Dec 9, 2024
e4428f2
fix: :bug: update logging parameters
slugb0t Dec 9, 2024
e648184
refactor: :recycle: point a folder above for codemeta-schema
slugb0t Dec 9, 2024
771699d
refactor: :recycle: update dockerfile to include schema
slugb0t Dec 10, 2024
104ae3e
fix: :bug: ensure authors have roles key
slugb0t Dec 10, 2024
4132e66
refactor: :recycle: :loud_sound: convert some consola logs to logwatch
slugb0t Dec 10, 2024
6fedd07
fix: :bug: roles are optional in save request
slugb0t Dec 10, 2024
808b93b
chore: :loud_sound: remove dev logs
slugb0t Dec 10, 2024
8edc800
doc: :memo: update changelog
slugb0t Dec 10, 2024
a878891
refactor: :recycle: revert roles key being optional
slugb0t Dec 10, 2024
7ba12b6
fix: :bug: add logwatch.start method
slugb0t Dec 10, 2024
cde62bd
fix: :bug: ensure contrib and authros have roles
slugb0t Dec 10, 2024
4bca8d3
Merge branch 'main' into staging
slugb0t Dec 10, 2024
619880e
fix: :bug: CWL handles multiple installations
slugb0t Dec 10, 2024
6fe2edb
refactor: :recycle: update log error
slugb0t Dec 10, 2024
7393750
merge: :twisted_rightwards_arrows: remote-tracking branch 'origin/mai…
slugb0t Dec 10, 2024
4c77ab1
feat: :sparkles: purge zenodo token when sign in is required
slugb0t Dec 11, 2024
5bffc66
fix: :bug: make login fn asyncronous
slugb0t Dec 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions ui/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,18 @@ declare module 'vue' {
NCheckbox: typeof import('naive-ui')['NCheckbox']
NCollapse: typeof import('naive-ui')['NCollapse']
NCollapseItem: typeof import('naive-ui')['NCollapseItem']
NCollapseTransition: typeof import('naive-ui')['NCollapseTransition']
NDatePicker: typeof import('naive-ui')['NDatePicker']
NDivider: typeof import('naive-ui')['NDivider']
NDropdown: typeof import('naive-ui')['NDropdown']
NDynamicInput: typeof import('naive-ui')['NDynamicInput']
NFlex: typeof import('naive-ui')['NFlex']
NForm: typeof import('naive-ui')['NForm']
NFormItem: typeof import('naive-ui')['NFormItem']
NInput: typeof import('naive-ui')['NInput']
NModal: typeof import('naive-ui')['NModal']
NPopconfirm: typeof import('naive-ui')['NPopconfirm']
NPopover: typeof import('naive-ui')['NPopover']
NRadio: typeof import('naive-ui')['NRadio']
NRadioButton: typeof import('naive-ui')['NRadioButton']
NRadioGroup: typeof import('naive-ui')['NRadioGroup']
NSelect: typeof import('naive-ui')['NSelect']
NSpace: typeof import('naive-ui')['NSpace']
NSpin: typeof import('naive-ui')['NSpin']
NTag: typeof import('naive-ui')['NTag']
NTooltip: typeof import('naive-ui')['NTooltip']
Expand Down
21 changes: 20 additions & 1 deletion ui/pages/dashboard/[owner]/[repo]/release/zenodo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,25 @@ const validateZenodoForm = () => {
});
};

const loginToZenodo = async () => {
// Send api request to purge the Zenodo token
await $fetch(`/api/user/zenodo`, {
headers: useRequestHeaders(["cookie"]),
method: "DELETE",
})
.then(() => {
// Redirect to the Zenodo login page
window.location.href = zenodoLoginUrl.value;
})
.catch((error) => {
console.error("Failed to purge Zenodo token:", error);
push.error({
title: "Failed to purge Zenodo token",
message: "Please try again later",
});
});
}

const githubReleaseInterval = ref<any>(null);

onMounted(() => {
Expand Down Expand Up @@ -760,7 +779,7 @@ onBeforeUnmount(() => {
login to Zenodo to continue.
</p>

<a v-if="!haveValidZenodoToken" :href="zenodoLoginUrl">
<a v-if="!haveValidZenodoToken" @click="loginToZenodo">
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Add preventDefault to click handler to ensure custom login flow works correctly

The anchor tag's default behavior might interfere with the custom login flow. Consider using @click.prevent="loginToZenodo".

Suggested change
<a v-if="!haveValidZenodoToken" @click="loginToZenodo">
<a v-if="!haveValidZenodoToken" @click.prevent="loginToZenodo">

<n-button type="primary">
<template #icon>
<Icon name="simple-icons:zenodo" size="16" />
Expand Down
25 changes: 25 additions & 0 deletions ui/server/api/user/zenodo.delete.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { User } from "lucia";

export default defineEventHandler(async (event) => {
protectRoute(event);

const user = event.context.user as User | null;

if (!user) {
throw createError({
statusCode: 400,
statusMessage: "Bad Request. Missing user in the URL params",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): Error message is incorrect - user is expected in context, not URL params

});
}

// Delete only the Zenodo token from the zenodoToken table
await prisma.zenodoToken.deleteMany({
where: {
user_id: user.id,
},
});

return {
message: "Zenodo token purged",
};
});
Loading