Skip to content

Commit

Permalink
update 2024-12-28 15:58:41
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzok8 committed Dec 28, 2024
1 parent 529e16c commit 2c68e33
Show file tree
Hide file tree
Showing 31 changed files with 13,434 additions and 0 deletions.
63 changes: 63 additions & 0 deletions luci-app-fchomo/.prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/bin/bash
PKG_NAME="$1"
CURDIR="$2"
PKG_BUILD_DIR="$3"
PKG_BUILD_BIN="$PKG_BUILD_DIR/bin"
export PATH="$PATH:$PKG_BUILD_BIN"

OS=linux
ARCH=amd64
JQVERSION=1.7.1
DOCNAME=Ruleset-URI-Scheme
SHARKNAME=shark-taiko.gif

mkdir -p "$PKG_BUILD_BIN"
curl -L "https://github.com/jqlang/jq/releases/download/jq-${JQVERSION}/jq-${OS}-${ARCH}" -o "$PKG_BUILD_BIN"/jq
chmod +x "$PKG_BUILD_BIN"/jq
latest="$(curl -L https://api.github.com/repos/kpym/gm/releases/latest | jq -rc '.tag_name' 2>/dev/null)"
curl -L "https://github.com/kpym/gm/releases/download/${latest}/gm_${latest#v}_Linux_intel64.tar.gz" -o- | tar -xz -C "$PKG_BUILD_BIN"
latest="$(curl -L https://api.github.com/repos/tdewolff/minify/releases/latest | jq -rc '.tag_name' 2>/dev/null)"
curl -L "https://github.com/tdewolff/minify/releases/download/${latest}/minify_${OS}_${ARCH}.tar.gz" -o- | tar -xz -C "$PKG_BUILD_BIN"
chmod -R +x "$PKG_BUILD_BIN"

cp "$CURDIR"/docs/$DOCNAME.md "$PKG_BUILD_DIR"
pushd "$PKG_BUILD_DIR"
gm $DOCNAME.md
p=$(sed -n '/github.min.css/=' $DOCNAME.html)
{
head -n$(( $p -1 )) $DOCNAME.html
echo '<style>'
cat "$CURDIR"/docs/css/ClearnessDark.css
echo '</style>'
tail -n +$(( $p +1 )) $DOCNAME.html
} > buildin.html
popd
minify "$PKG_BUILD_DIR"/buildin.html | base64 | tr -d '\n' > "$PKG_BUILD_DIR"/base64
sed -i "s|'cmxzdHBsYWNlaG9sZGVy'|'$(cat "$PKG_BUILD_DIR"/base64)'|" "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js
# shaka
echo -n "'" > "$PKG_BUILD_DIR"/base64
base64 "$CURDIR"/docs/img/$SHARKNAME | tr -d '\n' >> "$PKG_BUILD_DIR"/base64
echo "'" >> "$PKG_BUILD_DIR"/base64
p=$(sed -n "/'c2hhcmstdGFpa28uZ2lm'/=" "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js)
{
head -n$(( $p -1 )) "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js
cat "$PKG_BUILD_DIR"/base64
tail -n +$(( $p +1 )) "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js
} > "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js.new
mv -f "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js.new "$PKG_BUILD_DIR"/htdocs/luci-static/resources/fchomo.js

if [ -d "$CURDIR/.git" ]; then
config="$CURDIR/.git/config"
else
config="$(sed "s|^gitdir:\s*|$CURDIR/|;s|$|/config|" "$CURDIR/.git")"
fi
[ -n "$(sed -En '/^\[remote /{h;:top;n;/^\[/b;s,(https?://gitcode\.(com|net)),\1,;T top;H;x;s|\n\s*|: |;p;}' "$config")" ] && {
for d in luasrc ucode htdocs root src; do
rm -rf "$PKG_BUILD_DIR"/$d
done
mkdir -p "$PKG_BUILD_DIR"/htdocs/luci-static/resources/view
touch "$PKG_BUILD_DIR"/htdocs/luci-static/resources/view/$PKG_NAME.js
mkdir -p "$PKG_BUILD_DIR"/root/usr/share/luci/menu.d
touch "$PKG_BUILD_DIR"/root/usr/share/luci/menu.d/$PKG_NAME.json
}
exit 0
45 changes: 45 additions & 0 deletions luci-app-fchomo/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (C) 2024 Anya Lin <[email protected]>

include $(TOPDIR)/rules.mk

LUCI_TITLE:=FullCombo Mihomo supplies maximum customization on OpenWrt.
LUCI_PKGARCH:=all
LUCI_DEPENDS:= \
+mihomo \
+ca-bundle \
+firewall4 \
+kmod-inet-diag \
+kmod-nft-tproxy \
+yq +wget-ssl \
# +ip-full +kmod-tun +dnsmasq-full \
PKG_NAME:=luci-app-fchomo

define Package/luci-app-fchomo/conffiles
/etc/config/fchomo
/etc/fchomo/certs/
/etc/fchomo/provider/
/etc/fchomo/ruleset/
/etc/fchomo/resources/
/etc/fchomo/templates/
/etc/fchomo/resources.json
/etc/fchomo/geoip.dat
/etc/fchomo/geosite.dat
/etc/fchomo/asn.mmdb
/etc/fchomo/cache.db
endef

PKG_UNPACK=$(CURDIR)/.prepare.sh $(PKG_NAME) $(CURDIR) $(PKG_BUILD_DIR)

define Package/luci-app-fchomo/prerm
#!/bin/sh
uci delete firewall.fchomo_pre
uci delete firewall.fchomo_post
uci commit firewall
endef

include $(TOPDIR)/feeds/luci/luci.mk

# call BuildPackage - OpenWrt buildroot signature
69 changes: 69 additions & 0 deletions luci-app-fchomo/docs/Ruleset-URI-Scheme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Import rule-set links format

## Structure

**remote:** `http[s]://[auth@]<host><path>?fmt=<format>&behav=<behavior>[&key=value][#label]`
**local:** `file://[host]<path>?fmt=<format>&behav=<behavior>[&fill=<base64edStr>][#label]`
**inline:** `inline://<Base64edStr>?behav=<behavior>[#label]`

## Components

### Scheme

Can be `http` or `https` or `file` or `inline`.

### Auth

Add it only if required by the target host.

### Host

The format is `hostname[:port]`.
`hostname` can be **Domain** or **IP Address**.
`:port` is optional, add it only if required by the target host.

### Path

The shortest format is `/`.

### QueryParameters

+ `fmt`: Required. Available values ​​refer to **format**.
+ `behav`: Required. Available values ​​refer to **behavior**.
+ `sec`: Optional. Available under **remote**. Available values ​​refer to **interval**.
+ `rawq`: Optional. Available under **remote**. Available values ​​refer to **rawQuery**.
+ `fill`: Optional. Available under **local**. Available values ​​refer to **filler**.

#### format

Can be `text` or `yaml` or `mrs`. Rule file format.

#### behavior

Can be `domain` or `ipcidr` or `classical`. Rule file behavior.

#### interval

The update interval for the Rule set, in seconds or /^(\d+)(s|m|h|d)?$/.

#### rawQuery

This parameter is required if the original link contains a url query.
Encrypt the part `key1=value1&key2=value2` after `?` in the original link with `encodeURIComponent` and use it as the payload of this parameter.

#### filler

Base64edStr format file content.

### Base64edStr

Generation steps:

1. Base64 encode payload.
2. Replace all `+` with `-` and all `/` with `_` in base64 string.
3. Remove all `=` from the EOF the base64 string.

### URIFragment

Ruleset label. Empty strings are not recommended.
Need encoded by `encodeURIComponent`.
209 changes: 209 additions & 0 deletions luci-app-fchomo/docs/css/ClearnessDark.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,209 @@
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
margin: 0;
padding: 0;
}
body {
font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
font-size: 13px;
line-height: 18px;
color: #fff;
background-color: #282a36;
margin: 10px 13px 10px 13px;
}
a {
color: #59acf3;
}
a:hover {
color: #a7d8ff;
text-decoration: none;
}
a img {
border: none;
}
p {
margin-bottom: 9px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #fff;
line-height: 36px;
}
h1 {
margin-bottom: 18px;
font-size: 30px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 13px;
}
hr {
margin: 0 0 19px;
border: 0;
border-bottom: 1px solid #ccc;
}
blockquote {
padding: 13px 13px 21px 15px;
margin-bottom: 18px;
font-family:georgia,serif;
font-style: italic;
}
blockquote:before {
content:"\201C";
font-size:40px;
margin-left:-10px;
font-family:georgia,serif;
color:#eee;
}
blockquote p {
font-size: 14px;
font-weight: 300;
line-height: 18px;
margin-bottom: 0;
font-style: italic;
}
code, pre {
font-family: Monaco, Andale Mono, Courier New, monospace;
}
code {
color: #ff4a14;
padding: 1px 3px;
font-size: 12px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
pre {
display: block;
padding: 14px;
margin: 0 0 18px;
line-height: 16px;
font-size: 11px;
border: 1px solid #bf370f;
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
}
pre code {
background-color: #282a36;
color: #ff4a14;
font-size: 11px;
padding: 0;
}
@media screen and (min-width: 768px) {
body {
width: 748px;
margin:10px auto;
}
}

/**
* obsidian.css
* Obsidian style
* ported by Alexander Marenin (http://github.com/ioncreature)
*/

.hljs {
display: block;
overflow-x: auto;
padding: 0.5em;
background: #282b2e;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-selector-id {
color: #93c763;
}

.hljs-number {
color: #ffcd22;
}

.hljs {
color: #e0e2e4;
}

.hljs-attribute {
color: #668bb0;
}

.hljs-code,
.hljs-class .hljs-title,
.hljs-section {
color: white;
}

.hljs-regexp,
.hljs-link {
color: #d39745;
}

.hljs-meta {
color: #557182;
}

.hljs-tag,
.hljs-name,
.hljs-bullet,
.hljs-subst,
.hljs-emphasis,
.hljs-type,
.hljs-built_in,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-addition,
.hljs-variable,
.hljs-template-tag,
.hljs-template-variable {
color: #8cbbad;
}

.hljs-string,
.hljs-symbol {
color: #ec7600;
}

.hljs-comment,
.hljs-quote,
.hljs-deletion {
color: #818e96;
}

.hljs-selector-class {
color: #A082BD
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-literal,
.hljs-doctag,
.hljs-title,
.hljs-section,
.hljs-type,
.hljs-name,
.hljs-strong {
font-weight: bold;
}
Binary file added luci-app-fchomo/docs/img/shark-taiko.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2c68e33

Please sign in to comment.