Browse Source

Merge branch 'dev'

luolongfei 1 year ago
parent
commit
ee11630af5
6 changed files with 27 additions and 1588 deletions
  1. 10 2
      .env.example
  2. 7 5
      app/Console/FreeNom.php
  3. 1 1577
      app/helpers.php
  4. 1 2
      docker-compose.yml
  5. 4 1
      resources/lang/en.php
  6. 4 1
      resources/lang/zh.php

+ 10 - 2
.env.example

@@ -12,7 +12,7 @@
 #####################################################################
 
 # .env 文件版本
-ENV_FILE_VERSION='v3.0'
+ENV_FILE_VERSION='v3.1'
 
 ######################  账户配置 Account config  #########################
 # Freenom 账户 Freenom Account
@@ -184,4 +184,12 @@ FF_SECRET_KEY='https://github.com/luolongfei/freenom'
 # aws waf solver 接口地址
 # aws waf solver url
 AWS_WAF_SOLVER_URL='aws-waf-solver:2019/aws_waf_token'
-######################  end AWS WAF SOLVER  #########################
+
+# 使用开源的 AWS WAF Solver API 0:不使用 1:使用
+# Use open-source AWS WAF Solver API 0: Do not use, 1: Use
+USE_OPEN_SOURCE_WAF_SOLVER_API=1
+
+# 开源的 AWS WAF Solver URL
+# Open-source AWS WAF Solver URL
+OPEN_SOURCE_WAF_SOLVER_URL='https://aws-waf-solver.llf.app/token'
+######################  end AWS WAF SOLVER  #########################

+ 7 - 5
app/Console/FreeNom.php

@@ -20,7 +20,7 @@ use GuzzleHttp\Cookie\SetCookie;
 
 class FreeNom extends Base
 {
-    const VERSION = 'v0.6.0';
+    const VERSION = 'v0.6.1';
 
     const TIMEOUT = 33;
 
@@ -93,7 +93,7 @@ class FreeNom extends Base
             'headers' => [
                 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9',
                 'Accept-Encoding' => 'gzip, deflate, br',
-                'User-Agent' => sprintf('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/%s Safari/537.36', get_random_user_agent()),
+                'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36',
             ],
             'timeout' => self::TIMEOUT,
             CURLOPT_FOLLOWLOCATION => true,
@@ -435,6 +435,8 @@ class FreeNom extends Base
         $accounts = $this->getAccounts();
         $totalAccounts = count($accounts);
 
+        $awsWafToken = getAwsWafToken();
+
         system_log(sprintf(lang('100049'), $totalAccounts));
 
         foreach ($accounts as $index => $account) {
@@ -446,9 +448,9 @@ class FreeNom extends Base
                 system_log(sprintf(lang('100050'), get_local_num($num), $this->username, $num, $totalAccounts));
 
                 $this->jar = new CookieJar(); // 所有请求共用一个 CookieJar 实例
-
-                $awsWafToken = getAwsWafToken();
-                $this->jar->setCookie(buildAwsWafCookie($awsWafToken));
+                if ($awsWafToken !== '') {
+                    $this->jar->setCookie(buildAwsWafCookie($awsWafToken));
+                }
 
                 $this->login($this->username, $this->password);
 

File diff suppressed because it is too large
+ 1 - 1577
app/helpers.php


+ 1 - 2
docker-compose.yml

@@ -19,13 +19,12 @@ services:
     aws-waf-solver:
         image: luolongfei/aws-waf-solver
         container_name: aws-waf-solver
+        shm_size: 1gb
         privileged: true
         pull_policy: always
         extends:
             file: ./common.yml
             service: common_config
-        ports:
-            - 2019:2019
         volumes:
             - ./.env:/app/.env
 

+ 4 - 1
resources/lang/en.php

@@ -27,6 +27,8 @@ return [
         '34520017' => 'The AWS_WAF_SOLVER_URL environment variable is not configured',
         '34520018' => 'Failed to get AWS WAF Token',
         '34520019' => '<light_green>Will automatically use the new AWS WAF Token</light_green>',
+        '34520020' => 'The OPEN_SOURCE_WAF_SOLVER_URL environment variable is not configured',
+        '34520021' => 'Waiting for the open source api to return the token for more than %d seconds, still unable to obtain a valid token, this time can not continue to execute',
     ],
     'messages' => [
         '100001' => 'The cookie value named WHMCSZH5eHTGhfvzP could not be obtained, so this login is not valid, please check if your account or password is correct',
@@ -161,6 +163,7 @@ return [
         '100136' => 'Pushplus',
         '100137' => 'Pushplus Failed to send message: <red>%s</red>',
         '100138' => '<light_green>%s login successfully</light_green>',
-        '100139' => '<light_green>AWS WAF token has been acquired: %s</light_green>',
+        '100139' => '<light_green>AWS WAF token has been acquired %s</light_green>',
+        '100140' => '<light_green>no need aws waf token</light_green>',
     ],
 ];

+ 4 - 1
resources/lang/zh.php

@@ -27,6 +27,8 @@ return [
         '34520017' => '未配置 AWS_WAF_SOLVER_URL 环境变量',
         '34520018' => '未能获取到 AWS WAF Token',
         '34520019' => '<light_green>将自动使用新的 AWS WAF Token</light_green>',
+        '34520020' => '未配置 OPEN_SOURCE_WAF_SOLVER_URL 环境变量',
+        '34520021' => '等待开源接口返回 token 超过 %d 秒,依然未取得有效 token,本次无法继续执行',
     ],
     'messages' => [
         '100001' => '未能取得名为 WHMCSZH5eHTGhfvzP 的 cookie 值,故本次登录无效,请检查你的账户或密码是否正确。',
@@ -161,6 +163,7 @@ return [
         '100136' => 'Pushplus',
         '100137' => 'Pushplus 消息发送失败:<red>%s</red>',
         '100138' => '<light_green>%s 登录成功</light_green>',
-        '100139' => '<light_green>已获取 aws waf token:%s</light_green>',
+        '100139' => '<light_green>已获取 aws waf token %s</light_green>',
+        '100140' => '<light_green>本次无需 aws waf token</light_green>',
     ],
 ];

Some files were not shown because too many files changed in this diff