Skip to content

Commit

Permalink
🐛 opt in to import.meta.* properties (#2726)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe authored Mar 30, 2024
1 parent b0b352b commit 093f897
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion client/components/MainSearchBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default defineComponent({
const updateSearchValueFromUrl = () => {
if (route.query.search_query) {
searchValue.value = route.query.search_query as string;
if (process.server) {
if (import.meta.server) {
localSearchValue.value = route.query.search_query as string;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion client/components/watch/ShareOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export default defineComponent({
};
const encodedUrl = () => {
if (process.client) {
if (import.meta.client) {
return encodeURIComponent(window.location.href);
} else {
return '';
Expand Down
2 changes: 1 addition & 1 deletion client/composables/apiUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const devServerApi = () => {
export const useApiUrl = (clientOnly = false) => {
return {
apiUrl: computed(() => {
if (process.server && !clientOnly && process.env.NODE_ENV !== 'production') {
if (import.meta.server && !clientOnly && process.env.NODE_ENV !== 'production') {
return devServerApi();
}
return '/api/';
Expand Down
2 changes: 1 addition & 1 deletion client/composables/createTextLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const useCreateTextLinks = (timestampFn?: TimestampFnType) => {
const route = useRoute();

const applyEventListeners = () => {
if (process.client) {
if (import.meta.client) {
document.querySelectorAll('.time-link').forEach(element => {
if (element.getAttribute('has-event-listener') === 'true') return;
const secondsString = element.getAttribute('seconds');
Expand Down
6 changes: 3 additions & 3 deletions client/composables/vtFetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useVtFetch = () => {

if (!requestOptions.credentials && !options?.external) requestOptions.credentials = 'include';

if (process.server && !options?.external) {
if (import.meta.server && !options?.external) {
const cookieHeader = Object.entries({
RefreshToken: refreshToken.value,
AccessToken: accessToken.value,
Expand All @@ -62,7 +62,7 @@ export const useVtFetch = () => {
requestOptions.headers = { ...requestOptions.headers, cookie: cookieHeader };
}

if (process.server && !options?.external && global?.nestApp) {
if (import.meta.server && !options?.external && global?.nestApp) {
const response = await global.nestApp.inject({
method: (requestOptions.method ?? 'GET') as HTTPMethods,
url: request.toString(),
Expand All @@ -75,7 +75,7 @@ export const useVtFetch = () => {
} else {
const response = await ofetch.raw(request, requestOptions);

if (process.server && !options?.external) {
if (import.meta.server && !options?.external) {
const setCookies = response.headers.getSetCookie();
if (setCookies) {
setCookies.forEach(cookie => {
Expand Down
2 changes: 1 addition & 1 deletion client/layouts/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default defineComponent({
const possibleSearch = ref(null);
const copyError = (): void => {
if (process.client && 'clipboard' in navigator) {
if (import.meta.client && 'clipboard' in navigator) {
navigator.clipboard.writeText(renderJSON(props.error.detail)).then(() => {
messagesStore.createMessage({
type: 'info',
Expand Down
6 changes: 3 additions & 3 deletions client/utils/videoplayer/helpers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const videoPlayerSetup = (
});
}
}
if ('mediaSession' in navigator && process.client) {
if ('mediaSession' in navigator && import.meta.client) {
const metadata = createMediaMetadata();
(navigator as any).mediaSession.metadata = metadata;
}
Expand Down Expand Up @@ -416,7 +416,7 @@ export const videoPlayerSetup = (
}
}

if (process.client && 'mediaSession' in navigator) {
if (import.meta.client && 'mediaSession' in navigator) {
const duration = parseFloat(videoRef.value.duration);
const playbackRate = parseFloat(videoRef.value.playbackRate);
const position = parseFloat(videoRef.value.currentTime);
Expand Down Expand Up @@ -871,7 +871,7 @@ export const videoPlayerSetup = (
}
};

if (process.client && 'mediaSession' in navigator) {
if (import.meta.client && 'mediaSession' in navigator) {
(navigator as any).mediaSession.setActionHandler('play', () => {
if (videoRef.value) {
playerOverlay.thumbnailVisible = false;
Expand Down

0 comments on commit 093f897

Please sign in to comment.