diff --git a/omega-i18n/en/messages.json b/omega-i18n/en/messages.json
index 843e1f1..f0e8e9e 100644
--- a/omega-i18n/en/messages.json
+++ b/omega-i18n/en/messages.json
@@ -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.
Please consider advising your audience to upgrade to SwitchyOmega for the improvements."
+ },
"options_group_importExportSettings": {
"message": "Settings"
},
diff --git a/omega-i18n/zh_CN/messages.json b/omega-i18n/zh_CN/messages.json
index 51be391..aa25290 100644
--- a/omega-i18n/zh_CN/messages.json
+++ b/omega-i18n/zh_CN/messages.json
@@ -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": "如果您需要发布规则列表给那些软件的用户,请启用此选项。
建议您提醒订阅者升级到 SwitchyOmega 以享受新版功能。"
+ },
"options_group_importExportSettings": {
"message": "选项"
},
diff --git a/omega-i18n/zh_HK/messages.json b/omega-i18n/zh_HK/messages.json
index 60794cd..e202ab1 100644
--- a/omega-i18n/zh_HK/messages.json
+++ b/omega-i18n/zh_HK/messages.json
@@ -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": "如果您需要釋出規則列表給那些軟體的使用者,請啟用此選項。
建議您提醒訂閱者升級到 SwitchyOmega 以享受新版功能。"
+ },
"options_group_importExportSettings": {
"message": "選項"
},
diff --git a/omega-i18n/zh_TW/messages.json b/omega-i18n/zh_TW/messages.json
index 9a81a62..d08b969 100644
--- a/omega-i18n/zh_TW/messages.json
+++ b/omega-i18n/zh_TW/messages.json
@@ -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": "如果您需要釋出規則列表給那些軟體的使用者,請啟用此選項。
建議您提醒訂閱者升級到 SwitchyOmega 以享受新版功能。"
+ },
"options_group_importExportSettings": {
"message": "選項"
},
diff --git a/omega-web/src/omega/controllers/profile.coffee b/omega-web/src/omega/controllers/profile.coffee
index 2b768d7..1c96607 100644
--- a/omega-web/src/omega/controllers/profile.coffee
+++ b/omega-web/src/omega/controllers/profile.coffee
@@ -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
diff --git a/omega-web/src/omega/controllers/switch_profile.coffee b/omega-web/src/omega/controllers/switch_profile.coffee
index a76e6f4..aaecf1f 100644
--- a/omega-web/src/omega/controllers/switch_profile.coffee
+++ b/omega-web/src/omega/controllers/switch_profile.coffee
@@ -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?()
diff --git a/omega-web/src/partials/io.jade b/omega-web/src/partials/io.jade
index b099f64..f604587 100644
--- a/omega-web/src/partials/io.jade
+++ b/omega-web/src/partials/io.jade
@@ -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
diff --git a/omega-web/src/partials/profile.jade b/omega-web/src/partials/profile.jade
index 26d9951..d4e8616 100644
--- a/omega-web/src/partials/profile.jade
+++ b/omega-web/src/partials/profile.jade
@@ -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}}