Skip to content

fix(captcha): patch validated on desktop mode #185

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

Merged
merged 38 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
65640f1
fix(captcha): patch validated on desktop mode
JulienChampagnol May 2, 2025
e74471d
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
JulienChampagnol May 2, 2025
47acc65
@vitest/coverage-v8 3.0.8
JulienChampagnol May 2, 2025
fcbe878
Apply prepare changes
JulienChampagnol May 2, 2025
5e520dd
test cat package-lock.json
JulienChampagnol May 2, 2025
9680f8c
Merge branch 'fix/captcha_on_desktop' of https://github.com/Geode-sol…
JulienChampagnol May 2, 2025
d55a0c8
remove cat
JulienChampagnol May 2, 2025
f93b44e
test
JulienChampagnol May 2, 2025
2f78ff5
test
JulienChampagnol May 2, 2025
0a03c21
test
JulienChampagnol May 2, 2025
822d140
revert
JulienChampagnol May 2, 2025
8eec024
Apply prepare changes
JulienChampagnol May 2, 2025
17b5360
test
JulienChampagnol May 2, 2025
7fe6c8e
Merge branch 'fix/captcha_on_desktop' of https://github.com/Geode-sol…
JulienChampagnol May 2, 2025
eea7064
go
JulienChampagnol May 2, 2025
8d2f8db
update schemas
JulienChampagnol May 2, 2025
0cf1e9c
Apply prepare changes
JulienChampagnol May 2, 2025
c25291c
test vitest 3.1.1
JulienChampagnol May 3, 2025
d830c72
Merge branch 'fix/captcha_on_desktop' of https://github.com/Geode-sol…
JulienChampagnol May 3, 2025
e5c5e2d
test remove vitest coverage
JulienChampagnol May 3, 2025
55120df
Apply prepare changes
JulienChampagnol May 3, 2025
91f1bf4
test --save-exact
JulienChampagnol May 3, 2025
0816720
Merge branch 'fix/captcha_on_desktop' of https://github.com/Geode-sol…
JulienChampagnol May 3, 2025
cd02eb5
test wrapper.emitted()
JulienChampagnol May 5, 2025
40d5202
test
JulienChampagnol May 5, 2025
1d4dd15
test 2
JulienChampagnol May 5, 2025
0ef2ebe
test log
JulienChampagnol May 5, 2025
2bdf7a5
log in useFetch
JulienChampagnol May 5, 2025
04a2f86
test onRequest
JulienChampagnol May 5, 2025
d3631c0
test npm ci
JulienChampagnol May 5, 2025
dc45bcf
double flushPromises
JulienChampagnol May 5, 2025
a0c041e
Apply prepare changes
JulienChampagnol May 5, 2025
ac9ba3e
rename eslint config file
JulienChampagnol May 5, 2025
4cae0fd
Merge branch 'fix/captcha_on_desktop' of https://github.com/Geode-sol…
JulienChampagnol May 5, 2025
eb14fa4
Apply prepare changes
JulienChampagnol May 5, 2025
942cbc6
eslint root false
JulienChampagnol May 5, 2025
83cb61e
Merge branch 'fix/captcha_on_desktop' of https://github.com/Geode-sol…
JulienChampagnol May 5, 2025
58a56f5
remove root
JulienChampagnol May 5, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/CICD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
uses: actions/checkout@v4
- name: Unit tests
run: |
npm i
npm ci
npm run test

build:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ logs
.pytest_cache
__snapshots__
coverage
package-lock.json
# package-lock.json
1 change: 1 addition & 0 deletions components/FileUploader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
await Promise.all(promise_array)
files_uploaded.value = true
emit("files_uploaded", internal_files.value)

toggle_loading()
}

Expand Down
24 changes: 6 additions & 18 deletions components/ObjectSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,14 @@
var promise_array = []
for (const filename of filenames) {
const params = { filename, supported_feature }
const promise = new Promise((resolve, reject) => {
api_fetch(
{ schema, params },
{
request_error_function: () => {
reject()
},
response_function: (response) => {
resolve(response._data.allowed_objects)
},
response_error_function: () => {
reject()
},
},
)
})
const promise = api_fetch({ schema, params })
promise_array.push(promise)
}
const values = await Promise.all(promise_array)
const responses = await Promise.all(promise_array)
let values = []
for (const response of responses) {
values.push(response.data.value.allowed_objects)
}
const all_keys = [...new Set(values.flatMap((value) => Object.keys(value)))]
const common_keys = all_keys.filter(
(i) => !values.some((j) => !Object.keys(j).includes(i)),
Expand Down Expand Up @@ -119,7 +108,6 @@
emit("increment_step")
}
}

await get_allowed_objects()
</script>

Expand Down
2 changes: 1 addition & 1 deletion components/Recaptcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
onMounted(() => {
if (process.client) {
const config = useRuntimeConfig()
if (config.public.NODE_ENV !== "production") {
if (config.public.NODE_ENV !== "production" || !infra_store.is_cloud) {
infra_store.$patch({ is_captcha_validated: true })
}
}
Expand Down
71 changes: 33 additions & 38 deletions composables/api_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,41 @@ export function api_fetch(
if (schema.max_retry) {
request_options.max_retry = schema.max_retry
}
return new Promise((resolve, reject) => {
useFetch(schema.$id, {
baseURL: geode_store.base_url,
...request_options,
async onRequestError({ error }) {
return useFetch(schema.$id, {
baseURL: geode_store.base_url,
...request_options,
async onRequestError({ error }) {
await geode_store.stop_request()
await feedback_store.add_error(
error.code,
schema.$id,
error.message,
error.stack,
)
if (request_error_function) {
await request_error_function(error)
}
},
async onResponse({ response }) {
if (response.ok) {
await geode_store.stop_request()
await feedback_store.add_error(
error.code,
schema.$id,
error.message,
error.stack,
)
if (request_error_function) {
await request_error_function(error)
if (response_function) {
await response_function(response)
}
reject(error)
},
async onResponse({ response }) {
if (response.ok) {
await geode_store.stop_request()
if (response_function) {
await response_function(response)
}
resolve(response)
}
},
async onResponseError({ response }) {
await geode_store.stop_request()
await feedback_store.add_error(
response.status,
schema.$id,
response._data.name,
response._data.description,
)
if (response_error_function) {
await response_error_function(response)
}
reject(response)
},
})
}
},
async onResponseError({ response }) {
await geode_store.stop_request()
await feedback_store.add_error(
response.status,
schema.$id,
response._data.name,
response._data.description,
)
if (response_error_function) {
await response_error_function(response)
}
},
})
}

Expand Down
11 changes: 10 additions & 1 deletion composables/upload_file.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useAppConfig } from "nuxt/app"

export async function upload_file(
{ route, file },
{ request_error_function, response_function, response_error_function } = {},
) {
console.log("upload_file", route, file)
const feedback_store = use_feedback_store()
const geode_store = use_geode_store()
if (!(file instanceof File)) {
Expand All @@ -17,17 +20,22 @@ export async function upload_file(
}

geode_store.start_request()
return useFetch(route, {
return $fetch(route, {
baseURL: geode_store.base_url,
...request_options,
onRequest({ request }) {
console.log("onRequest", request)
},
onRequestError({ error }) {
console.log("onRequestError", error)
geode_store.stop_request()
feedback_store.add_error(error.code, route, error.message, error.stack)
if (request_error_function) {
request_error_function(error)
}
},
onResponse({ response }) {
console.log("onResponse", response)
if (response.ok) {
geode_store.stop_request()
if (response_function) {
Expand All @@ -36,6 +44,7 @@ export async function upload_file(
}
},
onResponseError({ response }) {
console.log("onResponseError", response)
geode_store.stop_request()
feedback_store.add_error(
response.status,
Expand Down
13 changes: 13 additions & 0 deletions eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module.exports = {
env: {
node: true,
browser: true,
es2021: true,
},
extends: [
"eslint:recommended",
"plugin:vue/recommended",
"plugin:vuetify/recommended",
"plugin:nuxt/recommended",
],
}
Loading
Loading