-
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.
Merge pull request #20 from alexzhangs/develop
Develop Update install.sh: add SSM_VERSION. Update ci-unittest.yml: do not fail CI on codecov uploader fails and update docker image to shadowsocks-libev-v2ray. Update ci-docker.yml: use the explicit version of docker image. Update ci-testpypi.yml and ci-pypi.yml: narrow down the environment variables scope. Update shadowsocks/admin.py remove is_v2ray_enabled from readonly_fields. Update shadowsocks/models.py: * update SSManager.interface default value from LOCALHOST to PRIVATE. * set default sender for Account.notify(). Update notification/fixtures: * improve template content and format. * add template.txt and template-txt-to-json.py. Update README.md: update screenshots.
- Loading branch information
Showing
13 changed files
with
143 additions
and
41 deletions.
There are no files selected for viewing
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
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
43 changes: 43 additions & 0 deletions
43
shadowsocks_manager/notification/fixtures/template-txt-to-json.py
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,43 @@ | ||
""" | ||
Description: | ||
This script converts the contents of a template.txt file into a JSON string and prints it. | ||
The template.txt file is read and its contents are stored in the 'content' variable. | ||
Newline characters in the content are replaced with '\r\n'. | ||
A dictionary is created to represent the JSON data, with the template details and other fields. | ||
The dictionary is converted to a JSON string using the json.dumps() function. | ||
The JSON string is printed to the console. | ||
Each carriage return and the position of the template tags in the template.txt file matter. | ||
Usage: | ||
python template-txt-to-json.py > template.json | ||
""" | ||
|
||
import json | ||
|
||
# Read the contents of template.py | ||
with open('template.txt', 'r') as file: | ||
content = file.read() | ||
|
||
# Replace newline characters with \n | ||
content = content.replace('\n', '\r\n') | ||
|
||
# Create a dictionary for the JSON data | ||
data = { | ||
"model": "notification.template", | ||
"pk": 1, | ||
"fields": { | ||
"type": "account_created", | ||
"content": content, | ||
"is_active": True, | ||
"dt_created": "2019-05-12T15:37:42.356Z", | ||
"dt_updated": "2019-06-18T20:21:16.078Z" | ||
} | ||
} | ||
|
||
# Convert the dictionary to a JSON string | ||
json_data = json.dumps(data, indent=4) | ||
|
||
# Print the JSON string | ||
print("\n".join(["[", json_data, "]"])) |
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,25 @@ | ||
Subject: CREDENTIAL: VPN Account (Shadowsocks) | ||
To: {{ account.email }} | ||
Dear {{ account.first_name }}, | ||
|
||
Your VPN account is setup as below. | ||
|
||
* Port: {{ account.username }} | ||
* Password: {{ account.password }} | ||
|
||
It's available on {{ node_accounts|length }} node(s): | ||
{% for obj in node_accounts %} | ||
Node #{{ forloop.counter }}: | ||
------ | ||
{% ifchanged %} | ||
* VPN Server: {% if obj.node.record.fqdn %}{{ obj.node.record.fqdn }}{% else %}{{ obj.node.public_ip }}{% endif %} | ||
* Location: {{ obj.node.location }} | ||
* Encrypt: {{ obj.node.ssmanager.encrypt }}{% if obj.node.ssmanager.is_v2ray_enabled %} | ||
* V2Ray: Required | ||
* Plugin: v2ray-plugin | ||
* Plugin Options: tls;host={{ obj.node.record.fqdn }} | ||
* Mode: Websocket (HTTPS){% endif %} | ||
{% else %} | ||
This node shares the same settings with above.{%endifchanged%}{% endfor %} | ||
{% if sender.get_full_name %} | ||
{{ sender.get_full_name }}{% endif %} |
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