Page MenuHomePhabricator

Check for invalid videos on commons, and beta-commons url change for VideoCutTool
Open, HighPublic

Description

So we've recently migrated beta-vct to beta-commons. The beta env of the tool (https://beta-videocuttool.wmcloud.org/) is primarily for testing changes before we go live on prod.

[P0]
[BUG]
import.meta.env.VITE_ENV !== "production" check is failling on production, as import.meta.env.VITE_ENV is not being picked up by vite (even though its set up in Dockerfile.prd).
This causes tool to pickup BETA_COMMONS_BASE_URL on client side (for production as well), causing issues to upload

[P1/P2]
This ticket addresses the following concerns.

  1. Currently in beta-vct, the placeholder input url begins with commons.wikimedia.org which might be misleading to users. Remove the hardcoded placeholder from this, and use a generic one (which shows commons.wikimedia.beta.org for beta env, and commons.wikimedia.org for prod env)
  1. We have a couple of util functions retrieveVideoData and checkFileExist which have a hardcoded check for commons.wikimedia.org. Remove all instances of this hardcoded url, use dyanmic base url fetched from ENV_SETTINGS.
  1. Also as a precautionary measure, add a error notification if video doesn't exist/not found in commons/beta-commons (based on the env). We can have the error message like Video: {video_title} not found in {commons link based on env}. Video url: {final generated video url}

Event Timeline

Thank you for tagging this task with good first task for Wikimedia newcomers!

Newcomers often may not be aware of things that may seem obvious to seasoned contributors, so please take a moment to reflect on how this task might look to somebody who has never contributed to Wikimedia projects.

A good first task is a self-contained, non-controversial task with a clear approach. It should be well-described with pointers to help a completely new contributor, for example it should clearly point to the codebase URL and provide clear steps to help a contributor get set up for success. We've included some guidelines at https://phabricator.wikimedia.org/tag/good_first_task/ !

Thank you for helping us drive new contributions to our projects <3

Hi! I’d like to work on this as my first patch to VideoCutTool.

I’ll update the placeholder URL to be env-aware, use ENV_SETTINGS for retrieveVideoData and checkFileExist, and add the error notification as described.

Please let me know if there’s anything specific I should keep in mind.

Hi! I’d like to work on this as my first patch to VideoCutTool.

I’ll update the placeholder URL to be env-aware, use ENV_SETTINGS for retrieveVideoData and checkFileExist, and add the error notification as described.

Please let me know if there’s anything specific I should keep in mind.

sounds good. do lmk if you're stuck somewhere

updating priority to be high.
adding onto the description, check the usage of vite.meta.env (env variables defined within vite)

[BUG]
import.meta.env.VITE_ENV !== "production" check is failling on production, as import.meta.env.VITE_ENV is not being picked up by vite (even though its set up in Dockerfile.prd)

maybe we can have 2 MRs for this..one addressing the fix for [P0] first.
(for now have updated production env manually, so as to minimise outage)

PS: Fix for the above mentioned bug is
use import.meta.env.MODE instead of import.meta.env.VITE_ENV

@talhajsiam can you please add this small change in your MR

Also for 3). It seems we already have a notification message in place (check error-file-not-exist key in qqq.json), we can leverage this itself, and maybe update the message to display the base_wiki_url

Pppery subscribed.

Resetting assignee as progress seems to have stalled