-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch from GitHub Pages to Cloudflare Pages
- Loading branch information
1 parent
f6adf83
commit f4a7549
Showing
33 changed files
with
229 additions
and
271 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
FROM alpine/ansible | ||
RUN apk add --no-cache curl make rsync | ||
RUN apk add --no-cache curl make rsync nodejs npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# where redirect to if user opened index page without valid parameters | ||
config_frontman_default_redirect: | ||
|
||
# title users should we when open hiddify | ||
config_users_title: | ||
|
||
# url where frontman is hosted | ||
config_users_base_url: | ||
|
||
# clouflare pages project name | ||
config_frontman_cloudflare_project_name: | ||
|
||
# cloudflare account id | ||
config_frontman_cloudflare_account_id: | ||
|
||
# cloudflare api token with Account -> Cloudflare Pages -> Write permissions. create at https://dash.cloudflare.com/profile/api-tokens | ||
config_frontman_cloudflare_api_token: |
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# where redirect to if user opened index page without paramneters | ||
frontman_default_redirect: | ||
|
||
# users as described in /users-example.yml | ||
frontman_users: | ||
|
||
# files with redirect url | ||
frontman_configs: | ||
|
||
# servers object as described in /servers-example.yml | ||
frontman_servers: | ||
|
||
# relative path of directory where static content should be stored | ||
frontman_static_directory_filename: | ||
|
||
# title users should we when open hiddify | ||
frontman_title: | ||
|
||
# url where frontman is hosted | ||
frontman_base_url: | ||
|
||
# clouflare pages project name | ||
frontman_cloudflare_project_name: | ||
|
||
# cloudflare account id | ||
frontman_cloudflare_account_id: | ||
|
||
# cloudflare api token with Account -> Cloudflare Pages -> Write permissions. create at https://dash.cloudflare.com/profile/api-tokens | ||
frontman_cloudflare_api_token: |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
- name: Ensure required variables are defined | ||
assert: | ||
that: | ||
- frontman_default_redirect is string | ||
- frontman_title is string | ||
- frontman_cloudflare_project_name is string | ||
- frontman_cloudflare_account_id is string | ||
- frontman_cloudflare_api_token is string | ||
|
||
- name: Ensure frontman_users is defined correctly | ||
include_tasks: tasks/assert-users.yml | ||
vars: | ||
users: "{{ frontman_users }}" | ||
|
||
- name: Ensure frontman_configs is defined correctly | ||
include_tasks: tasks/assert-configs.yml | ||
vars: | ||
configs: "{{ frontman_configs }}" | ||
|
||
- name: Ensure frontman_servers is defined correctly | ||
include_tasks: tasks/assert-servers.yml | ||
vars: | ||
servers: "{{ frontman_servers }}" | ||
|
||
- set_fact: | ||
frontman_static_root_local: "./{{ frontman_static_directory_filename }}" | ||
frontman_frontend_name: "{{ lookup('community.general.random_string', length=32, special=False) }}" | ||
|
||
- name: Create static directory locally | ||
file: | ||
path: "{{ frontman_static_root_local }}" | ||
state: directory | ||
|
||
- name: Render index.html | ||
template: | ||
src: index.html.j2 | ||
dest: "{{ frontman_static_root_local }}/index.html" | ||
|
||
- name: Create frontend directory locally | ||
file: | ||
path: "{{ frontman_static_root_local }}/{{ frontman_frontend_name }}" | ||
state: directory | ||
|
||
- name: Render frontend.html | ||
get_url: | ||
url: "{{ frontman_frontend_html_url }}" | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_frontend_name }}/index.html" | ||
|
||
- name: Render frontend config | ||
template: | ||
src: frontend-config.json.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_frontend_name }}/config.json" | ||
|
||
- name: Copy robots.txt | ||
copy: | ||
src: robots.txt | ||
dest: "{{ frontman_static_root_local }}/robots.txt" | ||
|
||
- name: Render configs | ||
with_items: "{{ frontman_configs }}" | ||
loop_control: | ||
index_var: loop_index | ||
vars: | ||
frontman_config_uuid: "{{ item }}" | ||
include_tasks: render_configs.yml | ||
|
||
- name: Render redirect configs | ||
with_items: "{{ frontman_users }}" | ||
loop_control: | ||
index_var: loop_index | ||
vars: | ||
frontman_user_uuid: "{{ item }}" | ||
template: | ||
src: frontend-link.json.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_user_uuid }}.json" | ||
|
||
- name: Upload static files to Cloudflare Pages | ||
command: "npx wrangler pages deploy {{ frontman_static_root_local }} --project-name={{ frontman_cloudflare_project_name }}" | ||
environment: | ||
CLOUDFLARE_ACCOUNT_ID: "{{ frontman_cloudflare_account_id }}" | ||
CLOUDFLARE_API_TOKEN: "{{ frontman_cloudflare_api_token }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
- name: Create user's directory | ||
file: | ||
path: "{{ frontman_static_root_local }}/{{ frontman_config_uuid }}" | ||
state: directory | ||
|
||
- name: Render hiddify config | ||
template: | ||
src: hiddify.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_config_uuid }}/{{ frontman_hiddify_filename }}" | ||
|
||
- name: Render hiddify config (index.html for backward compatibility) | ||
template: | ||
src: hiddify.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_config_uuid }}/index.html" | ||
|
||
- name: Render xray-client config | ||
template: | ||
src: client-xray-config.json.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_config_uuid }}/{{ frontman_client_xray_config_filename }}" | ||
|
||
- name: Render sock5.Dockerfile | ||
template: | ||
src: socks5.Dockerfile.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_config_uuid }}/{{ frontman_socks5_docker_filename }}" | ||
|
||
- name: Render urls map | ||
template: | ||
src: urls-map.json.j2 | ||
dest: "{{ frontman_static_root_local }}/{{ frontman_config_uuid }}/{{ frontman_urls_map_filename }}" |
Oops, something went wrong.