Skip to content

Commit 494712f

Browse files
authored
Merge branch 'v2' into barcode-scanner-mdx
2 parents 395d587 + 4f94e60 commit 494712f

File tree

6 files changed

+108
-8
lines changed

6 files changed

+108
-8
lines changed

src/content/docs/distribute/Sign/macos.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Code signing is required on macOS to allow your application to be listed in the
1010

1111
## Prerequisites
1212

13-
Code signing on macOS requires an [Apple Developer] account which is either paid (99$ per year) or on the free plan. You also need an Apple device where you perform the code signing. This is required by the signing process and due to Apple's Terms and Conditions.
13+
Code signing on macOS requires an [Apple Developer] account which is either paid (99$ per year) or on the free plan (only for testing and development purposes). You also need an Apple device where you perform the code signing. This is required by the signing process and due to Apple's Terms and Conditions.
1414

1515
:::note
1616
Note when using a free Apple Developer account, you will not be able to notarize your application and it will still show up as not verified when opening the app.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
---
2+
title: Localhost
3+
description: Usa un servidor localhost en aplicaciones en producción.
4+
plugin: localhost
5+
i18nReady: true
6+
---
7+
8+
import PluginLinks from '@components/PluginLinks.astro';
9+
import Compatibility from '@components/plugins/Compatibility.astro';
10+
11+
import { Tabs, TabItem, Steps } from '@astrojs/starlight/components';
12+
import CommandTabs from '@components/CommandTabs.astro';
13+
14+
<PluginLinks plugin={frontmatter.plugin} showJsLinks={false} />
15+
16+
Expone los recursos de tu aplicación a través de un servidor localhost en lugar de usar el protocolo personalizado por defecto.
17+
18+
:::caution
19+
Este plugin conlleva riesgos de seguridad considerables y solo debes usarlo si sabes lo que estás haciendo. Si tienes dudas, utiliza la implementación del protocolo personalizado por defecto.
20+
:::
21+
22+
## Plataformas soportadas
23+
24+
<Compatibility plugin={frontmatter.plugin} />
25+
26+
## Configuración
27+
28+
Instala el plugin localhost para comenzar.
29+
30+
<Tabs>
31+
<TabItem label="Automático">
32+
33+
Usa el gestor de paquetes de tu proyecto para añadir la dependencia:
34+
35+
<CommandTabs npm="npm run tauri add localhost"
36+
yarn="yarn run tauri add localhost"
37+
pnpm="pnpm tauri add localhost"
38+
deno="deno task tauri add localhost"
39+
bun="bun tauri add localhost"
40+
cargo="cargo tauri add localhost" />
41+
42+
</TabItem>
43+
<TabItem label="Manual">
44+
45+
<Steps>
46+
47+
1. Ejecuta el siguiente comando en la carpeta `src-tauri` para añadir el plugin a las dependencias del proyecto en `Cargo.toml`:
48+
49+
```sh frame=none
50+
cargo add tauri-plugin-localhost
51+
```
52+
53+
2. Modifica `lib.rs` para inicializar el plugin:
54+
55+
```rust title="src-tauri/src/lib.rs" ins={4}
56+
#[cfg_attr(mobile, tauri::mobile_entry_point)]
57+
pub fn run() {
58+
tauri::Builder::default()
59+
.plugin(tauri_plugin_localhost::Builder::new().build())
60+
.run(tauri::generate_context!())
61+
.expect("error al ejecutar la aplicación tauri");
62+
}
63+
```
64+
65+
</Steps>
66+
67+
</TabItem>
68+
</Tabs>
69+
70+
## Uso
71+
72+
El plugin localhost está disponible en Rust.
73+
74+
```rust title="src-tauri/src/lib.rs" {4} {7-14}
75+
use tauri::{webview::WebviewWindowBuilder, WebviewUrl};
76+
77+
pub fn run() {
78+
let port: u16 = 9527;
79+
80+
tauri::Builder::default()
81+
.plugin(tauri_plugin_localhost::Builder::new(port).build())
82+
.setup(move |app| {
83+
let url = format!("http://localhost:{}", port).parse().unwrap();
84+
WebviewWindowBuilder::new(app, "main".to_string(), WebviewUrl::External(url))
85+
.title("Ejemplo de Localhost")
86+
.build()?;
87+
Ok(())
88+
})
89+
.run(tauri::generate_context!())
90+
.expect("error al ejecutar la aplicación tauri");
91+
}
92+
```

src/content/docs/plugin/single-instance.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ Install the Single Instance plugin to get started.
7070

7171
</Tabs>
7272

73+
:::info
74+
75+
The Single Instance plugin must be the first one to be registered to work well. This assures that it runs before other plugins can interfere.
76+
77+
:::
78+
7379
## Usage
7480

7581
The plugin is already installed and initialized, and it should be functioning correctly right away. Nevertheless, we can also enhance its functionality with the `init()` method.

src/content/docs/start/prerequisites.mdx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,16 +351,18 @@ export NDK_HOME="$ANDROID_HOME/ndk/$(ls -1 $ANDROID_HOME/ndk)"
351351

352352
```ps
353353
[System.Environment]::SetEnvironmentVariable("ANDROID_HOME", "$env:LocalAppData\Android\Sdk", "User")
354-
$VERSION = Get-ChildItem -Name "$env:LocalAppData\Android\Sdk\ndk"
354+
$VERSION = Get-ChildItem -Name "$env:LocalAppData\Android\Sdk\ndk" | Select-Object -Last 1
355355
[System.Environment]::SetEnvironmentVariable("NDK_HOME", "$env:LocalAppData\Android\Sdk\ndk\$VERSION", "User")
356356
```
357357

358358
:::tip
359-
PowerShell will not pick up the new environment variables until reboot or logout,
360-
However you can refresh the current session:
359+
Most apps don't refresh their environment variables automatically, so to let them pickup the changes,
360+
you can either restart your terminal and IDE or for your current PowerShell session, you can refresh it with
361361

362-
````ps
362+
```ps
363363
[System.Environment]::GetEnvironmentVariables("User").GetEnumerator() | % { Set-Item -Path "Env:\$($_.key)" -Value $_.value }
364+
```
365+
364366
:::
365367

366368
</TabItem>
@@ -371,7 +373,7 @@ However you can refresh the current session:
371373

372374
```sh
373375
rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
374-
````
376+
```
375377

376378
Next: [Setup for iOS](#ios) or [Create a project](/start/create-project/).
377379

0 commit comments

Comments
 (0)