pake-cli 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,310 @@
1
+ <?if $(sys.BUILDARCH)="x86"?>
2
+ <?define Win64 = "no" ?>
3
+ <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
4
+ <?elseif $(sys.BUILDARCH)="x64"?>
5
+ <?define Win64 = "yes" ?>
6
+ <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
7
+ <?else?>
8
+ <?error Unsupported value of sys.BUILDARCH=$(sys.BUILDARCH)?>
9
+ <?endif?>
10
+
11
+ <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
12
+ <Product
13
+ Id="*"
14
+ Name="{{{product_name}}}"
15
+ UpgradeCode="{{{upgrade_code}}}"
16
+ Language="!(loc.TauriLanguage)"
17
+ Manufacturer="{{{manufacturer}}}"
18
+ Version="{{{version}}}">
19
+
20
+ <Package Id="*"
21
+ Keywords="Installer"
22
+ InstallerVersion="450"
23
+ Languages="0"
24
+ Compressed="yes"
25
+ InstallScope="perMachine"
26
+ SummaryCodepage="!(loc.TauriCodepage)"/>
27
+
28
+ <!-- https://docs.microsoft.com/en-us/windows/win32/msi/reinstallmode -->
29
+ <!-- reinstall all files; rewrite all registry entries; reinstall all shortcuts -->
30
+ <Property Id="REINSTALLMODE" Value="amus" />
31
+
32
+ {{#if allow_downgrades}}
33
+ <MajorUpgrade Schedule="afterInstallInitialize" AllowDowngrades="yes" />
34
+ {{else}}
35
+ <MajorUpgrade Schedule="afterInstallInitialize" DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" AllowSameVersionUpgrades="yes" />
36
+ {{/if}}
37
+
38
+ <InstallExecuteSequence>
39
+ <RemoveShortcuts>Installed AND NOT UPGRADINGPRODUCTCODE</RemoveShortcuts>
40
+ </InstallExecuteSequence>
41
+
42
+ <Media Id="1" Cabinet="app.cab" EmbedCab="yes" />
43
+
44
+ {{#if banner_path}}
45
+ <WixVariable Id="WixUIBannerBmp" Value="{{{banner_path}}}" />
46
+ {{/if}}
47
+ {{#if dialog_image_path}}
48
+ <WixVariable Id="WixUIDialogBmp" Value="{{{dialog_image_path}}}" />
49
+ {{/if}}
50
+ {{#if license}}
51
+ <WixVariable Id="WixUILicenseRtf" Value="{{{license}}}" />
52
+ {{/if}}
53
+
54
+ <Icon Id="ProductIcon" SourceFile="{{{icon_path}}}"/>
55
+ <Property Id="ARPPRODUCTICON" Value="ProductIcon" />
56
+ <Property Id="ARPNOREPAIR" Value="yes" Secure="yes" /> <!-- Remove repair -->
57
+ <SetProperty Id="ARPNOMODIFY" Value="1" After="InstallValidate" Sequence="execute"/>
58
+
59
+ <!-- initialize with previous InstallDir -->
60
+ <Property Id="INSTALLDIR">
61
+ <RegistrySearch Id="PrevInstallDirReg" Root="HKCU" Key="Software\\{{{manufacturer}}}\\{{{product_name}}}" Name="InstallDir" Type="raw"/>
62
+ </Property>
63
+
64
+ <!-- launch app checkbox -->
65
+ <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="!(loc.LaunchApp)" />
66
+ <Property Id="WixShellExecTarget" Value="[!Path]" />
67
+ <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />
68
+
69
+ <UI>
70
+ <!-- launch app checkbox -->
71
+ <Publish Dialog="ExitDialog" Control="Finish" Event="DoAction" Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed</Publish>
72
+
73
+ <Property Id="WIXUI_INSTALLDIR" Value="INSTALLDIR" />
74
+
75
+ {{#unless license}}
76
+ <!-- Skip license dialog -->
77
+ <Publish Dialog="WelcomeDlg"
78
+ Control="Next"
79
+ Event="NewDialog"
80
+ Value="InstallDirDlg"
81
+ Order="2">1</Publish>
82
+ <Publish Dialog="InstallDirDlg"
83
+ Control="Back"
84
+ Event="NewDialog"
85
+ Value="WelcomeDlg"
86
+ Order="2">1</Publish>
87
+ {{/unless}}
88
+ </UI>
89
+
90
+ <UIRef Id="WixUI_InstallDir" />
91
+
92
+ <Directory Id="TARGETDIR" Name="SourceDir">
93
+ <Directory Id="DesktopFolder" Name="Desktop">
94
+ <Component Id="ApplicationShortcutDesktop" Guid="*">
95
+ <Shortcut Id="ApplicationDesktopShortcut" Name="{{{product_name}}}" Description="Runs {{{product_name}}}" Target="[!Path]" WorkingDirectory="INSTALLDIR" />
96
+ <RemoveFolder Id="DesktopFolder" On="uninstall" />
97
+ <RegistryValue Root="HKCU" Key="Software\\{{{manufacturer}}}\\{{{product_name}}}" Name="Desktop Shortcut" Type="integer" Value="1" KeyPath="yes" />
98
+ </Component>
99
+ </Directory>
100
+ <Directory Id="$(var.PlatformProgramFilesFolder)" Name="PFiles">
101
+ <Directory Id="INSTALLDIR" Name="{{{product_name}}}"/>
102
+ </Directory>
103
+ <Directory Id="ProgramMenuFolder">
104
+ <Directory Id="ApplicationProgramsFolder" Name="{{{product_name}}}"/>
105
+ </Directory>
106
+ </Directory>
107
+
108
+ <DirectoryRef Id="INSTALLDIR">
109
+ <Component Id="RegistryEntries" Guid="*">
110
+ <RegistryKey Root="HKCU" Key="Software\\{{{manufacturer}}}\\{{{product_name}}}">
111
+ <RegistryValue Name="InstallDir" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
112
+ </RegistryKey>
113
+ </Component>
114
+ <Component Id="Path" Guid="{{{path_component_guid}}}" Win64="$(var.Win64)">
115
+ <File Id="Path" Source="{{{app_exe_source}}}" KeyPath="yes" Checksum="yes"/>
116
+ </Component>
117
+ {{#each binaries as |bin| ~}}
118
+ <Component Id="{{ bin.id }}" Guid="{{bin.guid}}" Win64="$(var.Win64)">
119
+ <File Id="Bin_{{ bin.id }}" Source="{{bin.path}}" KeyPath="yes"/>
120
+ </Component>
121
+ {{/each~}}
122
+ {{#if enable_elevated_update_task}}
123
+ <Component Id="UpdateTask" Guid="C492327D-9720-4CD5-8DB8-F09082AF44BE" Win64="$(var.Win64)">
124
+ <File Id="UpdateTask" Source="update.xml" KeyPath="yes" Checksum="yes"/>
125
+ </Component>
126
+ <Component Id="UpdateTaskInstaller" Guid="011F25ED-9BE3-50A7-9E9B-3519ED2B9932" Win64="$(var.Win64)">
127
+ <File Id="UpdateTaskInstaller" Source="install-task.ps1" KeyPath="yes" Checksum="yes"/>
128
+ </Component>
129
+ <Component Id="UpdateTaskUninstaller" Guid="D4F6CC3F-32DC-5FD0-95E8-782FFD7BBCE1" Win64="$(var.Win64)">
130
+ <File Id="UpdateTaskUninstaller" Source="uninstall-task.ps1" KeyPath="yes" Checksum="yes"/>
131
+ </Component>
132
+ {{/if}}
133
+ {{{resources}}}
134
+ <Component Id="CMP_UninstallShortcut" Guid="*">
135
+
136
+ <Shortcut Id="UninstallShortcut"
137
+ Name="Uninstall {{{product_name}}}"
138
+ Description="Uninstalls {{{product_name}}}"
139
+ Target="[System64Folder]msiexec.exe"
140
+ Arguments="/x [ProductCode]" />
141
+
142
+ <RemoveFolder Id="INSTALLDIR"
143
+ On="uninstall" />
144
+
145
+ <RegistryValue Root="HKCU"
146
+ Key="Software\\{{{manufacturer}}}\\{{{product_name}}}"
147
+ Name="Uninstaller Shortcut"
148
+ Type="integer"
149
+ Value="1"
150
+ KeyPath="yes" />
151
+ </Component>
152
+ </DirectoryRef>
153
+
154
+ <DirectoryRef Id="ApplicationProgramsFolder">
155
+ <Component Id="ApplicationShortcut" Guid="*">
156
+ <Shortcut Id="ApplicationStartMenuShortcut"
157
+ Name="{{{product_name}}}"
158
+ Description="Runs {{{product_name}}}"
159
+ Target="[!Path]"
160
+ Icon="ProductIcon"
161
+ WorkingDirectory="INSTALLDIR">
162
+ <ShortcutProperty Key="System.AppUserModel.ID" Value="{{{bundle_id}}}"/>
163
+ </Shortcut>
164
+ <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
165
+ <RegistryValue Root="HKCU" Key="Software\\{{{manufacturer}}}\\{{{product_name}}}" Name="Start Menu Shortcut" Type="integer" Value="1" KeyPath="yes"/>
166
+ </Component>
167
+ </DirectoryRef>
168
+
169
+ {{#each merge_modules as |msm| ~}}
170
+ <DirectoryRef Id="TARGETDIR">
171
+ <Merge Id="{{ msm.name }}" SourceFile="{{ msm.path }}" DiskId="1" Language="!(loc.TauriLanguage)" />
172
+ </DirectoryRef>
173
+
174
+ <Feature Id="{{ msm.name }}" Title="{{ msm.name }}" AllowAdvertise="no" Display="hidden" Level="1">
175
+ <MergeRef Id="{{ msm.name }}"/>
176
+ </Feature>
177
+ {{/each~}}
178
+
179
+ <Feature
180
+ Id="MainProgram"
181
+ Title="Application"
182
+ Description="!(loc.InstallAppFeature)"
183
+ Level="1"
184
+ ConfigurableDirectory="INSTALLDIR"
185
+ AllowAdvertise="no"
186
+ Display="expand"
187
+ Absent="disallow">
188
+
189
+ <ComponentRef Id="RegistryEntries"/>
190
+
191
+ {{#each resource_file_ids as |resource_file_id| ~}}
192
+ <ComponentRef Id="{{ resource_file_id }}"/>
193
+ {{/each~}}
194
+
195
+ {{#if enable_elevated_update_task}}
196
+ <ComponentRef Id="UpdateTask" />
197
+ <ComponentRef Id="UpdateTaskInstaller" />
198
+ <ComponentRef Id="UpdateTaskUninstaller" />
199
+ {{/if}}
200
+
201
+ <Feature Id="ShortcutsFeature"
202
+ Title="Shortcuts"
203
+ Level="1">
204
+ <ComponentRef Id="Path"/>
205
+ <ComponentRef Id="CMP_UninstallShortcut" />
206
+ <ComponentRef Id="ApplicationShortcut" />
207
+ <ComponentRef Id="ApplicationShortcutDesktop" />
208
+ </Feature>
209
+
210
+ <Feature
211
+ Id="Environment"
212
+ Title="PATH Environment Variable"
213
+ Description="!(loc.PathEnvVarFeature)"
214
+ Level="1"
215
+ Absent="allow">
216
+ <ComponentRef Id="Path"/>
217
+ {{#each binaries as |bin| ~}}
218
+ <ComponentRef Id="{{ bin.id }}"/>
219
+ {{/each~}}
220
+ </Feature>
221
+ </Feature>
222
+
223
+ <Feature Id="External" AllowAdvertise="no" Absent="disallow">
224
+ {{#each component_group_refs as |id| ~}}
225
+ <ComponentGroupRef Id="{{ id }}"/>
226
+ {{/each~}}
227
+ {{#each component_refs as |id| ~}}
228
+ <ComponentRef Id="{{ id }}"/>
229
+ {{/each~}}
230
+ {{#each feature_group_refs as |id| ~}}
231
+ <FeatureGroupRef Id="{{ id }}"/>
232
+ {{/each~}}
233
+ {{#each feature_refs as |id| ~}}
234
+ <FeatureRef Id="{{ id }}"/>
235
+ {{/each~}}
236
+ {{#each merge_refs as |id| ~}}
237
+ <MergeRef Id="{{ id }}"/>
238
+ {{/each~}}
239
+ </Feature>
240
+
241
+ {{#if install_webview}}
242
+ <!-- WebView2 -->
243
+ <Property Id="WVRTINSTALLED">
244
+ <RegistrySearch Id="WVRTInstalledSystem" Root="HKLM" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw" Win64="no" />
245
+ <RegistrySearch Id="WVRTInstalledUser" Root="HKCU" Key="SOFTWARE\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" Name="pv" Type="raw"/>
246
+ </Property>
247
+
248
+ {{#if download_bootstrapper}}
249
+ <CustomAction Id='DownloadAndInvokeBootstrapper' Directory="INSTALLDIR" Execute="deferred" ExeCommand='powershell.exe -NoProfile -windowstyle hidden try [\{] [\[]Net.ServicePointManager[\]]::SecurityProtocol = [\[]Net.SecurityProtocolType[\]]::Tls12 [\}] catch [\{][\}]; Invoke-WebRequest -Uri "https://go.microsoft.com/fwlink/p/?LinkId=2124703" -OutFile "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" ; Start-Process -FilePath "$env:TEMP\MicrosoftEdgeWebview2Setup.exe" -ArgumentList ({{{webview_installer_args}}} &apos;/install&apos;) -Wait' Return='check'/>
250
+ <InstallExecuteSequence>
251
+ <Custom Action='DownloadAndInvokeBootstrapper' Before='InstallFinalize'>
252
+ <![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
253
+ </Custom>
254
+ </InstallExecuteSequence>
255
+ {{/if}}
256
+
257
+ <!-- Embedded webview bootstrapper mode -->
258
+ {{#if webview2_bootstrapper_path}}
259
+ <Binary Id="MicrosoftEdgeWebview2Setup.exe" SourceFile="{{{webview2_bootstrapper_path}}}"/>
260
+ <CustomAction Id='InvokeBootstrapper' BinaryKey='MicrosoftEdgeWebview2Setup.exe' Execute="deferred" ExeCommand='{{{webview_installer_args}}} /install' Return='check' />
261
+ <InstallExecuteSequence>
262
+ <Custom Action='InvokeBootstrapper' Before='InstallFinalize'>
263
+ <![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
264
+ </Custom>
265
+ </InstallExecuteSequence>
266
+ {{/if}}
267
+
268
+ <!-- Embedded offline installer -->
269
+ {{#if webview2_installer_path}}
270
+ <Binary Id="MicrosoftEdgeWebView2RuntimeInstaller.exe" SourceFile="{{{webview2_installer_path}}}"/>
271
+ <CustomAction Id='InvokeStandalone' BinaryKey='MicrosoftEdgeWebView2RuntimeInstaller.exe' Execute="deferred" ExeCommand='{{{webview_installer_args}}} /install' Return='check' />
272
+ <InstallExecuteSequence>
273
+ <Custom Action='InvokeStandalone' Before='InstallFinalize'>
274
+ <![CDATA[NOT(REMOVE OR WVRTINSTALLED)]]>
275
+ </Custom>
276
+ </InstallExecuteSequence>
277
+ {{/if}}
278
+
279
+ {{/if}}
280
+
281
+ {{#if enable_elevated_update_task}}
282
+ <!-- Install an elevated update task within Windows Task Scheduler -->
283
+ <CustomAction
284
+ Id="CreateUpdateTask"
285
+ Return="check"
286
+ Directory="INSTALLDIR"
287
+ Execute="commit"
288
+ Impersonate="yes"
289
+ ExeCommand="powershell.exe -WindowStyle hidden .\install-task.ps1" />
290
+ <InstallExecuteSequence>
291
+ <Custom Action='CreateUpdateTask' Before='InstallFinalize'>
292
+ NOT(REMOVE)
293
+ </Custom>
294
+ </InstallExecuteSequence>
295
+ <!-- Remove elevated update task during uninstall -->
296
+ <CustomAction
297
+ Id="DeleteUpdateTask"
298
+ Return="check"
299
+ Directory="INSTALLDIR"
300
+ ExeCommand="powershell.exe -WindowStyle hidden .\uninstall-task.ps1" />
301
+ <InstallExecuteSequence>
302
+ <Custom Action="DeleteUpdateTask" Before='InstallFinalize'>
303
+ (REMOVE = "ALL") AND NOT UPGRADINGPRODUCTCODE
304
+ </Custom>
305
+ </InstallExecuteSequence>
306
+ {{/if}}
307
+
308
+ <SetProperty Id="ARPINSTALLLOCATION" Value="[INSTALLDIR]" After="CostFinalize"/>
309
+ </Product>
310
+ </Wix>
Binary file
Binary file
Binary file
Binary file
@@ -23,7 +23,7 @@ use wry::application::{
23
23
  #[cfg(target_os = "windows")]
24
24
  use wry::application::window::Icon;
25
25
 
26
- #[cfg(target_os = "linux")]
26
+ #[cfg(any(target_os = "linux", target_os = "windows"))]
27
27
  use wry::webview::WebContext;
28
28
 
29
29
  fn main() -> wry::Result<()> {
@@ -134,50 +134,40 @@ fn main() -> wry::Result<()> {
134
134
 
135
135
  // 用于欺骗部分页面对于浏览器的强检测
136
136
 
137
- // #[cfg(target_os = "macos")]
138
- // let user_agent_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15";
139
-
140
137
  #[cfg(target_os = "macos")]
141
- let webview = WebViewBuilder::new(window)?
142
- // .with_user_agent(user_agent_string)
143
- .with_url(&url.to_string())?
144
- .with_devtools(cfg!(feature = "devtools"))
145
- .with_initialization_script(include_str!("pake.js"))
146
- .with_ipc_handler(handler)
147
- .with_back_forward_navigation_gestures(true)
148
- .build()?;
138
+ let webview = {
139
+ let user_agent_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15";
140
+ WebViewBuilder::new(window)?
141
+ .with_user_agent(user_agent_string)
142
+ .with_url(&url.to_string())?
143
+ .with_devtools(cfg!(feature = "devtools"))
144
+ .with_initialization_script(include_str!("pake.js"))
145
+ .with_ipc_handler(handler)
146
+ .with_back_forward_navigation_gestures(true)
147
+ .build()?
148
+ };
149
149
 
150
- #[cfg(target_os = "windows")]
151
- let webview = WebViewBuilder::new(window)?
152
- // .with_user_agent(user_agent_string)
153
- // .with_accept_first_mouse(true)
154
- .with_url(&url.to_string())?
155
- .with_devtools(cfg!(feature = "devtools"))
156
- .with_initialization_script(include_str!("pake.js"))
157
- .with_ipc_handler(handler)
158
- .build()?;
159
-
160
- // 自定义cookie文件夹,仅用于Linux
161
- // Custom Cookie folder, only for Linux
162
- #[cfg(target_os = "linux")]
150
+ #[cfg(any(target_os = "linux", target_os = "windows"))]
163
151
  let webview = {
164
- let user = std::env::var_os("USER");
165
- let config_path = match user {
166
- Some(v) => format!(
167
- "/home/{}/.config/{}",
168
- v.into_string().unwrap(),
169
- package_name,
170
- ),
171
- None => panic!("can't found any user"),
152
+ let home_dir = match home::home_dir() {
153
+ Some(path1) => path1,
154
+ None => panic!("Error, can't found you home dir!!"),
172
155
  };
173
- let data_path = std::path::PathBuf::from(&config_path);
174
- if !std::path::Path::new(&data_path).exists() {
175
- std::fs::create_dir(&data_path)
176
- .unwrap_or_else(|_| panic!("can't create dir {}", &config_path));
156
+ #[cfg(target_os = "windows")]
157
+ let data_dir = home_dir.join("AppData").join("Roaming").join(package_name);
158
+ #[cfg(target_os = "linux")]
159
+ let data_dir = home_dir.join(".config").join(package_name);
160
+ if !data_dir.exists() {
161
+ std::fs::create_dir(&data_dir)
162
+ .unwrap_or_else(|_| panic!("can't create dir {}", data_dir.display()));
177
163
  }
178
- let mut web_content = WebContext::new(Some(data_path));
164
+ let mut web_content = WebContext::new(Some(data_dir));
165
+ #[cfg(target_os = "windows")]
166
+ let user_agent_string = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36";
167
+ #[cfg(target_os = "linux")]
168
+ let user_agent_string = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36";
179
169
  WebViewBuilder::new(window)?
180
- // .with_user_agent(user_agent_string)
170
+ .with_user_agent(user_agent_string)
181
171
  .with_url(&url.to_string())?
182
172
  .with_devtools(cfg!(feature = "devtools"))
183
173
  .with_initialization_script(include_str!("pake.js"))
@@ -212,10 +212,8 @@ window.addEventListener("DOMContentLoaded", (_event) => {
212
212
  left: 1px !important;
213
213
  }
214
214
 
215
- #react-root [data-testid="SideNav_NewTweet_Button"] {
216
- position: fixed !important;
217
- right: 16px !important;
218
- bottom: 24px !important;
215
+ #react-root [data-testid="SideNav_NewTweet_Button"], #react-root [aria-label="Twitter Blue"]{
216
+ display: none;
219
217
  }
220
218
  }
221
219
 
@@ -18,7 +18,9 @@
18
18
  "libssl-dev",
19
19
  "libgtk-3-dev",
20
20
  "libayatana-appindicator3-dev",
21
- "librsvg2-dev"
21
+ "librsvg2-dev",
22
+ "gnome-video-effects",
23
+ "gnome-video-effects-extra"
22
24
  ],
23
25
  "files": {
24
26
  "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
@@ -19,7 +19,8 @@
19
19
  "digestAlgorithm": "sha256",
20
20
  "timestampUrl": "",
21
21
  "wix": {
22
- "language": ["en-US"]
22
+ "language": ["en-US"],
23
+ "template": "assets/main.wxs"
23
24
  }
24
25
  }
25
26
  }