mirror of
https://github.com/tachiyomiorg/website.git
synced 2024-12-21 15:41:59 +01:00
Create global constants file (#273)
* Create global constants file * Update constants import for all files * Tweak project style guides Change printWidth from 80, recommended project widths were at 100/120 so I choose 120. Also while I'm doing it, tweak the EndOfLine setting to prevent VS Code from going ham on LF/CRLF sets. * Remove the ESLint ignore lines in PR And other import whitespace near it * SNAKE_CASE constants instead of camelCase
This commit is contained in:
parent
e15291d180
commit
6a660e98fd
@ -23,7 +23,9 @@
|
||||
"markdown"
|
||||
],
|
||||
"rules": {
|
||||
"prettier/prettier": "error",
|
||||
"prettier/prettier": ["error", {
|
||||
"endOfLine":"auto"
|
||||
}],
|
||||
"import/no-unresolved": [
|
||||
2,
|
||||
{ "ignore": ["^@"] }
|
||||
|
@ -1,7 +1,8 @@
|
||||
{
|
||||
"tabWidth": 4,
|
||||
"useTabs": true,
|
||||
"printWidth": 120,
|
||||
"trailingComma": "es5",
|
||||
"bracketSpacing": true,
|
||||
"endOfLine": "lf"
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
|
@ -11,11 +11,7 @@
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
const RELEASE_URL =
|
||||
"https://api.github.com/repos/inorichi/tachiyomi/releases/latest";
|
||||
|
||||
const PREVIEW_URL = "https://tachiyomi.kanade.eu/latest";
|
||||
import { GITHUB_LATEST_API, GITHUB_LATEST_RELEASE, KANADE_LATEST } from "../constants";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -53,7 +49,7 @@ export default {
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
const { data } = await axios.get(RELEASE_URL);
|
||||
const { data } = await axios.get(GITHUB_LATEST_API);
|
||||
// Maybe eventually some release has more than the apk in assets.
|
||||
const apkAsset = data.assets.find((a) => a.name.includes(".apk"));
|
||||
// Set the values.
|
||||
@ -85,7 +81,7 @@ export default {
|
||||
window.location.assign(
|
||||
this.$props.downloadStableUrl ||
|
||||
this.$data.browserDownloadUrl ||
|
||||
RELEASE_URL
|
||||
GITHUB_LATEST_RELEASE
|
||||
);
|
||||
window.ga(
|
||||
"send",
|
||||
@ -116,7 +112,7 @@ export default {
|
||||
},
|
||||
});
|
||||
window.location.assign(
|
||||
this.$props.downloadPreviewUrl || PREVIEW_URL
|
||||
this.$props.downloadPreviewUrl || KANADE_LATEST
|
||||
);
|
||||
window.ga(
|
||||
"send",
|
||||
|
@ -47,9 +47,7 @@ import axios from "axios";
|
||||
import groupBy from "lodash.groupby";
|
||||
import sortBy from "lodash.sortby";
|
||||
import ISO6391 from "iso-639-1";
|
||||
|
||||
const EXTENSION_JSON =
|
||||
"https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/index.json";
|
||||
import { GITHUB_EXTENSION_JSON } from "../constants";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -59,7 +57,7 @@ export default {
|
||||
},
|
||||
|
||||
async beforeMount() {
|
||||
const { data } = await axios.get(EXTENSION_JSON);
|
||||
const { data } = await axios.get(GITHUB_EXTENSION_JSON);
|
||||
const values = Object.values(groupBy(data, "lang"));
|
||||
this.$data.extensions = sortBy(values, [
|
||||
(g) => this.langName(g[0].lang),
|
||||
|
@ -5,9 +5,7 @@
|
||||
<script>
|
||||
import axios from "axios";
|
||||
import marked from "marked";
|
||||
|
||||
const RELEASE_URL =
|
||||
"https://api.github.com/repos/inorichi/tachiyomi/releases/latest";
|
||||
import { GITHUB_LATEST_API } from "../constants";
|
||||
|
||||
export default {
|
||||
data() {
|
||||
@ -17,7 +15,7 @@ export default {
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
const { data } = await axios.get(RELEASE_URL);
|
||||
const { data } = await axios.get(GITHUB_LATEST_API);
|
||||
this.$data.releaseNotes = marked(data.body);
|
||||
},
|
||||
};
|
||||
|
@ -11,9 +11,7 @@
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
const RELEASE_URL =
|
||||
"https://api.github.com/repos/inorichi/tachiyomi/releases/latest";
|
||||
import { GITHUB_LATEST_API } from "../constants";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@ -29,7 +27,7 @@ export default {
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
const { data } = await axios.get(RELEASE_URL);
|
||||
const { data } = await axios.get(GITHUB_LATEST_API);
|
||||
// Set the values.
|
||||
this.$data.tagName = data.tag_name;
|
||||
},
|
||||
|
4
src/.vuepress/constants.js
Normal file
4
src/.vuepress/constants.js
Normal file
@ -0,0 +1,4 @@
|
||||
export const GITHUB_EXTENSION_JSON = "https://raw.githubusercontent.com/inorichi/tachiyomi-extensions/repo/index.json";
|
||||
export const GITHUB_LATEST_RELEASE = "https://github.com/inorichi/tachiyomi/releases/latest";
|
||||
export const GITHUB_LATEST_API = "https://api.github.com/repos/inorichi/tachiyomi/releases/latest";
|
||||
export const KANADE_LATEST = "https://tachiyomi.kanade.eu/latest";
|
@ -80,16 +80,9 @@
|
||||
|
||||
<script>
|
||||
import axios from "axios";
|
||||
|
||||
import CloudDownloadIcon from "vue-material-design-icons/CloudDownload.vue";
|
||||
import BookOpenVariantIcon from "vue-material-design-icons/BookOpenVariant.vue";
|
||||
|
||||
const RELEASE_URL =
|
||||
"https://api.github.com/repos/inorichi/tachiyomi/releases/latest";
|
||||
|
||||
const LATEST_RELEASE = "https://github.com/inorichi/tachiyomi/releases/latest";
|
||||
|
||||
const PREVIEW_URL = "https://tachiyomi.kanade.eu/latest";
|
||||
import { GITHUB_LATEST_API, GITHUB_LATEST_RELEASE, KANADE_LATEST } from "../../constants";
|
||||
|
||||
export default {
|
||||
name: "Home",
|
||||
@ -126,7 +119,7 @@ export default {
|
||||
},
|
||||
|
||||
async mounted() {
|
||||
const { data } = await axios.get(RELEASE_URL);
|
||||
const { data } = await axios.get(GITHUB_LATEST_API);
|
||||
const apkAsset = data.assets.find((a) => a.name.includes(".apk"));
|
||||
this.$data.tagName = data.tag_name;
|
||||
this.$data.browserDownloadUrl = apkAsset.browser_download_url;
|
||||
@ -194,7 +187,7 @@ export default {
|
||||
},
|
||||
});
|
||||
window.location.assign(
|
||||
this.$data.browserDownloadUrl || LATEST_RELEASE
|
||||
this.$data.browserDownloadUrl || GITHUB_LATEST_RELEASE
|
||||
);
|
||||
window.ga(
|
||||
"send",
|
||||
@ -263,7 +256,7 @@ export default {
|
||||
"animate__animated animate__faster animate__zoomOut",
|
||||
},
|
||||
});
|
||||
window.location.assign(PREVIEW_URL);
|
||||
window.location.assign(KANADE_LATEST);
|
||||
window.ga(
|
||||
"send",
|
||||
"event",
|
||||
|
Loading…
Reference in New Issue
Block a user