update 2023-03-23 18:24:28

This commit is contained in:
github-actions[bot] 2023-03-23 18:24:28 +08:00
parent a735bbc4b4
commit 5e5267f6c3
8 changed files with 170 additions and 15 deletions

61
gn/Makefile Normal file
View File

@ -0,0 +1,61 @@
# SPDX-License-Identifier: GPL-3.0-only
#
# Copyright (C) 2022 ImmortalWrt.org
include $(TOPDIR)/rules.mk
PKG_NAME:=gn
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://gn.googlesource.com/gn.git
PKG_SOURCE_DATE:=2023-02-17
PKG_SOURCE_VERSION:=b25a2f8c2d33f02082f0f258350f5e22c0973108
PKG_MIRROR_HASH:=skip
PKG_LICENSE:=BSD 3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org>
ifneq ($(wildcard $(TOPDIR)/feeds/packages/devel/ninja/ninja.mk),)
PKG_BUILD_DEPENDS+= ninja/host
endif
PKG_HOST_ONLY:=1
HOST_BUILD_PARALLEL:=1
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
define Package/gn
SECTION:=devel
CATEGORY:=Development
TITLE:=A meta-build system that generates build files for Ninja
URL:=https://gn.googlesource.com/gn/
BUILDONLY:=1
endef
define Package/gn/description
GN can generate Ninja build files for C, C++, Rust, Objective C,
and Swift source on most popular platforms.
endef
define Host/Configure
$(PYTHON) $(HOST_BUILD_DIR)/build/gen.py \
--no-last-commit-position
endef
define Host/Compile
ninja -C $(HOST_BUILD_DIR)/out
endef
define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
$(INSTALL_BIN) $(HOST_BUILD_DIR)/out/gn $(STAGING_DIR_HOSTPKG)/bin/
endef
define Host/Clean
$(RM) $(STAGING_DIR_HOSTPKG)/bin/gn
endef
$(eval $(call HostBuild))
$(eval $(call BuildPackage,gn))

11
gn/patches/010-gcc.patch Normal file
View File

@ -0,0 +1,11 @@
--- a/build/gen.py
+++ b/build/gen.py
@@ -368,7 +368,7 @@ def WriteGNNinja(path, platform, host, o
cxx = os.environ.get('CXX', 'g++')
ld = os.environ.get('LD', 'g++')
ar = os.environ.get('AR', 'ar -X64')
- elif platform.is_msys() or platform.is_mingw():
+ elif platform.is_msys() or platform.is_mingw() or platform.is_linux():
cxx = os.environ.get('CXX', 'g++')
ld = os.environ.get('LD', 'g++')
ar = os.environ.get('AR', 'ar')

View File

@ -0,0 +1,9 @@
// Generated by build/gen.py.
#ifndef OUT_LAST_COMMIT_POSITION_H_
#define OUT_LAST_COMMIT_POSITION_H_
#define LAST_COMMIT_POSITION_NUM 2081
#define LAST_COMMIT_POSITION "2081 (b25a2f8c2d33)"
#endif // OUT_LAST_COMMIT_POSITION_H_

View File

@ -298,6 +298,7 @@ return view.extend({
ss = o.subsection;
ss.addremove = true;
ss.rowcolors = true;
ss.sortable = true;
ss.nodescriptions = true;
ss.modaltitle = L.bind(hp.loadModalTitle, this, _('Routing node'), _('Add a routing node'), data[0]);
@ -373,6 +374,7 @@ return view.extend({
ss = o.subsection;
ss.addremove = true;
ss.rowcolors = true;
ss.sortable = true;
ss.nodescriptions = true;
ss.modaltitle = L.bind(hp.loadModalTitle, this, _('Routing rule'), _('Add a routing rule'), data[0]);
@ -556,6 +558,7 @@ return view.extend({
ss = o.subsection;
ss.addremove = true;
ss.rowcolors = true;
ss.sortable = true;
ss.nodescriptions = true;
ss.modaltitle = L.bind(hp.loadModalTitle, this, _('DNS server'), _('Add a DNS server'), data[0]);
@ -644,6 +647,7 @@ return view.extend({
ss = o.subsection;
ss.addremove = true;
ss.rowcolors = true;
ss.sortable = true;
ss.nodescriptions = true;
ss.modaltitle = L.bind(hp.loadModalTitle, this, _('DNS rule'), _('Add a DNS rule'), data[0]);

View File

@ -25,6 +25,21 @@ function parseShareLink(uri, features) {
uri = uri.split('://');
if (uri[0] && uri[1]) {
switch (uri[0]) {
case 'http':
case 'https':
var url = new URL('http://' + uri[1]);
config = {
label: url.hash ? decodeURIComponent(url.hash.slice(1)) : null,
type: 'http',
address: url.hostname,
port: url.port || '80',
username: url.username ? decodeURIComponent(url.username) : null,
password: url.password ? decodeURIComponent(url.password) : null,
tls: (uri[0] === 'https') ? '1' : '0'
};
break;
case 'hysteria':
/* https://github.com/HyNetwork/hysteria/wiki/URI-Scheme */
var url = new URL('http://' + uri[1]);
@ -49,7 +64,25 @@ function parseShareLink(uri, features) {
tls_sni: params.get('peer'),
tls_alpn: params.get('alpn'),
tls_insecure: params.get('insecure') ? '1' : '0'
}
};
break;
case 'socks':
case 'socks4':
case 'socks4a':
case 'socsk5':
case 'socks5h':
var url = new URL('http://' + uri[1]);
config = {
label: url.hash ? decodeURIComponent(url.hash.slice(1)) : null,
type: 'socks',
address: url.hostname,
port: url.port || '80',
username: url.username ? decodeURIComponent(url.username) : null,
password: url.password ? decodeURIComponent(url.password) : null,
socks_version: (uri[0].includes('4')) ? '4' : '5'
};
break;
case 'ss':
@ -305,6 +338,7 @@ return view.extend({
o = s.taboption('node', form.SectionValue, '_node', form.GridSection, 'node');
ss = o.subsection;
ss.addremove = true;
ss.rowcolors = true;
ss.sortable = true;
ss.nodescriptions = true;
ss.modaltitle = L.bind(hp.loadModalTitle, this, _('Node'), _('Add a node'), data[0]);

View File

@ -36,6 +36,7 @@ return view.extend({
s = m.section(form.GridSection, 'server');
s.addremove = true;
s.rowcolors = true;
s.sortable = true;
s.nodescriptions = true;
s.modaltitle = L.bind(hp.loadModalTitle, this, _('Server'), _('Add a server'), data[0]);
@ -65,18 +66,6 @@ return view.extend({
o.value('vless', _('VLESS'));
o.value('vmess', _('VMess'));
o.rmempty = false;
o.onchange = function(ev, section_id, value) {
var tls_element = this.map.findElement('id', 'cbid.homeproxy.%s.tls'.format(section_id)).firstElementChild;
if (value === 'hysteria') {
var event = document.createEvent('HTMLEvents');
event.initEvent('change', true, true);
tls_element.checked = true;
tls_element.dispatchEvent(event);
tls_element.disabled = true;
} else
tls_element.disabled = null;
}
o = s.option(form.Value, 'port', _('Port'),
_('The port must be unique.'));
@ -320,6 +309,20 @@ return view.extend({
o.depends('type', 'vless');
o.depends('type', 'vmess');
o.rmempty = false;
o.validate = function(section_id, value) {
if (section_id) {
var type = this.map.lookupOption('type', section_id)[0].formvalue(section_id);
var tls = this.map.findElement('id', 'cbid.homeproxy.%s.tls'.format(section_id)).firstElementChild;
if (['hysteria'].includes(type)) {
tls.checked = true;
tls.disabled = true;
} else
tls.disabled = null;
}
return true;
}
o.modalonly = true;
o = s.option(form.Value, 'tls_sni', _('TLS SNI'),

View File

@ -75,7 +75,7 @@ export function isEmpty(res) {
};
export function strToInt(str) {
return !isEmpty(str) ? int(str) || null : null;
return !isEmpty(str) ? (int(str) || null) : null;
};
export function removeBlankAttrs(res) {

View File

@ -102,6 +102,21 @@ function parse_uri(uri) {
uri = split(trim(uri), '://');
switch (uri[0]) {
case 'http':
case 'https':
const http_url = parseURL('http://' + uri[1]);
config = {
label: http_url.hash ? urldecode(http_url.hash) : null,
type: 'http',
address: http_url.hostname,
port: http_url.port || '80',
username: http_url.username ? urldecode(http_url.username) : null,
password: http_url.password ? urldecode(http_url.password) : null,
tls: (uri[0] === 'https') ? '1' : '0'
};
break;
case 'hysteria':
/* https://github.com/HyNetwork/hysteria/wiki/URI-Scheme */
const hysteria_url = parseURL('http://' + uri[1]),
@ -116,7 +131,7 @@ function parse_uri(uri) {
}
config = {
label: urldecode(hysteria_url.hash),
label: hysteria_url.hash ? urldecode(hysteria_url.hash) : null,
type: 'hysteria',
address: hysteria_url.hostname,
port: hysteria_url.port,
@ -132,6 +147,24 @@ function parse_uri(uri) {
tls_alpn: hysteria_params.alpn
};
break;
case 'socks':
case 'socks4':
case 'socks4a':
case 'socsk5':
case 'socks5h':
const socks_url = parseURL('http://' + uri[1]);
config = {
label: socks_url.hash ? urldecode(socks_url.hash) : null,
type: 'socks',
address: socks_url.hostname,
port: socks_url.port || '80',
username: socks_url.username ? urldecode(socks_url.username) : null,
password: socks_url.password ? urldecode(socks_url.password) : null,
socks_version: (match(uri[0], /4/)) ? '4' : '5'
};
break;
case 'ss':
/* "Lovely" Shadowrocket format */