Verified Commit 4887a1e4 authored by Georg Krause's avatar Georg Krause 💬
Browse files

Fix all linting errors

parent f1ba0aa3
module.exports = {
presets: ["@vue/cli-plugin-babel/preset"]
presets: ["@vue/cli-plugin-babel/preset"],
};
......@@ -19,7 +19,7 @@
<router-link
:to="{
name: 'collective',
params: { locale: $language.current }
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Footer/List.Item"
......@@ -40,7 +40,7 @@
<router-link
:to="{
name: 'support-us',
params: { locale: $language.current }
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Footer/List.Item"
......@@ -52,7 +52,7 @@
<router-link
:to="{
name: 'contact',
params: { locale: $language.current }
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Footer/List.Item"
......@@ -64,7 +64,7 @@
<router-link
:to="{
name: 'logos',
params: { locale: $language.current }
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Logos/Header"
......@@ -175,8 +175,8 @@ import LanguageSwitcher from "./components/LanguageSwitcher";
export default {
components: {
Navigation,
LanguageSwitcher
}
LanguageSwitcher,
},
};
</script>
<style lang="scss">
......
......@@ -18,14 +18,14 @@ export default {
autodetectLanguage() {
let userLanguage =
this.locale || navigator.language || navigator.userLanguage;
let available = locales.locales.map(e => {
let available = locales.locales.map((e) => {
return e.code;
});
let candidate;
let matching = available.filter(a => {
let matching = available.filter((a) => {
return userLanguage.replace("-", "_") === a;
});
let almostMatching = available.filter(a => {
let almostMatching = available.filter((a) => {
return userLanguage.replace("-", "_").split("_")[0] === a.split("_")[0];
});
if (matching.length > 0) {
......@@ -39,14 +39,14 @@ export default {
},
switchLanguage(newValue) {
this.$language.current = newValue;
}
},
},
watch: {
"$route.params.locale"(newValue) {
if (newValue) {
this.switchLanguage(newValue);
}
}
}
},
},
};
</script>
......@@ -12,7 +12,7 @@ export default {
data() {
let data = {
entries: [],
maxEntries: 5
maxEntries: 5,
};
return data;
},
......@@ -22,14 +22,14 @@ export default {
computed: {
shownEntries() {
return this.entries.slice(0, this.maxEntries);
}
},
},
methods: {
fetchFeed: function(url) {
fetchFeed: function (url) {
let self = this;
let r = new XMLHttpRequest();
r.open("GET", url, true);
r.onreadystatechange = function() {
r.onreadystatechange = function () {
let xmlDoc;
if (r.readyState != 4 || r.status != 200) return;
if (window.DOMParser) {
......@@ -46,12 +46,12 @@ export default {
};
r.send();
},
parseFeed: function(feed) {
parseFeed: function (feed) {
let entries = Array.from(feed.getElementsByTagName("entry"));
return entries.map(function(e) {
return entries.map(function (e) {
let r = {
title: e.getElementsByTagName("title")[0].textContent,
content: e.getElementsByTagName("content")[0].textContent
content: e.getElementsByTagName("content")[0].textContent,
};
for (let i = 0; i < e.childNodes.length; i++) {
let n = e.childNodes[i];
......@@ -62,7 +62,7 @@ export default {
}
return r;
});
}
}
},
},
};
</script>
<template>
<select id="language" name="language" v-model="language.current">
<option v-for="(language, key) in language.available" :key="key" :value="key">{{ language }}</option>
</select>
<select id="language" name="language" v-model="language.current">
<option
v-for="(language, key) in language.available"
:key="key"
:value="key"
>
{{ language }}
</option>
</select>
</template>
<script>
import { useGettext } from "@jshmrtn/vue3-gettext";
export default {
setup() {
const language = useGettext();
return {
language,
};
},
setup() {
const language = useGettext();
return {
language,
};
},
};
</script>
......@@ -53,7 +53,7 @@
class="pure-menu-link"
:to="{
name: 'collective',
params: { locale: $language.current }
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Footer/List.Item"
......@@ -126,7 +126,7 @@
class="pure-menu-link"
:to="{
name: 'support-us',
params: { locale: $language.current }
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Footer/List.Item"
......@@ -152,11 +152,11 @@ import LanguageSwitcher from "./LanguageSwitcher";
export default {
components: {
LanguageSwitcher
LanguageSwitcher,
},
data() {
return {
showMenu: false
showMenu: false,
};
},
created() {
......@@ -169,9 +169,12 @@ export default {
labels() {
return {
ariaLabel: this.$pgettext("Navigation/Aria.Label", "Main navigation"),
homeTitle: this.$pgettext("Navigation/Link.Title", "Return to homepage")
homeTitle: this.$pgettext(
"Navigation/Link.Title",
"Return to homepage"
),
};
}
}
},
},
};
</script>
......@@ -30,8 +30,8 @@ export default {
return {
amount: 10,
dolibarrUrl:
"https://dolibarr.funkwhale.audio/public/payment/newpayment.php"
"https://dolibarr.funkwhale.audio/public/payment/newpayment.php",
};
}
},
};
</script>
......@@ -59,7 +59,7 @@
<translate
translate-context="Content/PodPicker/Metadata"
:translate-params="{
activeUsersCount: pod.lastCheck.usage_users_active_month || 0
activeUsersCount: pod.lastCheck.usage_users_active_month || 0,
}"
>%{ activeUsersCount } active people</translate
>
......@@ -103,7 +103,7 @@ export default {
pageSize: 3,
offset: 0,
releases: [],
scores: {}
scores: {},
};
},
created() {
......@@ -115,19 +115,19 @@ export default {
upToDate: this.$pgettext(
"Content/PodPicker/Metadata.Title",
"This pod runs the latest version of Funkwhale"
)
),
};
},
sortedPods() {
this.computeScores(this.pods);
let self = this;
let sorted = orderBy(
this.pods.map(p => {
this.pods.map((p) => {
return { pod: p, score: self.scores[p.name].total };
}),
["score"]
);
sorted = sorted.map(p => {
sorted = sorted.map((p) => {
return p.pod;
});
sorted.reverse();
......@@ -141,7 +141,7 @@ export default {
},
suggestions() {
return this.getSuggestions(this.pageSize, this.offset);
}
},
},
methods: {
getSuggestions(pageSize, offset) {
......@@ -152,10 +152,10 @@ export default {
// ugly but reliable way to get the version number
let url = "https://docs.funkwhale.audio/releases.json";
axios.get(url).then(
response => {
(response) => {
self.releases = response.data.releases;
},
error => {
(error) => {
console.log("Cannot fetch releases", error);
}
);
......@@ -190,7 +190,7 @@ export default {
coefficient: () => {
return 2;
},
compute: data => {
compute: (data) => {
if (!data.lastCheck.usage_users_active_month) {
return 0;
}
......@@ -204,7 +204,7 @@ export default {
} else {
return Math.max(1 - (size / dangerousSize) ** decreaseFactor, 0);
}
}
},
},
{
id: "age",
......@@ -213,20 +213,20 @@ export default {
coefficient: () => {
return 1;
},
compute: data => {
compute: (data) => {
let now = new Date();
let days = Math.round(
(now - new Date(data.first_seen)) / (1000 * 60 * 60 * 24)
);
let magicNumber = 0.0089;
return 1 - Math.exp(-magicNumber * Math.max(days, 0));
}
},
},
{
id: "activity",
comment:
"User activity (Pods with more active users get a higher score)",
coefficient: data => {
coefficient: (data) => {
if (!data.lastCheck.usage_users_active_month) {
return 0;
}
......@@ -242,7 +242,7 @@ export default {
}
return coefficient * 2;
},
compute: data => {
compute: (data) => {
if (
!data.lastCheck.usage_users_active_month ||
!data.lastCheck.usage_users_total
......@@ -253,27 +253,27 @@ export default {
let activeProportion =
data.lastCheck.usage_users_active_month / total;
return 1 - Math.exp(-activeProportion * 3);
}
}
},
},
];
pods.forEach(p => {
pods.forEach((p) => {
let scoreData = {
detail: [],
total: 0
total: 0,
};
rules.forEach(rule => {
rules.forEach((rule) => {
let result = rule.compute(p);
let coefficient = rule.coefficient(p);
scoreData.detail.push({
coefficient,
result: result,
id: rule.id
id: rule.id,
});
scoreData.total += coefficient * result;
});
self.$set(self.scores, p.name, scoreData);
});
}
}
},
},
};
</script>
......@@ -7,9 +7,9 @@ import translations from "../locales/translations.json";
require("fork-awesome/css/fork-awesome.min.css");
let availableLanguages = (function() {
let availableLanguages = (function () {
let l = {};
locales.locales.forEach(c => {
locales.locales.forEach((c) => {
l[c.code] = c.label;
});
return l;
......@@ -21,11 +21,9 @@ const gettext = createGettext({
defaultLanguage: defaultLanguage,
translations: translations,
silent: true,
setGlobalProperties: true
setGlobalProperties: true,
});
const mainApp = createApp(App)
.use(router)
.use(gettext);
const mainApp = createApp(App).use(router).use(gettext);
mainApp.mount("#app");
......@@ -29,6 +29,6 @@ if (process.env.NODE_ENV === "production") {
},
error(error) {
console.error("Error during service worker registration:", error);
}
},
});
}
......@@ -16,27 +16,33 @@
<h2><i class="fa fa-android"></i>&nbsp; Android</h2>
<div class="apps-list">
<div class="app-card">
<div class="img-wrapper">
<div class="img-wrapper">
<img src="../assets/apps/ffa.png" />
</div>
<div class="content">
<h3>
<router-link
:to="{
name: 'funkwhaleandroid',
params: { locale: $language.current }
}"
<router-link
:to="{
name: 'funkwhaleandroid',
params: { locale: $language.current },
}"
>
<translate translate-context="Content/Applications/Paragraph"
>Funkwhale For Android</translate
>
<translate translate-context="Content/Applications/Paragraph"
>Funkwhale For Android</translate
>
</router-link>
</router-link>
</h3>
<div class="tags">
<span class="tag">Free</span>
<span class="tag">Beta</span>
<a class="tag" href="https://fdroid.funkwhale.audio">F-Droid (self-hosted)</a>
<a class="tag" href="https://dev.funkwhale.audio/funkwhale/funkwhale-android/" target="_blank">
<a class="tag" href="https://fdroid.funkwhale.audio"
>F-Droid (self-hosted)</a
>
<a
class="tag"
href="https://dev.funkwhale.audio/funkwhale/funkwhale-android/"
target="_blank"
>
<i class="fa fa-code"></i> Source
</a>
</div>
......@@ -352,7 +358,7 @@ export default {
methods: {
getInnerTitle() {
return this.$pgettext("HTML/Meta/Title", "Applications");
}
}
},
},
};
</script>
......@@ -278,7 +278,7 @@ export default {
methods: {
getInnerTitle() {
return this.$pgettext("HTML/Meta/Title", "Community");
}
}
},
},
};
</script>
......@@ -140,7 +140,7 @@ export default {
methods: {
getInnerTitle() {
return this.$pgettext("Content/Contact/Header", "Contact");
}
}
},
},
};
</script>
......@@ -48,7 +48,7 @@ export default {
methods: {
getInnerTitle() {
return this.$pgettext("Content/Credits/Header", "Credits");
}
},
},
computed: {
groups() {
......@@ -68,7 +68,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"An open network for secure, decentralized communication"
)
),
},
{
label: "Plume",
......@@ -76,7 +76,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"A federated blogging application"
)
),
},
{
label: "CodiMD",
......@@ -84,7 +84,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"Realtime collaborative markdown notes on all platforms"
)
),
},
{
label: "Mastodon",
......@@ -92,7 +92,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"A decentralized social network"
)
),
},
{
label: "Flarum",
......@@ -100,7 +100,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"A forum and decision making platform"
)
),
},
{
label: "GitLab",
......@@ -108,7 +108,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"An open source software forge"
)
),
},
{
label: "Weblate",
......@@ -116,7 +116,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"Web-based continuous localization"
)
),
},
{
label: "Bitwarden",
......@@ -124,7 +124,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"Open source password management"
)
),
},
{
label: "bitwarden_rs",
......@@ -132,7 +132,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"Unofficial Bitwarden compatible server written in Rust"
)
),
},
{
label: "Dolibarr",
......@@ -140,7 +140,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"Open Source ERP & CRM"
)
),
},
{
label: "Open Collective",
......@@ -148,9 +148,9 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"An organization for your community, transparent by design"
)
}
]
),
},
],
},
{
id: "infrastructure",
......@@ -170,7 +170,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"The Universal Operating System"
)
),
},
{
label: "Proxmox VE",
......@@ -178,7 +178,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"Open-Source Virtualization Platform"
)
),
},
{
label: "Docker",
......@@ -186,7 +186,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"A way to run applications securely isolated in a container, packaged with all its dependencies and libraries."
)
),
},
{
label: "nginx",
......@@ -194,7 +194,7 @@ export default {
summary: this.$pgettext(
"Content/Credits/Paragraph",
"The open source web server that powers 400 million websites"
)
),
},
{