# nw-app-lofter

> Open Lofter App

Latest version **2.9.0** (published 2023-09-22) · ISC license · 0 weekly downloads

## Install

```sh
npm install nw-app-lofter
pnpm add nw-app-lofter
yarn add nw-app-lofter
bun add nw-app-lofter
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.9.0 |
| Published | 2023-09-22 |
| First published | 2017-12-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | hzchenyao |
| Maintainers | luofeiyue, whiskeyi, yousy, guoyeeg, azgaga, liushichuan, yaochen, shenyuan, aflyermin, ignous, jeekdong, longyunxia |

## Links

- npm: https://www.npmjs.com/package/nw-app-lofter
- npm.io page: https://npm.io/package/nw-app-lofter

## Recent versions

- 2.9.0 (latest) — 2023-09-22
- 2.8.0 — 2023-09-21
- 2.7.0 — 2022-12-05
- 2.6.0 — 2022-12-05
- 2.5.1 — 2022-08-22
- 2.5.0 — 2022-08-22
- 2.4.2 — 2022-08-22
- 2.4.1 — 2022-04-29
- 2.4.0 — 2021-07-09
- 2.3.0 — 2020-12-14
- 2.2.3 — 2020-11-11
- 1.27.0 — 2020-01-20
- 1.26.4 — 2019-08-09
- 1.12.21 — 2017-12-26
- 1.12.20 — 2017-12-26

## README

# nw-app-lofter

## 功能

在H5中尝试打开Lofter App内的特定页面，如果没有安装APP，则跳转App下载页

## 重要更新
- 2022-12-05 增加一项参数incantation，用于设置打开app的中转页的指定剪切板内容，防止被默认的下载归因剪切板内容覆盖

## 使用

npm: 通过npm安装`nw-app-lofter`

```javascript 
import {openAppLofter} from 'nw-app-lofter'
openAppLofter({
    path: 'webview',
    query: {
        url: 'http://qatest5.lofter.com'
    }
})
```

## 参数

参数为Object类型，参数各字段定义如下：

| 参数属性 | 类型 | 描述 |
| --- | --- | --- |
| path | String | webview或具体页面类型 |
| query | Object | 参数 |
| act | String | 非必须，活动包统计参数，跳下载会携带 |
| incantation | String | 非必须，path为WebView时，如未安装app，跳转下载中转页后，点击该页下载按钮需要写入剪切板的字符串 |

具体可用path和query参数如下：

| path | query | 描述 |
| --- | --- | --- |
| app | 无 | 只唤起app，不跳转其他页面 |
| webview | url：WAP页面的url  | 如果指定WAP页面已实现APP打开功能，则打开APP内的对应页面；否则通过webview打开 |
| homepage | id：用户id | 个人主页 |
| post | id: 帖子id，userId：用户id | 单日志页 |
| tag | tagName：标签名 | 标签页 |
| publishText | userId：用户id，tagName：标签名(逗号分隔) | 发布文字页 |
| publishPhoto | userId：用户id，tagName：标签名(逗号分隔) | 发布图片页 |
| publishVideo | userId：用户id，tagName：标签名(逗号分隔) | 发布视频页 |

其中，path为webview时，url指定为WAP页url。如APP可打开对应页面，则打开；否则通过webview打开。

示例：

个人主页
```javascript
{
    path: 'webview',
    query: {
       // 个人主页WAP页url
       url: 'http://qatest5.lofter.com'
    }
}
```
 或
```javascript
{
    path: 'homepage',
    query: {
        id: 'qatest5'
    }
}
```

单日志页
```javascript
{
    path: 'webview',
    query: {
       // 单日志页WAP页url
       url: 'http://newsexpress.lofter.com/post/1e7dc1d6_cea03e7'
    }
}
```
 或
```javascript
{
    path: 'post',
    query: {
        id: '1e7dc1d6_cea03e7',
        userId: 'newsexpress'
    }
}
```

标签页
```javascript
{
    path: 'webview',
    query: {
       // 标签WAP页url
       url: 'http://www.lofter.com/tag/%E9%9F%B3%E4%B9%90'
    }
}
```
 或
```javascript
{
    path: 'tag',
    query: {
        tagName: '音乐'
    }
}
```

发布文字页
```javascript
{
    path: 'webview',
    query: {
       //发布文字WAP页面url   
       url: 'http://www.lofter.com/blog/qatest5/new/text?extraTags=%E9%9F%B3%E4%B9%90,music,happy%20new%20year'
    }
}
```
或
```javascript
{
    path: 'publishText',
    query: {
        userId: 'qatest5',
        tagName: '音乐,music,happy new year'
    }
}
```

等等...

---
_Source: https://npm.io/package/nw-app-lofter · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
