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 code style and linting errors #223

Merged
merged 7 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
4 changes: 2 additions & 2 deletions server/venueless/importers/conftool.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ def create_posters_from_conftool(
continue

nonce += 1
download_url, preview_url = mirror_conftool_file(
downloadUrl, preview_url = mirror_conftool_file(
untari marked this conversation as resolved.
Show resolved Hide resolved
world,
paper.xpath(f"download_final_link_{fileindex}")[0].text,
password,
Expand All @@ -430,7 +430,7 @@ def create_posters_from_conftool(
display_text=paper.xpath(f"original_filename_final_{fileindex}")[0].text
or f"Link {fileindex}",
defaults={
"url": download_url,
"url": downloadUrl,
},
)

Expand Down
8 changes: 4 additions & 4 deletions webapp/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import cloneDeep from 'lodash/cloneDeep'
let config
if (ENV_DEVELOPMENT || !window.venueless) {
const hostname = window.location.hostname
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws';
const httpProtocol = window.location.protocol;
const wsProtocol = window.location.protocol === 'https:' ? 'wss' : 'ws'
const httpProtocol = window.location.protocol
config = {
api: {
base: `${httpProtocol}//${hostname}:8443/api/v1/worlds/sample/`,
Expand All @@ -17,8 +17,8 @@ if (ENV_DEVELOPMENT || !window.venueless) {
locales: ['en', 'de', 'pt_BR', 'ar', 'fr', 'es', 'uk', 'ru'],
theme: {
logo: {
url: "/eventyay-video-logo.svg",
fitToWidth: false
url: '/eventyay-video-logo.svg',
fitToWidth: false
},
colors: {
primary: '#2185d0',
Expand Down
18 changes: 9 additions & 9 deletions webapp/src/components/MediaSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export default {
// Set the language iframe URL when language changes
this.languageIframeUrl = this.getLanguageIframeUrl(languageUrl)
},
getYoutubeUrl(ytid, autoplay, mute, hideControls, noRelated, showinfo, disableKb, loop, modestBranding, enablePrivacyEnhancedMode) {
getYoutubeUrl (ytid, autoplay, mute, hideControls, noRelated, showinfo, disableKb, loop, modestBranding, enablePrivacyEnhancedMode) {
untari marked this conversation as resolved.
Show resolved Hide resolved
const params = new URLSearchParams({
autoplay: autoplay ? '1' : '0',
mute: mute ? '1' : '0',
Expand All @@ -182,15 +182,15 @@ export default {
loop: loop ? '1' : '0',
modestbranding: modestBranding ? '1' : '0',
playlist: ytid,
});
})

const domain = enablePrivacyEnhancedMode ? 'www.youtube-nocookie.com' : 'www.youtube.com';
return `https://${domain}/embed/${ytid}?${params}`;
const domain = enablePrivacyEnhancedMode ? 'www.youtube-nocookie.com' : 'www.youtube.com'
return `https://${domain}/embed/${ytid}?${params}`
},
// Added method to get the language iframe URL
getLanguageIframeUrl(languageUrl, enablePrivacyEnhancedMode) {
getLanguageIframeUrl (languageUrl, enablePrivacyEnhancedMode) {
// Checks if the languageUrl is not provided the retun null
if (!languageUrl) return null;
if (!languageUrl) return null
const params = new URLSearchParams({
enablejsapi: '1',
autoplay: '1',
Expand All @@ -201,10 +201,10 @@ export default {
rel: '0',
showinfo: '0',
playlist: languageUrl,
});
})

const domain = enablePrivacyEnhancedMode ? 'www.youtube-nocookie.com' : 'www.youtube.com';
return `https://${domain}/embed/${languageUrl}?${params}`;
const domain = enablePrivacyEnhancedMode ? 'www.youtube-nocookie.com' : 'www.youtube.com'
return `https://${domain}/embed/${languageUrl}?${params}`
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/components/janus/JanusConference.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1351,4 +1351,4 @@ export default {
.bunt-button
themed-button-primary()
margin-top: 16px
</style>
</style>
2 changes: 1 addition & 1 deletion webapp/src/components/janus/JanusVideoroom.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1130,4 +1130,4 @@ export default {
.bunt-button
themed-button-primary()
margin-top: 16px
</style>
</style>
14 changes: 7 additions & 7 deletions webapp/src/lib/profile.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import i18n from 'i18n'

// Function to get the display name of a user
export function getUserName(user) {
// Return a localized string if the user is deleted
if (user.deleted) return i18n.t('User:label:deleted')
// Return the display name if available, otherwise return the sender or a default string
return user.profile?.display_name ?? user.sender ?? '(unknown user)'
}
export function getUserName (user) {
// Return a localized string if the user is deleted
if (user.deleted) return i18n.t('User:label:deleted')

// Return the display name if available, otherwise return the sender or a default string
return user.profile?.display_name ?? user.sender ?? '(unknown user)'
}
22 changes: 11 additions & 11 deletions webapp/src/lib/quill/emoji.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ import { nativeToStyle as nativeEmojiToStyle, objectToCssString } from 'lib/emoj
const Embed = Quill.import('blots/embed')

class EmojiBlot extends Embed {
static create(value) {
const node = super.create()
node.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
node.style.cssText = objectToCssString(nativeEmojiToStyle(value))
node.dataset.emoji = value
return node
}
static create (value) {
const node = super.create()
node.src = 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
node.style.cssText = objectToCssString(nativeEmojiToStyle(value))
node.dataset.emoji = value
return node
}

static value(node) {
return node.dataset.emoji
}
static value (node) {
return node.dataset.emoji
}
}

EmojiBlot.blotName = 'emoji'
EmojiBlot.className = 'emoji'
EmojiBlot.tagName = 'img'

Quill.register(EmojiBlot)
Quill.register(EmojiBlot)
140 changes: 70 additions & 70 deletions webapp/src/lib/quill/mention.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,88 +3,88 @@ import Quill from 'quill'
const Embed = Quill.import('blots/embed')

class MentionBlot extends Embed {
constructor(scroll, node) {
super(scroll, node)
this.clickHandler = null
this.hoverHandler = null
this.mounted = false
}
constructor (scroll, node) {
super(scroll, node)
this.clickHandler = null
this.hoverHandler = null
this.mounted = false
}

// Create a new MentionBlot with the provided data
static create(data) {
const node = super.create()
node.innerText = '@' + data.name
return MentionBlot.setDataValues(node, data)
}
// Create a new MentionBlot with the provided data
static create (data) {
const node = super.create()
node.innerText = '@' + data.name
return MentionBlot.setDataValues(node, data)
}

// Set data attributes on the DOM element
static setDataValues(element, data) {
Object.keys(data).forEach(key => {
element.dataset[key] = data[key]
})
return element
}
// Set data attributes on the DOM element
static setDataValues (element, data) {
Object.keys(data).forEach(key => {
element.dataset[key] = data[key]
})
return element
}

// Return the dataset of the DOM element
static value(domNode) {
return domNode.dataset
}
// Return the dataset of the DOM element
static value (domNode) {
return domNode.dataset
}

// Attach event listeners for click and hover when the blot is mounted
attach() {
super.attach()
if (!this.mounted) {
this.mounted = true
this.clickHandler = this.getClickHandler()
this.hoverHandler = this.getHoverHandler()
this.domNode.addEventListener('click', this.clickHandler, false)
this.domNode.addEventListener('mouseenter', this.hoverHandler, false)
}
}
// Attach event listeners for click and hover when the blot is mounted
attach () {
super.attach()
if (!this.mounted) {
this.mounted = true
this.clickHandler = this.getClickHandler()
this.hoverHandler = this.getHoverHandler()
this.domNode.addEventListener('click', this.clickHandler, false)
this.domNode.addEventListener('mouseenter', this.hoverHandler, false)
}
}

// Detach event listeners when the blot is unmounted
detach() {
super.detach()
this.mounted = false
if (this.clickHandler) {
this.domNode.removeEventListener('click', this.clickHandler)
this.clickHandler = null
}
}
// Detach event listeners when the blot is unmounted
detach () {
super.detach()
this.mounted = false
if (this.clickHandler) {
this.domNode.removeEventListener('click', this.clickHandler)
this.clickHandler = null
}
}

// Return the click event handler
getClickHandler() {
return (e) => {
const event = this.buildEvent('mention-clicked', e)
window.dispatchEvent(event)
e.preventDefault()
}
}
// Return the click event handler
getClickHandler () {
return (e) => {
const event = this.buildEvent('mention-clicked', e)
window.dispatchEvent(event)
e.preventDefault()
}
}

// Return the hover event handler
getHoverHandler() {
return (e) => {
const event = this.buildEvent('mention-hovered', e)
window.dispatchEvent(event)
e.preventDefault()
}
}
// Return the hover event handler
getHoverHandler () {
return (e) => {
const event = this.buildEvent('mention-hovered', e)
window.dispatchEvent(event)
e.preventDefault()
}
}

// Build and return a custom event with the provided name and original event
buildEvent(name, e) {
const event = new Event(name, {
bubbles: true,
cancelable: true,
})
event.value = { ...this.domNode.dataset }
event.event = e
return event
}
// Build and return a custom event with the provided name and original event
buildEvent (name, e) {
const event = new Event(name, {
bubbles: true,
cancelable: true,
})
event.value = { ...this.domNode.dataset }
event.event = e
return event
}
}

MentionBlot.blotName = 'mention'
MentionBlot.tagName = 'span'
MentionBlot.className = 'mention'

// Register the MentionBlot with Quill
Quill.register('blots/mention', MentionBlot)
Quill.register('blots/mention', MentionBlot)
2 changes: 1 addition & 1 deletion webapp/src/locales/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ export const locales = [{
code: 'ru',
nativeLabel: 'Русский',
englishLabel: 'Russian'
}];
}]
7 changes: 3 additions & 4 deletions webapp/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ import i18n, { init as i18nInit } from 'i18n'
import { emojiPlugin } from 'lib/emoji'
import features from 'features'
import config from 'config'
import {computeForegroundSidebarColor, getThemeConfig} from 'theme'
import theme from 'theme'
import theme, {computeForegroundSidebarColor, getThemeConfig} from 'theme'

async function init ({token, inviteToken}) {
Vue.config.productionTip = false
Expand All @@ -41,7 +40,7 @@ async function init ({token, inviteToken}) {
try {
await setThemeConfig()
} catch (error) {
console.error("error happened when trying to load theme config: ", error)
console.error('error happened when trying to load theme config: ', error)
}
const app = new Vue({
router,
Expand Down Expand Up @@ -117,7 +116,7 @@ navigator.serviceWorker?.getRegistrations().then((registrations) => {
}
})

async function setThemeConfig(){
async function setThemeConfig () {
const themeData = await getThemeConfig()
theme.logo = themeData.logo
theme.identicons = themeData.identicons
Expand Down
2 changes: 1 addition & 1 deletion webapp/src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export default new Vuex.Store({
updateNow (state) {
state.now = moment()
},
updateYoutubeTransAudio(state, youtubeTransUrl){
updateYoutubeTransAudio (state, youtubeTransUrl) {
state.youtubeTransUrl = youtubeTransUrl
}
},
Expand Down
10 changes: 6 additions & 4 deletions webapp/src/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,16 @@ export function computeForegroundColor (bgColor) {
return firstReadable([CLR_PRIMARY_TEXT.LIGHT, CLR_PRIMARY_TEXT.DARK], bgColor)
}

export function computeForegroundSidebarColor(colors) {
export function computeForegroundSidebarColor (colors) {
const configColors = {
primary: colors.primary,
sidebar: colors.sidebar,
bbb_background: colors.bbb_background,
}
const sbColors = Object.keys(DEFAULT_COLORS).reduce((acc, key) => (acc[key] = Color((configColors ?? DEFAULT_COLORS)[key]), acc), {})
const sbColors = Object.keys(DEFAULT_COLORS).reduce((acc, key) => {
acc[key] = Color((configColors ?? DEFAULT_COLORS)[key])
return acc
}, {})
sbColors.primaryDarken15 = sbColors.primary.darken(0.15)
sbColors.primaryDarken20 = sbColors.primary.darken(0.20)
sbColors.primaryAlpha60 = sbColors.primary.alpha(0.6)
Expand All @@ -142,13 +145,12 @@ export function computeForegroundSidebarColor(colors) {
sbColors.sidebarHoverBg = firstReadable(['rgba(0, 0, 0, 0.12)', 'rgba(255, 255, 255, 0.3)'], sbColors.sidebar)
sbColors.sidebarHoverFg = firstReadable([CLR_PRIMARY_TEXT.LIGHT, CLR_PRIMARY_TEXT.DARK], sbColors.sidebar)


for (const [key, value] of Object.entries(sbColors)) {
themeVariables[`--clr-${kebabCase(key)}`] = value.string()
}
}

export async function getThemeConfig() {
export async function getThemeConfig () {
const themeUrl = config.api.base + 'theme'
const response = await (await fetch(themeUrl, {
method: 'GET',
Expand Down
Loading
Loading