Skip to content

Commit 142eded

Browse files
committed
Merge branch 'dev-0.9'
2 parents 88f0ff4 + 6189ae5 commit 142eded

26 files changed

+1218
-2824
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ set(PKG_CONFIG_ARGN --libs-only-l)
123123
add_subdirectory(lighttpd1.4)
124124

125125
set(PLUGIN_STATIC
126+
PLUGIN_INIT(mod_alias)\n
126127
PLUGIN_INIT(mod_dirlisting)\n
127128
PLUGIN_INIT(mod_h2)\n
128129
PLUGIN_INIT(mod_indexfile)\n

README.md

Lines changed: 37 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ and [old][Old Architecture] RN architectures.
3939
[OLD-README.md]: https://github.com/birdofpreyru/react-native-static-server/blob/master/OLD-README.md
4040
[getDeviceType()]: https://www.npmjs.com/package/react-native-device-info#getDeviceType
4141
[MainBundlePath]: https://www.npmjs.com/package/@dr.pogodin/react-native-fs#mainbundlepath
42+
[mod_alias]: https://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_alias
4243
[mod_webdav]: https://redmine.lighttpd.net/projects/lighttpd/wiki/Mod_webdav
4344
[react-native-device-info]: https://www.npmjs.com/package/react-native-device-info
4445
[react-native-fs]: https://www.npmjs.com/package/react-native-fs
@@ -50,6 +51,7 @@ and [old][Old Architecture] RN architectures.
5051

5152
- [Getting Started](#getting-started)
5253
- [Bundling-in Server Assets Into an App Statically](#bundling-in-server-assets-into-an-app-statically)
54+
- [Enabling Alias module]
5355
- [Enabling WebDAV module]
5456
- [API Reference](#api-reference)
5557
- [Project History and Roadmap](#project-history-and-roadmap)
@@ -340,6 +342,20 @@ outside platform-specific sub-folders.
340342
</Target>
341343
```
342344
345+
### Enabling Alias Module
346+
[Enabling Alias module]: #enabling-alias-module
347+
348+
[Lighttpd] module [mod_alias] is used to specify a special document
349+
root for a given url-subset. To enable it just use `extraConfig` option of
350+
[Server] [constructor()] to load and configure it, for example:
351+
352+
```ts
353+
extraConfig: `
354+
server.modules += ("mod_alias")
355+
alias.url = ("/sample/url" => "/special/root/path")
356+
`,
357+
```
358+
343359
### Enabling WebDAV Module
344360
[Enabling WebDAV module]: #enabling-webdav-module
345361
@@ -348,15 +364,11 @@ HTTP extensions that provides a framework allowing to create, change, and move
348364
documents on a server &mdash; essentially an easy way to enable `POST`, `PUT`,
349365
_etc._ functionality for selected routes.
350366
351-
**BEWARE:** _As of now, I only need it for implementing a local testing of
352-
network functionality inside [@dr.pogodin/react-native-fs] library, thus for
353-
development needs only, and I have not put efforts to build it with all features
354-
(support of props and locks), and have not looked much into what configuration
355-
is needed for its safe and flexible production use._
367+
**BEWARE:** _As of now, props and locks are not supported._
356368
357369
To enable [mod_webdav] in the library you need (1) configure your host RN app
358370
to build Lighttpd with [mod_webdav] included; (2) opt-in to use it for selected
359-
routes when you create [Server] instance inside your TypeScript code.
371+
routes when you create [Server] instance, using `extraConfig` option.
360372
361373
1. **Android**: Edit `android/gradle.properties` file of your app, adding
362374
this flag in there:
@@ -374,8 +386,16 @@ routes when you create [Server] instance inside your TypeScript code.
374386
for [WebDAV] module is always packed with the library, and loaded if opted
375387
for by [Server]'s [constructor()].
376388
377-
2. Use `webdav` option of [Server]'s [constructor()] to enable [WebDAV] for
378-
selected routes of the created server instance.
389+
2. Use `extraConfig` option of [Server]'s [constructor()] to load [mod_webdav]
390+
and use it for selected routes of the created server instance, for example:
391+
```ts
392+
extraConfig: `
393+
server.modules += ("mod_webdav")
394+
$HTTP["url"] =~ "^/dav/($|/)" {
395+
webdav.activate = "enable"
396+
}
397+
`,
398+
```
379399
380400
## API Reference
381401
- [Server] &mdash; Represents a server instance.
@@ -452,6 +472,12 @@ within `options` argument:
452472
**BEWARE:** If you opt for file logging with this option, it is up to you
453473
to control and purge the [ERROR_LOG_FILE] as needed.
454474
475+
- `extraConfig` &mdash; **string** &mdash; Optional. If given, it should be
476+
a valid piece of
477+
[Lighttpd configuration](https://redmine.lighttpd.net/projects/lighttpd/wiki/Docs_Configuration),
478+
and it will be appended to the base Lighttpd config generated by this
479+
library according to the other server options.
480+
455481
- `hostname` &mdash; **string** &mdash; Optional. Sets the address for server
456482
to bind to.
457483
- By default, when `nonLocal` option is **false**, `hostname` is set equal
@@ -502,20 +528,9 @@ within `options` argument:
502528
`details` values set equal "_App entered background_",
503529
and "_App entered foreground_" strings.
504530
505-
- `webdav` &mdash; **string[]** &mdash; Optional. Enables [WebDAV] for specified
506-
server routes. To use this option, first read [Enabling WebDAV module]. Each
507-
string inside provided `webdav` array is expected to be a Perl-style regular
508-
expression for the route(s) on which [WebDAV] should be enabled. For example,
509-
to enable [WebDAV] for `/dav` directory and everything below it, you should
510-
give `webdav = ["^/dav($|/)"]`, which will add the following configuration
511-
to the internal [Lighttpd] config of the server:
512-
```perl
513-
$HTTP["url"] =~ "^/dav($|/)" {
514-
webdav.activate = "enable"
515-
}
516-
```
517-
As of now, we don't yet support more advanced features and configurations for
518-
[mod_webdav].
531+
- **DEPRECATED**: `webdav` &mdash; **string[]** &mdash; It still works, but it
532+
will be removed in future versions. Instead of it use `extraConfig` option to
533+
enable and configure [WebDAV] as necessary (see [Enabling WebDAV module]).
519534
520535
#### .addStateListener()
521536
[.addStateListener()]: #addstatelistener

dr-pogodin-react-native-static-server.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Pod::Spec.new do |s|
4646
s.license = package["license"]
4747
s.authors = package["author"]
4848

49-
s.platforms = { :ios => "11.0" }
49+
s.platforms = { :ios => min_ios_version_supported }
5050
s.source = { :git => "https://github.com/birdofpreyru/react-native-static-server.git", :tag => "#{s.version}" }
5151

5252
s.preserve_paths = 'README.md', 'package.json', 'index.js'

0 commit comments

Comments
 (0)