add common.js

This commit is contained in:
Gabe Yuan
2023-10-23 13:35:57 +08:00
parent 160fc218fc
commit e89da9120c
4 changed files with 194 additions and 218 deletions

View File

@@ -199,12 +199,13 @@ export const loadOrFetchWebfix = async (url) => {
/**
* 匹配站点
*/
export async function webfix(href, { injectWebfix }) {
export async function runWebfix({ injectWebfix }) {
try {
if (!injectWebfix) {
return;
}
const href = document.location.href;
const sites = await loadOrFetchWebfix(process.env.REACT_APP_WEBFIXURL);
for (var i = 0; i < sites.length; i++) {
var site = sites[i];