mirror of
https://github.com/zero-peak/ZeroOmega.git
synced 2025-01-22 15:08:12 -05:00
Add rule list publishing for the omega conditons format.
This commit is contained in:
parent
054d1c8b58
commit
8eaf7cae64
@ -95,6 +95,10 @@
|
||||
"description": "The rule list format name of the AutoProxy project. This has nothing to do with SwitchProfile."
|
||||
},
|
||||
|
||||
"ruleList_usageUrl": {
|
||||
"message": "https://github.com/FelisCatus/SwitchyOmega/wiki/RuleListUsage"
|
||||
},
|
||||
|
||||
"dialog_close": {
|
||||
"message": "Close"
|
||||
},
|
||||
@ -247,6 +251,15 @@
|
||||
"options_exportPacFileHelp": {
|
||||
"message": "Export the current profile as a PAC file, so you can use it in other browsers."
|
||||
},
|
||||
"options_exportProfileHelp": {
|
||||
"message": "To export a profile, use the top-right action bar on the profile page."
|
||||
},
|
||||
"options_exportLegacyRuleList": {
|
||||
"message": "Export rule lists using Proxy Switchy!/SwitchyPlus/SwitchySharp compatible format when possible."
|
||||
},
|
||||
"options_exportLegacyRuleListHelp": {
|
||||
"message": "Enable this option only if you publish rule lists for users of those projects.<br>Please consider advising your audience to upgrade to SwitchyOmega for the improvements."
|
||||
},
|
||||
"options_group_importExportSettings": {
|
||||
"message": "Settings"
|
||||
},
|
||||
|
@ -95,6 +95,10 @@
|
||||
"description": "AutoProxy 项目规则列表格式的名称,和此程序的自动切换等无关。"
|
||||
},
|
||||
|
||||
"ruleList_usageUrl": {
|
||||
"message": "https://github.com/FelisCatus/SwitchyOmega/wiki/RuleListUsage"
|
||||
},
|
||||
|
||||
"dialog_close": {
|
||||
"message": "关闭"
|
||||
},
|
||||
@ -247,6 +251,15 @@
|
||||
"options_exportPacFileHelp": {
|
||||
"message": "导出PAC(代理自动设置)文件,以便在其它浏览器使用。"
|
||||
},
|
||||
"options_exportProfileHelp": {
|
||||
"message": "如需导出情景模式,请使用情景模式设置页面右上角的工具栏。"
|
||||
},
|
||||
"options_exportLegacyRuleList": {
|
||||
"message": "导出规则列表时使用 Proxy Switchy!/SwitchyPlus/SwitchySharp 兼容格式。"
|
||||
},
|
||||
"options_exportLegacyRuleListHelp": {
|
||||
"message": "如果您需要发布规则列表给那些软件的用户,请启用此选项。<br>建议您提醒订阅者升级到 SwitchyOmega 以享受新版功能。"
|
||||
},
|
||||
"options_group_importExportSettings": {
|
||||
"message": "选项"
|
||||
},
|
||||
|
@ -95,6 +95,10 @@
|
||||
"description": "AutoProxy 項目規則列表格式的名稱,和本程式的自動切換等無關。"
|
||||
},
|
||||
|
||||
"ruleList_usageUrl": {
|
||||
"message": "https://github.com/FelisCatus/SwitchyOmega/wiki/RuleListUsage"
|
||||
},
|
||||
|
||||
"dialog_close": {
|
||||
"message": "關閉"
|
||||
},
|
||||
@ -247,6 +251,15 @@
|
||||
"options_exportPacFileHelp": {
|
||||
"message": "導出PAC(代理自動設置)文件,以便在其它瀏覽器使用。"
|
||||
},
|
||||
"options_exportProfileHelp": {
|
||||
"message": "如需匯出情景模式,請使用情景模式設定頁面右上角的工具欄。"
|
||||
},
|
||||
"options_exportLegacyRuleList": {
|
||||
"message": "匯出規則列表時使用 Proxy Switchy!/SwitchyPlus/SwitchySharp 相容格式。"
|
||||
},
|
||||
"options_exportLegacyRuleListHelp": {
|
||||
"message": "如果您需要釋出規則列表給那些軟體的使用者,請啟用此選項。<br>建議您提醒訂閱者升級到 SwitchyOmega 以享受新版功能。"
|
||||
},
|
||||
"options_group_importExportSettings": {
|
||||
"message": "選項"
|
||||
},
|
||||
|
@ -95,6 +95,10 @@
|
||||
"description": "AutoProxy 項目規則列表格式的名稱,和本程式的自動切換等無關。"
|
||||
},
|
||||
|
||||
"ruleList_usageUrl": {
|
||||
"message": "https://github.com/FelisCatus/SwitchyOmega/wiki/RuleListUsage"
|
||||
},
|
||||
|
||||
"dialog_close": {
|
||||
"message": "關閉"
|
||||
},
|
||||
@ -247,6 +251,15 @@
|
||||
"options_exportPacFileHelp": {
|
||||
"message": "匯出PAC(代理自動設定)檔案,以便在其它瀏覽器使用。"
|
||||
},
|
||||
"options_exportProfileHelp": {
|
||||
"message": "如需匯出情景模式,請使用情景模式設定頁面右上角的工具欄。"
|
||||
},
|
||||
"options_exportLegacyRuleList": {
|
||||
"message": "匯出規則列表時使用 Proxy Switchy!/SwitchyPlus/SwitchySharp 相容格式。"
|
||||
},
|
||||
"options_exportLegacyRuleListHelp": {
|
||||
"message": "如果您需要釋出規則列表給那些軟體的使用者,請啟用此選項。<br>建議您提醒訂閱者升級到 SwitchyOmega 以享受新版功能。"
|
||||
},
|
||||
"options_group_importExportSettings": {
|
||||
"message": "選項"
|
||||
},
|
||||
|
@ -84,8 +84,10 @@ angular.module('omega').controller 'ProfileCtrl', ($scope, $stateParams,
|
||||
this.$watch expression, onChange, true
|
||||
|
||||
$scope.exportRuleList = null
|
||||
$scope.setExportRuleListHandler = (exportRuleList) ->
|
||||
$scope.exportRuleListOptions = null
|
||||
$scope.setExportRuleListHandler = (exportRuleList, options) ->
|
||||
$scope.exportRuleList = exportRuleList
|
||||
$scope.exportRuleListOptions = options
|
||||
|
||||
unwatch = $scope.$watch (-> $scope.options?['+' + name]), (profile) ->
|
||||
if not profile
|
||||
|
@ -1,5 +1,5 @@
|
||||
angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location,
|
||||
$modal, profileIcons, getAttachedName, omegaTarget, $timeout) ->
|
||||
$modal, profileIcons, getAttachedName, omegaTarget, $timeout, trFilter) ->
|
||||
|
||||
$scope.showConditionHelp = ($location.search().help == 'condition')
|
||||
|
||||
@ -41,6 +41,21 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location,
|
||||
]
|
||||
|
||||
exportRuleList = ->
|
||||
text = OmegaPac.RuleList.Switchy.compose($scope.profile)
|
||||
|
||||
eol = '\r\n'
|
||||
info = '\n'
|
||||
info += '; Require: SwitchyOmega >= 2.3.2' + eol
|
||||
info += "; Date: #{new Date().toLocaleDateString()}" + eol
|
||||
info += "; Usage: #{trFilter('ruleList_usageUrl')}" + eol
|
||||
|
||||
text = text.replace('\n', info)
|
||||
|
||||
blob = new Blob [text], {type: "text/plain;charset=utf-8"}
|
||||
fileName = $scope.profile.name.replace(/\W+/g, '_')
|
||||
saveAs(blob, "OmegaRules_#{fileName}.sorl")
|
||||
|
||||
exportLegacyRuleList = ->
|
||||
wildcardRules = ''
|
||||
regexpRules = ''
|
||||
for rule in $scope.profile.rules
|
||||
@ -112,12 +127,21 @@ angular.module('omega').controller 'SwitchProfileCtrl', ($scope, $location,
|
||||
else
|
||||
updateHasConditionTypes()
|
||||
$scope.showConditionTypes = $scope.hasConditionTypes
|
||||
|
||||
if $scope.options['-exportLegacyRuleList']
|
||||
if $scope.showConditionTypes > 0
|
||||
$scope.setExportRuleListHandler(exportRuleList, {warning: true})
|
||||
else
|
||||
$scope.setExportRuleListHandler(exportLegacyRuleList)
|
||||
else
|
||||
$scope.setExportRuleListHandler(exportRuleList)
|
||||
|
||||
if $scope.showConditionTypes == 0
|
||||
$scope.conditionTypes = basicConditionTypesExpanded
|
||||
$scope.setExportRuleListHandler(exportRuleList)
|
||||
if $scope.options['-exportLegacyRuleList']
|
||||
$scope.setExportRuleListHandler exportLegacyRuleList
|
||||
else
|
||||
$scope.conditionTypes = advancedConditionTypesExpanded
|
||||
$scope.setExportRuleListHandler(null)
|
||||
if not $scope.options["-showConditionTypes"]?
|
||||
$scope.options["-showConditionTypes"] = $scope.showConditionTypes
|
||||
unwatchRules?()
|
||||
|
@ -2,12 +2,16 @@
|
||||
h2 {{'options_tab_importExport' | tr}}
|
||||
section.settings-group
|
||||
h3 {{'options_group_importExportProfile' | tr}}
|
||||
p
|
||||
button.btn.btn-default(ng-click='exportScript()')
|
||||
span.glyphicon.glyphicon-download
|
||||
.help-block
|
||||
.text-info
|
||||
span.glyphicon.glyphicon-info-sign
|
||||
= ' '
|
||||
| {{'options_exportPacFile' | tr}}
|
||||
span.help-inline {{'options_exportPacFileHelp' | tr}}
|
||||
{{'options_exportProfileHelp' | tr}}
|
||||
div.checkbox(ng-show='!(options["-showConditionTypes"] > 0)')
|
||||
label
|
||||
input(type='checkbox' ng-model='options["-exportLegacyRuleList"]')
|
||||
span {{'options_exportLegacyRuleList' | tr}}
|
||||
p.help-block(omega-html="'options_exportLegacyRuleListHelp' | tr")
|
||||
section.settings-group
|
||||
h3 {{'options_group_importExportSettings' | tr}}
|
||||
p
|
||||
|
@ -1,6 +1,8 @@
|
||||
.page-header
|
||||
.profile-actions
|
||||
button.btn.btn-default(ng-show='exportRuleList' ng-click='exportRuleList(profile.name)' title="{{'options_profileExportRuleListHelp' | tr}}")
|
||||
button.btn(ng-show='exportRuleList' ng-click='exportRuleList(profile.name)'
|
||||
title="{{'options_profileExportRuleListHelp' | tr}}"
|
||||
ng-class="exportRuleListOptions.warning ? 'btn-warning' : 'btn-default'")
|
||||
span.glyphicon.glyphicon-list
|
||||
= ' '
|
||||
| {{'options_profileExportRuleList' | tr}}
|
||||
|
Loading…
Reference in New Issue
Block a user