手把手带你编写微信小程序逆向解释器 - 第二篇 app-config.json 文件解析

本文详细讲解了如何解析微信小程序的app-config.json文件,提取关键节点如pages、window、tabBar等,以及如何处理base64图片内容和文件路径,最终转换为标准的app.json。同时介绍了在转换过程中对images目录下多级子目录图片的处理方法。
摘要由CSDN通过智能技术生成

这节课我们将一起来掌握app.config.json文件如何解析

在这里插入图片描述

解析app-config.json 的文件内容

整个JSON 文件的内容比较多, 但在这个JSON文件中 对我们有用的信息只有 3个节点 分别是 pages global tabBar

  • 解压不同的微信小程序JSON文件中比较有用的节点 还会包含 subPackages (分包的内容后面有单独章节描述)
  • 目前我们只需要将 pages global tabBar 这几个节点分别解析出来就可以还原微信小程序的 app.json 文件
  • 对于 tabBar 这个配置项中 iconDataselectedIconData 配置项在小程序源文件中对应的名称应该是 iconPath selectedIconPath
  • 对于前者 iconDataselectedIconData 的内容是 base64 的图片内容 , 而后者中的 iconPath 与 SelectedIconPath 是文件路径, 这里我们需要逐一对文件进行对比 并还原出图片的原路径信息
  • 最后就是 tabBar 的页面路径 是不包含 .html 后缀的 , 这里也需要替换掉哦
{
   
  "entryPagePath": "pages/index/index.html",
  "pages": [
    "pages/index/index",
    "pages/noteSearch/index",
    "pages/searchBook/index",
    "pages/addBook/index",
    "pages/noteTree/index",
    "pages/noteDetail/index",
    "pages/my/home/index",
    "pages/my/log/index",
    "pages/my/about/index",
    "pages/my/backup/index",
    "pages/t-canvas-html/index",
    "pages/noteCalendar/index"
  ],
  "page": {
   
    "pages/index/index.html": {
   
      "window": {
   
        "usingComponents": {
   
          "cu-custom": "/colorui/components/cu-custom",
          "i-toast": "../../dist/iview/toast/index",
          "van-loading": "../../dist/vant/loading/index",
          "l-slide-view": "../../dist/lin/slide-view/index"
        },
        "navigationBarBackgroundColor": "#fff",
        "navigationBarTitleText": "",
        "navigationBarTextStyle": "black",
        "navigationStyle": "custom"
      }
    },
    "pages/noteSearch/index.html": {
   
      "window": {
    "usingComponents": {
   }, "navigationBarTitleText": "笔记搜索" }
    },
    "pages/searchBook/index.html": {
   
      "window": {
   
        "usingComponents": {
   
          "cu-custom": "/colorui/components/cu-custom",
          "i-toast": "../../dist/iview/toast/index",
          "van-loading": "../../dist/vant/loading/index"
        },
        "navigationBarTitleText": "搜索书籍"
      }
    },
    "pages/addBook/index.html": {
   
      "window": {
   
        "usingComponents": {
    "i-toast": "../../dist/iview/toast/index" },
        "navigationBarTitleText": "添加一本书"
      }
    },
    "pages/noteTree/index.html": {
   
      "window": {
   
        "usingComponents": {
   
          "i-toast": "../../dist/iview/toast/index",
          "van-loading": "../../dist/vant/loading/index",
          "wxml-to-canvas": "../../miniprogram_npm/wxml-to-canvas/index",
          "l-slide-view": "../../dist/lin/slide-view/index",
          "wux-swipe-action": "../../dist/wuxui/swipe-action/index",
          "wux-swipe-action-group": "../../dist/wuxui/swipe-action-group/index",
          "van-dialog": "../../dist/vant/dialog/index"
        },
        "navigationBarTitleText": "笔记树"
      }
    },
    "pages/noteDetail/index.html": {
   
      "window": {
   
        "usingComponents": {
    "i-toast": "../../dist/iview/toast/index" },
        "navigationBarTitleText": "笔记详情"
      }
    },
    "pages/my/home/index.html": {
   
      "window": {
   
        "usingComponents": {
    "van-dialog": "../../../dist/vant/dialog/index" },
        "navigationBarTitleText": "我的中心"
      }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

gyhcp6650261

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值